Getting Giggy With ESPNow? Peer Discovery? #16364
Replies: 2 comments
-
The ESP32 could send a broadcast to |
Beta Was this translation helpful? Give feedback.
-
@sosi-deadeye, thanks. At some point I may need to decide how to 'window' the discovery of the peers, or use the defined list for explicit sends. The all or nothing success for ESPNow send... is fine for global communication to all peers, but I suspect I will need to send explicit commands to explicit peers in due course. Another test case, using sync... if I broadcast to all, does send still function as all or nothing result. If 4 or 5 return ACK, send documentation states, using sync, it is still a fail, again the defined peers list? Using generic broadcast method would I think invalidate the sync feature of send, or maybe not? If you use broadcast, have not defined a peer list, via explicit peer adds, sync has nothing to work with... or so I am thinking. And, I just found a reference that said the broadcast of FF:FF:FF:FF:FF:FF should work as well... should be easy to validate. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Getting Giggy With ESPNow? Peer Discovery?
So, looking at the ESPNow support (in MP) I don't see a straight forward way to scan for peers? Comparable to the scan method say in the network module. Best I can come up with is the follow (pseudo code):
Create a list of peers
for loop the peers list
add a peer
attempt to send to it
if send true, add peer to discovered list of peers (this is internal to ESPNow module/object, i.e. get_peers for example
if send false remove peer, and continue loop
The result would be discovered list of peers.
This has two disadvantages, 1) you are adding and removing undiscovered peers, 2) you have to define a static list of peers as source list for the scan. Where as the network scan method discovers all (available) networks, and no static list of networks required.
Could I avoid the static list, yes, in that I could generate the MAC address of every possible peer (for a given range?) but that would be an extensive/exhaustive add/remove peer loop.
Possible use case, at some point in the future I was think of creating a flock or herd robotic model, where as I turn on each robot, want the others to discover it.
Beta Was this translation helpful? Give feedback.
All reactions