Hi Sara,
I’m having a little problem with the recent ESP NOW CYD sketch. Have you any idea what I’m doing wrong?
I am using a couple of ESP32 dev kit v1 modules.
Thanks
When attempting to compile the Sender code for the ESP32 CYD ESP NOW sketch, The error message: ”
exit status 1
Compilation error: ‘wifi_tx_info_t’ does not name a type; did you mean ‘wifi_sta_info_t’?
This is referring to line 56
// Callback when data is sent
void OnDataSent(const wifi_tx_info_t* mac_addr, esp_now_send_status_t status) {
char macStr[18];
Serial.print(“Packet to: “);
// Copies the receiver mac address to a string
snprintf(macStr, sizeof(macStr), “%02x:%02x:%02x:%02x:%02x:%02x”,
mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);
Serial.print(macStr);
Serial.print(” send status:\t”);
Serial.println(status == ESP_NOW_SEND_SUCCESS ? “Delivery Success” : “Delivery Fail”);
}
I tried changing the type to ‘wifi_sta_info_t but I just got another error message referring to line 78
‘invalid conversion from void()(const wifi_sta_info_t, esp_now_send_status_t) to ‘esp_now-send_cb_t'{aka ‘void()
const unsigned char,esp_now_send_status_t)}[-fpermissive]
Hi.
Update your ESP32 boards to the latest version.
Go to Tools > Boards > Boards Manager > Search for ESP32 and install the latest version.
Regards,
Sara
The problem appears to be an error in your code. It has been corrected in the how does it work section.
The correct line is:
void OnDataSent(const uint8_t *mac_addr, esp_now_send_status_t status) {
instead of the code shown in the first sketch of the ESP32 ESP_NOW Sender Code
void OnDataSent(const wifi_tx_info_t *mac_addr, esp_now_send_status_t status) {
HTH
Gary