Skip to content

ESP NOW compilation issue of #11243

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
yonagy82 opened this issue Apr 13, 2025 · 8 comments
Closed
1 task done

ESP NOW compilation issue of #11243

yonagy82 opened this issue Apr 13, 2025 · 8 comments

Comments

@yonagy82
Copy link

Board

XIAO ESP32-C3

Device Description

XIAO ESP32-C3 stand alone (wifi communication)

Hardware Configuration

XIAO ESP32-C3 stand alone (wifi communication)

Version

v3.1.3

IDE Name

Arduino IDE Version 2.3.5

Operating System

Windows 10

Flash frequency

N/A

PSRAM enabled

no

Upload speed

9600

Description

Hello, friends,
I know that the issue was discussed multiple times. I read the solutions, but none had worked for me. So, regretfully' I have to place the question ove again.

I'm using Aarduino IDE Version 2.3.5, The library is ESP-NOW version 3.1.3. The ESP_NOW sub library is Unicast transmission by Lucas Saavedra Vaz - 2024, downloaded from https://github.com/espressif/arduino-esp32/. It is stored on my computer at c:\Users\USER\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.4-2f7dcd86-v1\esp32c3/include/esp_wifi/include/esp_now.h

I tried several code variants and combunations of them:

void OnDataRecv(const uint8_t *mac_addr, const uint8_t *incomingData, int len) 
void OnDataRecv(const esp_now_recv_info_t *info, const uint8_t *incomingData, int len) 
OnDataRecv(const esp_now_recv_info_t *info, const uint8_t *incomingData, int len)

and registrations:

esp_now_register_recv_cb(OnDataRecv);
esp_now_register_recv_cb(esp_now_recv_cb_t(OnDataRecv));

The error message is consistent with small variants:
invalid use of non-static member function 'void (* espNowServerClass::OnDataRecv(const uint8_t*, const uint8_t*, int))(const esp_now_recv_info_t*, const uint8_t*, int), with or without the suffix (did you forget the '()'?)

When using the non-void version of the method OnDataRecv I've noticed another issue: any macro returned by the method invoked two notices:

  1. When using the value ESP_ERR_ESPNOW_NOT_INIT - warning from esp_now.h: pointer to arithmetic expression
  2. When using the value LOW or 1- error from esp_now.h: invalid conversion from 'int' to 'esp_now_recv_cb_t' {aka 'void (*)(const esp_now_recv_info*, const unsigned char*, int)'} [-fpermissive]
    In both cases the was a note from the .ino - in expansion of macro '...'.

I'm already on this for quite some time; should I downgrade the library? to which revision? What are the functions or nugs that will be lost? How to do it?
Best regards
Yona

Sketch

N/A - the module is stand alone

Debug Message

See the description

Other Steps to Reproduce

N/A - before using the ESP32 module

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@yonagy82 yonagy82 added the Status: Awaiting triage Issue is waiting for triage label Apr 13, 2025
@me-no-dev
Copy link
Member

Please provide minimal (full) example that we can try to compile and debug. Maybe also have a look at our own ESP-NOW library that is included in the core

@me-no-dev me-no-dev added the Status: Awaiting Response awaiting a response from the author label Apr 14, 2025
@yonagy82
Copy link
Author

yonagy82 commented Apr 14, 2025 via email

@Jason2866 Jason2866 removed the Status: Awaiting triage Issue is waiting for triage label Apr 14, 2025
@Jason2866
Copy link
Collaborator

The used examples looks like are not adopted to the changed implementation in Arduino Core 3.x and are conflicting. You can try to remove the provided ESP NOW libs provided in Arduino Core and use only the code you posted / linked. The API calls and esp_now.h from IDF is there in Arduino Core and working. Using ESP NOW in project Tasmota this way and it is verified working.

@Jason2866 Jason2866 removed the Status: Awaiting Response awaiting a response from the author label Apr 14, 2025
@yonagy82
Copy link
Author

yonagy82 commented Apr 14, 2025 via email

@Jason2866
Copy link
Collaborator

Jason2866 commented Apr 14, 2025

This is github issues, not a place to discuss personal coding questions. Anyways here is an example of an esp now driver used in Tasmota https://github.com/arendst/Tasmota/blob/development/tasmota/tasmota_xdrv_driver/xdrv_57_9_tasmesh.ino

@yonagy82
Copy link
Author

yonagy82 commented Apr 16, 2025 via email

@yonagy82
Copy link
Author

Thank you. Do you have examples for Arduino IDE?

Regards
Yona

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants