Modify MedianFilter to work with non-full buffer. Fix get_median. Remove unneeded code from http_task (#49)

This commit is contained in:
luar123
2023-11-23 13:19:35 +01:00
committed by GitHub
Unverified
parent ffc13174ca
commit d3e20fe0eb
5 changed files with 68 additions and 81 deletions

View File

@@ -778,21 +778,6 @@ static void http_get_task(void *pvParameters) {
timeout = FAST_SYNC_LATENCY_BUF;
esp_timer_stop(timeSyncMessageTimer);
if (received_header == true) {
if (!esp_timer_is_active(timeSyncMessageTimer)) {
esp_timer_start_periodic(timeSyncMessageTimer, timeout);
}
bool is_full = false;
latency_buffer_full(&is_full, portMAX_DELAY);
if ((is_full == true) && (timeout < NORMAL_SYNC_LATENCY_BUF)) {
if (esp_timer_is_active(timeSyncMessageTimer)) {
esp_timer_stop(timeSyncMessageTimer);
}
esp_timer_start_periodic(timeSyncMessageTimer, timeout);
}
}
if (opusDecoder != NULL) {
opus_decoder_destroy(opusDecoder);
@@ -2210,18 +2195,6 @@ static void http_get_task(void *pvParameters) {
esp_timer_start_periodic(timeSyncMessageTimer,
timeout);
}
bool is_full = false;
latency_buffer_full(&is_full, portMAX_DELAY);
if ((is_full == true) &&
(timeout < NORMAL_SYNC_LATENCY_BUF)) {
if (esp_timer_is_active(timeSyncMessageTimer)) {
esp_timer_stop(timeSyncMessageTimer);
}
esp_timer_start_periodic(timeSyncMessageTimer,
timeout);
}
}
break;
@@ -2636,18 +2609,6 @@ static void http_get_task(void *pvParameters) {
esp_timer_start_periodic(timeSyncMessageTimer,
timeout);
}
bool is_full = false;
latency_buffer_full(&is_full, portMAX_DELAY);
if ((is_full == true) &&
(timeout < NORMAL_SYNC_LATENCY_BUF)) {
if (esp_timer_is_active(timeSyncMessageTimer)) {
esp_timer_stop(timeSyncMessageTimer);
}
esp_timer_start_periodic(timeSyncMessageTimer,
timeout);
}
}
}
@@ -2677,6 +2638,19 @@ static void http_get_task(void *pvParameters) {
esp_timer_stop(timeSyncMessageTimer);
}
esp_timer_start_periodic(timeSyncMessageTimer,
timeout);
}
else if ((is_full == false) &&
(timeout > FAST_SYNC_LATENCY_BUF)){
timeout = FAST_SYNC_LATENCY_BUF;
ESP_LOGI(TAG, "latency buffer not full");
if (esp_timer_is_active(timeSyncMessageTimer)) {
esp_timer_stop(timeSyncMessageTimer);
}
esp_timer_start_periodic(timeSyncMessageTimer,
timeout);
}