Update logging for better coverage
This commit is contained in:
parent
a195ca2b0c
commit
63273a63b8
@ -9,12 +9,15 @@
|
|||||||
#include "esp_netif.h"
|
#include "esp_netif.h"
|
||||||
#include "esp_now.h"
|
#include "esp_now.h"
|
||||||
#include "esp_wifi.h"
|
#include "esp_wifi.h"
|
||||||
|
#include "esp_log.h"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
using namespace Networking;
|
using namespace Networking;
|
||||||
|
|
||||||
|
static const char* TAG = "Networking";
|
||||||
|
|
||||||
static_assert(std::is_standard_layout_v<EspNowEvent> && std::is_trivial_v<EspNowEvent>,
|
static_assert(std::is_standard_layout_v<EspNowEvent> && std::is_trivial_v<EspNowEvent>,
|
||||||
"EspNowEvent is not compatible with a FreeRTOS queue.");
|
"EspNowEvent is not compatible with a FreeRTOS queue.");
|
||||||
|
|
||||||
@ -40,6 +43,7 @@ void s_cbEspNowSendComplete(const std::uint8_t* peer_mac, esp_now_send_status_t
|
|||||||
|
|
||||||
EspNowEvent event = { EspNowEvent::MSG_SEND_COMPLETE, 0 };
|
EspNowEvent event = { EspNowEvent::MSG_SEND_COMPLETE, 0 };
|
||||||
xQueueSend(s_esp_now_queue, &event, 0);
|
xQueueSend(s_esp_now_queue, &event, 0);
|
||||||
|
ESP_LOGD(TAG, "Send complete. s_tx_inflight = false.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void s_cbEspNowReceiveComplete(const esp_now_recv_info_t* recv_info, const std::uint8_t* data, int len)
|
void s_cbEspNowReceiveComplete(const esp_now_recv_info_t* recv_info, const std::uint8_t* data, int len)
|
||||||
@ -49,6 +53,7 @@ void s_cbEspNowReceiveComplete(const esp_now_recv_info_t* recv_info, const std::
|
|||||||
|
|
||||||
EspNowEvent event = { EspNowEvent::MSG_RECEIVED, rx_len };
|
EspNowEvent event = { EspNowEvent::MSG_RECEIVED, rx_len };
|
||||||
xQueueSend(s_esp_now_queue, &event, 0);
|
xQueueSend(s_esp_now_queue, &event, 0);
|
||||||
|
ESP_LOGD(TAG, "Received message. Length: %d.", len);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -97,7 +102,14 @@ void sendData(const std::array<std::uint8_t, 128>& buffer, const std::size_t len
|
|||||||
!s_tx_inflight && peer_mac != nullptr)
|
!s_tx_inflight && peer_mac != nullptr)
|
||||||
{
|
{
|
||||||
esp_now_send(peer_mac->data(), buffer.data(), length);
|
esp_now_send(peer_mac->data(), buffer.data(), length);
|
||||||
s_tx_inflight = true;
|
if (!s_isBroadcastAddress(peer_mac->data()))
|
||||||
|
s_tx_inflight = true;
|
||||||
|
|
||||||
|
ESP_LOGD(TAG, "Message send started. s_tx_inflight = %d.", s_tx_inflight);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ESP_LOGW(TAG, "Dropped message.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -94,6 +94,10 @@ extern "C" void app_main(void)
|
|||||||
{
|
{
|
||||||
ESP_ERROR_CHECK(nvs_flash_init());
|
ESP_ERROR_CHECK(nvs_flash_init());
|
||||||
|
|
||||||
|
esp_log_level_set("*", ESP_LOG_INFO);
|
||||||
|
esp_log_level_set(TAG, ESP_LOG_DEBUG);
|
||||||
|
esp_log_level_set("Networking", ESP_LOG_DEBUG);
|
||||||
|
|
||||||
ESP_LOGD(TAG, "Starting main.");
|
ESP_LOGD(TAG, "Starting main.");
|
||||||
|
|
||||||
Networking::setupWifi();
|
Networking::setupWifi();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user