mirror of
https://github.com/BotChain-Robots/firmware.git
synced 2026-07-08 17:47:21 +02:00
Fix watchdog on rmt task
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user