Fix watchdog on rmt task

This commit is contained in:
2026-03-04 04:26:06 -05:00
parent 5f02634794
commit 9cd7cbac3b
5 changed files with 72 additions and 58 deletions

View File

@@ -514,12 +514,21 @@ esp_err_t DataLinkManager::receive_rmt(uint8_t channel){
res = link_layer_obj->start_receive_frames_rmt(i);
}
while(!link_layer_obj->stop_tasks){
bool any_received = false;
for (uint8_t i = 0; i < link_layer_obj->num_channels; i++){
res = link_layer_obj->receive_rmt(i);
res = link_layer_obj->start_receive_frames_rmt(i);
esp_err_t r = link_layer_obj->receive_rmt(i);
if (r == ESP_OK){
any_received = true;
}
link_layer_obj->start_receive_frames_rmt(i);
taskYIELD(); // feed the watchdog and yield to other tasks between channel polls
}
vTaskDelay(pdMS_TO_TICKS(RECEIVE_TASK_PERIOD_MS));
if (!any_received){
// Nothing received on any channel — sleep briefly to avoid busy-spinning
// and give the watchdog / idle task guaranteed CPU time.
vTaskDelay(pdMS_TO_TICKS(RECEIVE_TASK_PERIOD_MS));
}
}
vTaskDelete(nullptr);

View File

@@ -5,7 +5,7 @@
#define SCHEDULER_MUTEX_WAIT 10 //max time duration to wait
#define SCHEDULER_PERIOD_MS 10
#define RECEIVE_TASK_PERIOD_MS 2
#define RECEIVE_TASK_PERIOD_MS 5
#define GENERIC_FRAME_SLIDING_WINDOW_SIZE 5 //defines the maximum size of the sliding window before resending previously un-ack'd fragments
#define SLIDING_WINDOW_MUTEX_TIMEOUT_MS 5