mirror of
https://github.com/BotChain-Robots/firmware.git
synced 2026-07-08 09:37: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
|
||||
|
||||
@@ -579,9 +579,7 @@ esp_err_t RMTManager::receive(uint8_t* recv_buf, size_t size, size_t* output_siz
|
||||
}
|
||||
|
||||
rmt_rx_done_event_data_t rx_data;
|
||||
if (xQueueReceive(channels[channel_num].rx_queue, &rx_data, pdMS_TO_TICKS(5)) != pdTRUE){ //this will wait until a message has arrived or not
|
||||
// printf("Timeout occurred while waiting for RX event\n");
|
||||
// ESP_LOGE(DEBUG_TAG, "Timeout occurred while waiting for RX event - didn't receive a message in time");
|
||||
if (xQueueReceive(channels[channel_num].rx_queue, &rx_data, 0) != pdTRUE){ // non-blocking poll
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,12 @@ public:
|
||||
std::vector<uint8_t> return_value(msg.begin(), msg.end());
|
||||
writer.write(return_value);
|
||||
});
|
||||
const auto bandwidth_test_fn_tag = 101;
|
||||
m_messaging_interface->register_function(bandwidth_test_fn_tag, [](const uint8_t *parameters, size_t parameter_size, Writer& writer) {
|
||||
std::string msg = "";
|
||||
std::vector<uint8_t> return_value(msg.begin(), msg.end());
|
||||
writer.write(return_value);
|
||||
});
|
||||
}
|
||||
|
||||
MessagingInterface &get_messaging_interface();
|
||||
|
||||
@@ -21,6 +21,7 @@ extern "C" [[noreturn]] void app_main(void) {
|
||||
auto& config_manager = ConfigManager::get_instance(); // NOLINT - here for easily adding temporary config
|
||||
config_manager.set_communication_method(CommunicationMethod::Wireless);
|
||||
|
||||
|
||||
esp_log_set_vprintf(RemoteDebugging::custom_log_write);
|
||||
|
||||
const auto loop_manager = std::make_unique<LoopManager>();
|
||||
|
||||
Reference in New Issue
Block a user