guild icon
Toit
#ESPNow send and receive with dedicated addresses
Thread channel in help
theHuanter
theHuanter 02/14/2024 08:40 AM
I try to run the espnow implementation with toit which works fine as broadcasting but when I try to set the address where the data should be send to I revceive an unknown error:

jag decode WyNVBVVYU1UQdjIuMC4wLWFscGhhLjEzNFNVAFskVSNVEBeZ9UO/CVDXk6Icr6uwT6ZbI1UEVUVTVQlFWENFUFRJT05TVRtVTktOT1dOIEVSUk9SIDB4MzA2OSgxMjM5MylbI1UCVVNbI1URWyNsAAAAA1VGVQBJA3lbI2wAAAADVUZVAUl6tFsjbAAAAANVRlUCSVTPWyNsAAAAA1VGVQNJTvNbI2wAAAADVUZVBElPUVsjbAAAAANVRlUFSVTkWyNsAAAAA1VGVQZJeu9bI2wAAAADVUZVB0kDIFsjbAAAAANVRlUISQJZWyNsAAAAA1VGVQlJCihbI2wAAAADVUZVCkkLgFsjbAAAAANVRlULSQuXWyNsAAAAA1VGVQxJOyVbI2wAAAADVUZVDUk7PVsjbAAAAANVRlUOSTphWyNsAAAAA1VGVQ9JOulbI2wAAAADVUZVEEkKPA== EXCEPTION error. UNKNOWN ERROR 0x3069(12393) 0: espnow-send_ <sdk>\esp32\espnow.toit:191:3 1: Service.send.<block> <sdk>\esp32\espnow.toit:145:7 2: Mutex.do.<monitor-block> <sdk>\monitor.toit:28:27 3: __Monitor__.locked_.<block> <sdk>\core\monitor_impl_.toit:123:12 4: __Monitor__.locked_ <sdk>\core\monitor_impl_.toit:95:3 5: Mutex.do <sdk>\monitor.toit:28:3 6: Service.send <sdk>\esp32\espnow.toit:143:17 7: send-task src\toit\espnow\bouy-espnow.toit:33:13 8: main.<lambda> src\toit\espnow\bouy-espnow.toit:19:10

all I changed was setting the address to the service send to be the address of the receiver side.

service.send buffer --address=Address #[0x8C, 0x4B, 0x14, 0x16, 0x64, 0x60]

I also changed the address on the receiver side to be the one from the sender:

service := espnow.Service.station --key=null service.add-peer (Address #[0x8C, 0x4B, 0x14, 0x16, 0x6A, 0x6C]) --channel=1
theHuanter
theHuanter 02/14/2024 08:49 AM
ESP_ERR_ESPNOW_NOT_FOUND (0x3069): ESPNOW peer is not found

I am pretty sure I am doing something wrong but what is it? If I am only sending I do not need to add a peer, right?
theHuanter
theHuanter 02/14/2024 08:52 AM
so I DO have to set the peer even tho I am adding the address already when sending. Not sure if I get this right. As far as I understand there is 2 different modes for espnow: broadcasting - where it will just send data and anyone listening will receive it
and peer-mode where I explicitly send data to a device with a defined address I am adding.

The last mode also works in both directions and I assume setting a peer will make it bidirectional, which is not really needed here... but I guess it also does not hurt
floitsch
floitsch 02/14/2024 01:04 PM
I think you need to add the peer before you do anything with it. (sending or receiving).
floitsch
floitsch 02/14/2024 01:05 PM
But not 100% certain. Long time since I played with espnow.
theHuanter
theHuanter 02/15/2024 01:57 PM
@floitsch did you ever tested the range possible with ESPNow using toit or know any reference for it?
The code says that 1Mbps is default - that should be the lowest setting, right? and therefor the one with max range?
(edited)
theHuanter
theHuanter 02/15/2024 03:56 PM
I try to test it but jaguar lost connection and complained, that way I was not able to run in properly. Can I disable jaguar for that?
theHuanterOPtheHuanter
@floitsch did you ever tested the range possible with ESPNow using toit or know any reference for it? The code says that 1Mbps is default - that should be the lowest se...(edited)
floitsch
floitsch 02/15/2024 04:01 PM
I never tested the range.
I don't think the default is the max range.
theHuanter
theHuanter 02/15/2024 04:02 PM
any other option seems to be higher in value like 2Mbps or 16Mbps
theHuanterOPtheHuanter
any other option seems to be higher in value like 2Mbps or 16Mbps
floitsch
floitsch 02/15/2024 04:02 PM
Ok. Maybe we picked the lowest then
theHuanterOPtheHuanter
I try to test it but jaguar lost connection and complained, that way I was not able to run in properly. Can I disable jaguar for that?
bitphlipphar
bitphlipphar 02/15/2024 04:31 PM
Use live reloading over WiFI to turbo-charge developing for your ESP32. - toitlang/jaguar
11 messages in total