Notifications
Clear all

[Solved] Updating Your Old Code article example ESPNOW 2-Way Communication code won't compile

8 Posts
2 Users
0 Reactions
6,467 Views
(@pritchs)
Member
Joined: 4 years ago
Posts: 34
Topic starter  

Hi everyone,

The example code from Bill’s December 27, 2024, article ESP32 Boards Manager 3 – Updating Your Old Code won’t compile. It has been a while since I played with ESP32s, and in the meantime, Arduino has moved from Boards Manager 2 to 3. I was surprised when Bill's updated version of the ESPNOW code wouldn’t compile. That means I am doing something wrong.

I have an Espressif esp32-s3 devkit c-1 v1.1 I am dealing with. I have uninstalled and reinstalled the Arduino IDE. I have uninstalled and reinstalled the ESP32 board packages. I have tried the ESP32S3 Dev Module board as well as the ESP32 Dev Module with the same results. So, here are the errors:

error: invalid conversion from 'void (*)(const uint8_t*, esp_now_send_status_t)' {aka 'void (*)(const unsigned char*, esp_now_send_status_t)'} to 'esp_now_send_cb_t' {aka 'void (*)(const wifi_tx_info_t*, esp_now_send_status_t)'} [-fpermissive]
100 | esp_now_register_send_cb(OnDataSent);
| ^~~~~~~~~~
| |
| void (*)(const uint8_t*, esp_now_send_status_t) {aka void (*)(const unsigned char*, esp_now_send_status_t)}
In file included from C:\Users\pritc\AppData\Local\Temp\.arduinoIDE-unsaved202583-22248-1l22m2v.a98t\sketch_sep3a\sketch_sep3a.ino:10:
C:\Users\pritc\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.5-b66b5448-v1\esp32/include/esp_wifi/include/esp_now.h:185:54: note: initializing argument 1 of 'esp_err_t esp_now_register_send_cb(esp_now_send_cb_t)'
185 | esp_err_t esp_now_register_send_cb(esp_now_send_cb_t cb);
| ~~~~~~~~~~~~~~~~~~^~
Using library WiFi at version 3.3.0 in folder: C:\Users\pritc\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.0\libraries\WiFi
Using library Networking at version 3.3.0 in folder: C:\Users\pritc\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.0\libraries\Network
exit status 1

Compilation error: invalid conversion from 'void (*)(const uint8_t*, esp_now_send_status_t)' {aka 'void (*)(const unsigned char*, esp_now_send_status_t)'} to 'esp_now_send_cb_t' {aka 'void (*)(const wifi_tx_info_t*, esp_now_send_status_t)'} [-fpermissive]

I’m sure there is loads of information I have left out, but just ask and I will get it.

Thank you in advance for any advice!



   
Quote
(@pritchs)
Member
Joined: 4 years ago
Posts: 34
Topic starter  

My solution was simple in the end. After spending too many hours searching for a solution, I uninstalled version 3.3 of the Arduino ESP32 core and reverted to the previous version. That one compiled the code, so I reinstalled the v3.3, and the code compiled. So, it was apparently a corrupted copy of 3.3. At least as far as I can tell.



   
ReplyQuote
TFMcCarthy
(@tfmccarthy)
Member
Joined: 2 years ago
Posts: 514
 

Posted by: @pritchs

I was surprised when Bill's updated version of the ESPNOW code wouldn’t compile. That means I am doing something wrong.

You didn't do anything wrong. Espressif tripped you up.

This question seems to keep coming up. It has been answered by me and others using a simple cast (see esp NOW issue ). It would be better to avoid the cast and change the code.

A tip: you can often save some time by searching the forum for an issue. Here I searched for "esp_now_register_send_cb" to find the old posts on the issue.

HTH


The one who has the most fun, wins!


   
ReplyQuote
(@pritchs)
Member
Joined: 4 years ago
Posts: 34
Topic starter  

@tfmccarthy Thanks for the reply. FWIW, I did search the form as well as Googling the issue. There was lots of advice, but none seemed to work for me. Maybe I just missed the critical info somewhere - or didn't understand it, which is always possible. 

Thanks again for the reply!



   
ReplyQuote
TFMcCarthy
(@tfmccarthy)
Member
Joined: 2 years ago
Posts: 514
 

Posted by: @pritchs

FWIW, I did search the form as well as Googling the issue. There was lots of advice, but none seemed to work for me. Maybe I just missed the critical info somewhere - or didn't understand it, which is always possible. 

This is me having programmer OCD.

Are you saying that you now understand how to resolve the issue or it's still unresolved? If it's still unresolved, I can go through the solution in detail. If you have a problem I don't know about, I'm very interested in what it is.


The one who has the most fun, wins!


   
ReplyQuote
(@pritchs)
Member
Joined: 4 years ago
Posts: 34
Topic starter  

@tfmccarthy, my "solution" was to revert from the current ESP32 core v3.3.0 to the previous version v3.2.1. That resolved the errors, and at some point, I tried reinstalling the current v3.3.0, and the errors did not recur. I assume that reverting to a previous version and then reinstalling the current version overwrote a corrupted v3.3.0. Or maybe it was magic. Same thing when it comes to this sort of thing for me. 🙂

HTH



   
ReplyQuote
TFMcCarthy
(@tfmccarthy)
Member
Joined: 2 years ago
Posts: 514
 

Posted by: @pritchs

t some point, I tried reinstalling the current v3.3.0, and the errors did not recur.

If you're satisfied, then I won't pursue it.

Good Luck.


The one who has the most fun, wins!


   
ReplyQuote
(@pritchs)
Member
Joined: 4 years ago
Posts: 34
Topic starter  

@tfmccarthy I'm good. Thanks!



   
ReplyQuote