Hello
Recently a library was changed in Arduino and my Esp_Now receiver code cannot be compiled anymore. As read in other post I changed the definition of the first parameter in the callback function but I still have an error.
Here is a very simplified code:
#include <ESP32_NOW.h>
#include <WiFi.h>
// callback function that will be executed when data is received
void onDataRecv(esp_now_recv_info_t *mac_addr, const uint8_t *incomingData, int len) {
}
void setup() {
// put your setup code here, to run once:
// Init ESP-NOW
if (esp_now_init() != ESP_OK) {
Serial.println("Error initializing ESP-NOW");
return;
}
// Once ESPNow is successfully Init, we will register for recv CB to
// get recv packer info
esp_now_register_recv_cb(OnDataRecv);
}
void loop() {
// put your main code here, to run repeatedly:
}
and the message error:
C:\Users\mabil\Documents\Arduino\ESP32_exemples\ESPNOW\Test_Call_Back\Test_Call_Back.ino: In function 'void setup()':
C:\Users\mabil\Documents\Arduino\ESP32_exemples\ESPNOW\Test_Call_Back\Test_Call_Back.ino:18:28: error: 'OnDataRecv' was not declared in this scope; did you mean 'onDataRecv'?
18 | esp_now_register_recv_cb(OnDataRecv);
| ^~~~~~~~~~
| onDataRecv
exit status 1
Compilation error: 'OnDataRecv' was not declared in this scope; did you mean 'onDataRecv'?
I have look at the documentation but not beeing familiar with the use of typedef I don't find a way to correct my code
Can you help?
Claude