Closed
Description
Board
ESP32C3 Dev Module
Device Description
Basic ESP32-C3-DevKit
https://docs.espressif.com/projects/esp-idf/en/latest/esp32c3/hw-reference/esp32c3/user-guide-devkitm-1.html
Hardware Configuration
No other Hardware Attached
Version
v3.0.0
IDE Name
Arduino IDE 2.3.2
Operating System
Windows 10
Flash frequency
80 MHz
PSRAM enabled
yes
Upload speed
921600
Description
Using This Example https://randomnerdtutorials.com/esp-now-esp32-arduino-ide/ For receiving and transmitting via ESPNow
The ESP32 Receiver Sketch (ESP-NOW) no longer compiles after the update to 3.0.0 due to issues within esp_now.h, verified that the sketch compiles correctly on version 2.0.17.
Sketch
/*
Rui Santos
Complete project details at https://RandomNerdTutorials.com/esp-now-esp32-arduino-ide/
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
*/
#include <esp_now.h>
#include <WiFi.h>
// Structure example to receive data
// Must match the sender structure
typedef struct struct_message {
char a[32];
int b;
float c;
bool d;
} struct_message;
// Create a struct_message called myData
struct_message myData;
// callback function that will be executed when data is received
void OnDataRecv(const uint8_t * mac, const uint8_t *incomingData, int len) {
memcpy(&myData, incomingData, sizeof(myData));
Serial.print("Bytes received: ");
Serial.println(len);
Serial.print("Char: ");
Serial.println(myData.a);
Serial.print("Int: ");
Serial.println(myData.b);
Serial.print("Float: ");
Serial.println(myData.c);
Serial.print("Bool: ");
Serial.println(myData.d);
Serial.println();
}
void setup() {
// Initialize Serial Monitor
Serial.begin(115200);
// Set device as a Wi-Fi Station
WiFi.mode(WIFI_STA);
// 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() {
}
Debug Message
C:\Users\jaegerba\AppData\Local\Temp\.arduinoIDE-unsaved2024431-9968-ilie0.szczid\sketch_may31b\sketch_may31b.ino: In function 'void setup()':
C:\Users\jaegerba\AppData\Local\Temp\.arduinoIDE-unsaved2024431-9968-ilie0.szczid\sketch_may31b\sketch_may31b.ino:58:28: error: invalid conversion from 'void (*)(const uint8_t*, const uint8_t*, int)' {aka 'void (*)(const unsigned char*, const unsigned char*, int)'} to 'esp_now_recv_cb_t' {aka 'void (*)(const esp_now_recv_info*, const unsigned char*, int)'} [-fpermissive]
58 | esp_now_register_recv_cb(OnDataRecv);
| ^~~~~~~~~~
| |
| void (*)(const uint8_t*, const uint8_t*, int) {aka void (*)(const unsigned char*, const unsigned char*, int)}
In file included from C:\Users\jaegerba\AppData\Local\Temp\.arduinoIDE-unsaved2024431-9968-ilie0.szczid\sketch_may31b\sketch_may31b.ino:12:
C:\Users\jaegerba\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.1-442a798083/esp32c3/include/esp_wifi/include/esp_now.h:157:54: note: initializing argument 1 of 'esp_err_t esp_now_register_recv_cb(esp_now_recv_cb_t)'
157 | esp_err_t esp_now_register_recv_cb(esp_now_recv_cb_t cb);
| ~~~~~~~~~~~~~~~~~~^~
exit status 1
Compilation error: invalid conversion from 'void (*)(const uint8_t*, const uint8_t*, int)' {aka 'void (*)(const unsigned char*, const unsigned char*, int)'} to 'esp_now_recv_cb_t' {aka 'void (*)(const esp_now_recv_info*, const unsigned char*, int)'} [-fpermissive]
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide
- I confirm I have checked existing issues, online documentation and Troubleshooting guide.