Skip to content
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

ESP-Now priv from esp_now_peer_info_t is not set (IDFGH-12706) #13693

Open
3 tasks done
Schuemi opened this issue Apr 25, 2024 · 1 comment
Open
3 tasks done

ESP-Now priv from esp_now_peer_info_t is not set (IDFGH-12706) #13693

Schuemi opened this issue Apr 25, 2024 · 1 comment
Assignees
Labels
Status: Opened Issue is new Type: Bug bugs in IDF

Comments

@Schuemi
Copy link

Schuemi commented Apr 25, 2024

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

v5.2.1 and v5.1.2

Espressif SoC revision.

tried with ESP32C3

Operating System used.

Linux

How did you build your project?

VS Code IDE

If you are using Windows, please specify command line type.

None

Development Kit.

Seeed Human Detector Sensor Kit

Power Supply used.

USB

What is the expected behavior?

If I call esp_now_add_peer with an esp_now_peer_info_t in which the priv pointer is set, esp_now_get_peer and esp_now_fetch_peer should display this pointer in the result of esp_now_peer_info_t. However, the pointer is not set.

What is the actual behavior?

Set the priv pointer to the value it was set with esp_now_add_peer.

Steps to reproduce.

`
static uint8_t s_example_mac[ESP_NOW_ETH_ALEN] = { 0x01, 0x02, 0x04, 0x05, 0x06, 0x07 };
esp_now_peer_info_t peer;
esp_now_peer_info_t peerTest;
uint32_t* someUserData = (uint32_t*)malloc(sizeof(uint32_t));
memset(&peer, 0, sizeof(esp_now_peer_info_t));
memset(&peerTest, 0, sizeof(esp_now_peer_info_t));

peer.channel = 5;
peer.ifidx = WIFI_IF_STA;
peer.encrypt = false;
peer.priv = someUserData;
memcpy(&peer.peer_addr, s_example_mac, ESP_NOW_ETH_ALEN);

printf("some user data Pointer: %p\n", peer.priv);
if (esp_now_add_peer(&peer) != ESP_OK) printf("Failed adding peer");
if (esp_now_get_peer(s_example_mac, &peerTest)!= ESP_OK) printf("Failed getting peer");

printf("got user data Pointer: %p\n", peerTest.priv);
`

Output:
some user data Pointer: 0x3fcae554
got user data Pointer: 0x0

Debug Logs.

No response

More Information.

tried with 5.1.2 and 5.2.1

@Schuemi Schuemi added the Type: Bug bugs in IDF label Apr 25, 2024
@espressif-bot espressif-bot added the Status: Opened Issue is new label Apr 25, 2024
@github-actions github-actions bot changed the title ESP-Now priv from esp_now_peer_info_t is not set ESP-Now priv from esp_now_peer_info_t is not set (IDFGH-12706) Apr 25, 2024
@zhangyanjiaoesp
Copy link
Collaborator

@Schuemi thanks for your report, will fix it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Opened Issue is new Type: Bug bugs in IDF
Projects
None yet
Development

No branches or pull requests

3 participants