ESP-NOW how "esp_now_del_peer" works?

ORSO2001
Posts: 5
Joined: Fri Jan 03, 2020 2:48 pm

ESP-NOW how "esp_now_del_peer" works?

Postby ORSO2001 » Fri Jan 03, 2020 3:31 pm

Dears All,

In my next project I need to have a communication between a "master" and some "slaves" and I am thinking to use the ESP32-NOW protocol.
one of the steps that I want to implement is a "is still alive" check.
If not I want/need to remove the peer node from the list...but how the deleting works?...I mean...for example...I have peer list of 10 nodes (then from 0 to 9)...the peer[4] is not active...I will invoke the "esp_now_del_peer" ...the nodes after [4] will be shift on the top, then the position [9] will be available or the position [4] will be "blank" and the other will stay at the same position?
Also...when I will add a new node this will take the firtly blank position or will always added after the last busy position?
I hope that my request is clear enough
I am really new in this world...and I have to learn a lot.
thanks

DKarnes
Posts: 1
Joined: Thu Aug 20, 2020 2:33 pm

Re: ESP-NOW how "esp_now_del_peer" works?

Postby DKarnes » Thu Aug 20, 2020 2:41 pm

Unfortunately esp_now_del_peer() does not work. I've run a test where I do the following:
1. esp_now_add_peer()
2. esp_now_send(), and wait for a completed response
3. esp_now_del_peer()
4. esp_now_get_peer_num()... and this still yields 1 total peer even after I've deleted the peer.

Since the esp-now.h prototype and the Espressiv online programming document says the function description says "Delete a peer from peer list," this is a great big fat BUG!!!

OutOfLine
Posts: 52
Joined: Sat Feb 24, 2018 1:32 pm

Re: ESP-NOW how "esp_now_del_peer" works?

Postby OutOfLine » Thu Sep 10, 2020 10:30 am

I am working on a group of musical ESP32 instruments synchronized by esp-now. I do need a function to remove individual instruments from the list of known peers and did some tests.

As I remembered this post I thought I'll report back here, what I found:
If I have a list of known peers and do esp_now_del_peer() on one of them. Now I send something to all known peers (by passing NULL as pointer to the mac) the system works as expected: The removed peer does *not* receive the message, the others do.
So for what I need now, esp_now_del_peer() *does* work fine.

I did not care about the list position of the peers.

btw: I tested another thing:
If I have broadcast and a couple of peers in the list and send to all known peers as above, the message is *not* broadcasted, only sent to individual peers. This is fine, I was afraid I would have to remove broadcast from the list first.

Who is online

Users browsing this forum: No registered users and 68 guests