how to see ESPNOW send error code?
Posted: Wed Jun 19, 2024 4:49 am
Two questions: first, I am sending a small (12 byte) struct from one ESP32 to another, and returning an ack. The exchange frequently fails. The esp_now_send() never fails, and always returns ESP_OK. However, the send callback returns failure most of the time. When I check the status in the callback, it's either ESP_NOW_SEND_SUCCESS (occasionally) or ESP_NOW_SEND_FAIL (usually).
In esp_now.h, there are a lot of specific error codes for different conditions. How do I get access to the error code causing my failure? The send always returns success, and then the failed callback doesn't give any useful information.
Second question: I'm hosting a small web site for device/sensor status (sent via SSE/Javascript), as well as OTA updates and Webserial. I suspect there's too much TCP/HTTP traffic going out and the ESPNOW packets are squashed. Are there any good ways to broker traffic between ESPNOW and everything else? Obviously I can shut off the web service but I would like to have both. And I can switch ESPNOW to raw UDP or TCP, but I would like the two devices to be able to communicate even when they are not connected to wifi (the devices will go on a boat where there may sometimes be wifi and frequently there will not but they still need to communicate). I could switch to TCP when connected to a network and switch back to ESPNOW otherwise, but that's a lot of additional work. It would be nice if they could coexist.
Environment: VS Code + PIO + Arduino.
In esp_now.h, there are a lot of specific error codes for different conditions. How do I get access to the error code causing my failure? The send always returns success, and then the failed callback doesn't give any useful information.
Second question: I'm hosting a small web site for device/sensor status (sent via SSE/Javascript), as well as OTA updates and Webserial. I suspect there's too much TCP/HTTP traffic going out and the ESPNOW packets are squashed. Are there any good ways to broker traffic between ESPNOW and everything else? Obviously I can shut off the web service but I would like to have both. And I can switch ESPNOW to raw UDP or TCP, but I would like the two devices to be able to communicate even when they are not connected to wifi (the devices will go on a boat where there may sometimes be wifi and frequently there will not but they still need to communicate). I could switch to TCP when connected to a network and switch back to ESPNOW otherwise, but that's a lot of additional work. It would be nice if they could coexist.
Environment: VS Code + PIO + Arduino.