Raw Lora Nano-Gateway Timing
maybe some of you have been struggling with a LoPy to LoPy connection using Raw Lora just like I did. So I thought I should post what helped me.
Using the updated LoPy Nano-Gateway code posted by @Roberto a while ago, the gateway-LoPy did not seem to receive any messages, altough a separate scanner confirmed that the node was transmitting.
Then I noticed that when you interrupt the gateway-program using Ctrl-C and then just start the program again by clicking "run" in Pymakr, immediately up to 2 messages were processed. It seems that these messages had somehow been stored without being processed during the previous run of the program. In fact, this was repeatable. No message processing during normal gateway operation, immediate processing after restarting the program following a keyboard interrupt.
What solved this problem was simply adding 0.2 secs of sleep in case the loop ended with a message shorter than the 3 bytes required to make it valid. So, "else: time.sleep(0.2)" at the end of the gateway program did the trick.
I have no idea why that works, but I am quite happy that it does and I hope that it might save someone to go through all of the testing that I did.
Both LoPys were running the latest firmware:
(sysname='LoPy4', nodename='LoPy4', release='1.20.2.r1', version='v1.11-a5aa0b8 on 2020-09-09', machine='LoPy4 with ESP32', lorawan='1.0.2', sigfox='1.0.1', pybytes='1.6.0')