From 5f0263479466019c3d64c46b71f3ff3c6bb157b0 Mon Sep 17 00:00:00 2001 From: Justin Chow Date: Wed, 4 Mar 2026 04:19:19 -0500 Subject: [PATCH] add logs and decerase rx queue wait timer --- components/dataLink/DataLinkFrames.cpp | 6 ++++-- components/dataLink/DataLinkScheduler.cpp | 4 +++- components/rmt/RMTManager.cpp | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/components/dataLink/DataLinkFrames.cpp b/components/dataLink/DataLinkFrames.cpp index ef36679..8745e80 100644 --- a/components/dataLink/DataLinkFrames.cpp +++ b/components/dataLink/DataLinkFrames.cpp @@ -350,6 +350,8 @@ esp_err_t DataLinkManager::receive_rmt(uint8_t channel){ if (!async_receive_queue->enqueue(std::move(metadata), std::chrono::milliseconds(ASYNC_QUEUE_WAIT_TICKS))){ return ESP_ERR_TIMEOUT; } + // ESP_LOGI("TMP", "Control frame LUT cache HIT - hash=0x%08lX", peeked_hash); + return ESP_OK; } // Cache miss – fall through to full validation below @@ -420,12 +422,12 @@ esp_err_t DataLinkManager::receive_rmt(uint8_t channel){ //check for a rip frame if (static_cast(GET_TYPE(header.type_flag)) == FrameType::RIP_TABLE_CONTROL){ - ESP_LOGI(DEBUG_LINK_TAG, "Got a RIP frame"); + ESP_LOGI(DEBUG_LINK_TAG, "Got a RIP frame from channel %d", channel); for (size_t i = 0; i < message_size-1; i+=2){ uint8_t board_id = message->data()[i]; uint8_t hops = message->data()[i+1]; - // ESP_LOGI(DEBUG_LINK_TAG, "Received: board_id %d and number of hops %d on channel %d", board_id, hops, channel); + ESP_LOGI(DEBUG_LINK_TAG, "Received: board_id %d and number of hops %d on channel %d", board_id, hops, channel); RIPRow* entry = nullptr; diff --git a/components/dataLink/DataLinkScheduler.cpp b/components/dataLink/DataLinkScheduler.cpp index aea1e9e..e60ab75 100644 --- a/components/dataLink/DataLinkScheduler.cpp +++ b/components/dataLink/DataLinkScheduler.cpp @@ -128,6 +128,8 @@ esp_err_t DataLinkManager::scheduler_send(uint8_t channel){ size_t frame_size = isControlFrame ? sizeof(ControlFrame) : sizeof(GenericFrame); uint8_t send_data[frame_size]; + ESP_LOGI(DEBUG_LINK_TAG, "Sending frame on channel %d, type: %s", channel, isControlFrame ? "Control" : "Generic"); + if (isControlFrame){ //control frame @@ -289,7 +291,7 @@ esp_err_t DataLinkManager::scheduler_send_rmt(uint8_t channel, SchedulerMetadata ESP_LOGE(DEBUG_LINK_TAG, "Failed to find entry for %d", frame.header.receiver_id); return ESP_FAIL; } - // ESP_LOGI(DEBUG_LINK_TAG, "Sending frame %d frag_info 0x%X", frame.header.seq_num, frame.header.frag_info); + ESP_LOGI(DEBUG_LINK_TAG, "Sending frame %d on channel %d to board %d frag_info 0x%X", frame.header.seq_num, channel, frame.header.receiver_id, frame.header.frag_info); res = phys_comms->send(send_data, frame_size, &config, channel_to_route); // if (wait_for_tx_done){ // phys_comms->wait_until_send_complete(channel_to_route); diff --git a/components/rmt/RMTManager.cpp b/components/rmt/RMTManager.cpp index 63ece89..3ffc301 100644 --- a/components/rmt/RMTManager.cpp +++ b/components/rmt/RMTManager.cpp @@ -579,7 +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(150)) != pdTRUE){ //this will wait until a message has arrived or not + 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"); return ESP_FAIL;