thomasfla / Linux-ESPNOW

An attempt at implementing a direct link between a linux station and an ESP module using ESPNOW protocol for real time robot control
BSD 2-Clause "Simplified" License
178 stars 28 forks source link

wifiRawReceiver receives 32 messages instead of 1 #2

Closed jildertviet closed 3 years ago

jildertviet commented 3 years ago

@thomasfla Hi, thanks for your work on this! I'm sort of successfully running this on a Raspberry Pi (4B), so I'll also write something about that.

After not getting Nexmon to work with Raspberry Pi OS (2020-12-02-raspios-buster-armhf / kernel 5.4.79 if I'm not mistaken) I tried Kali Linux. This was very straightforward, so setting the wireless card to monitor mode (called mon0) was easy. Edit: now I realize I had a Ralink 5370 plugged in, which was set to monitor mode, so not sure yet if the builtin card works

Afterwards I cloned this repo and tried ESPNOW_lib (as suggested in #1) , which compiles, but doesn't post anything when I run it with: sudo ./exec mon0 Without sudo I get an error btw: _exec: src/ESPNOW_manager.cpp:131: void ESPNOWmanager::start(): Assertion `fd != -1' failed. However, wifiRawReceiver works! On an ESP32 I run ESP32-Test.ino, which transmits to broadcast-address or specific address.

Then the reason of this issue: When I send once with the ESP32, wifiRawReceiver posts 32 times:

----------------------------new packet-----------------------------------

0x00, 0x00, 0x12, 0x00, 0x2e, 0x48, 0x00, 0x00, 0x00, 0x30, 0x6c, 0x09, 0xc0, 0x00, 0xed, 0x01, 
0x00, 0x00, 0xd0, 0x08, 0x3c, 0x00, 0xce, 0xe5, 0x4f, 0xbb, 0x12, 0x4b, 0x30, 0xae, 0xa4, 0x84, 
0x1c, 0xbc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x7f, 0x18, 0xfe, 0x34, 0x9c, 0xaf, 
0x88, 0x1e, 0xdd, 0x84, 0x18, 0xfe, 0x34, 0x04, 0x01, 0xa2, 0x06, 0x0a, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 
0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 
0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 
0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 
0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 
0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 
0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 
0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 

len:184

Posting it once would make more sense, right?

jildertviet commented 3 years ago

After realizing I had a Ralink 5370 wireless card plugged in I removed it and tried the builtin card. This receives (or posts) once per send message.