ronoth / LoStik

LoRaWAN compatible USB test device
MIT License
134 stars 40 forks source link

Rewrite radio_sender example to use serial.threaded.LineReader #9

Closed doismellburning closed 5 years ago

doismellburning commented 5 years ago

First, my apologies - I recognise a PR of "I arbitrarily massively rewrote something" is a little obnoxious...

My two LoStiks just arrived, the blink demo works well, and the send/receive demos ran, but with no visible data transfer.

I tried a bunch of stuff, and then decided to rewrite radio_sender in the style of radio_receiver - using LineReader - to make it easier for me to add more debugging prints etc.

Lo and behold, I did that, and suddenly I was sending data just fine, despite (as far as I can tell) sending exactly the same commands with exactly the same timing.

So, I completely understand why you might not want this PR - I haven't yet had time to dig deeper into the exact differences that led to behaviour changes and I suspect I won't - but maybe you will, and if nothing else, this worked for me...

lolsborn commented 5 years ago

This is interesting, my concern here would be that you have hardware with an intermittent issue or something. Have you tried swapping your units so the sender is now the receiver and vice-versa? The most common QA issue is for a unit to mount as a USB device, but not be responsive to commands and not pass the blink.py test. If both units run blink.py fine then the hardware is fine 99.999% of the time.

What version of Python and OS are you using?

doismellburning commented 5 years ago

The only common factor here is that with my sticks and devices, radio_receiver.py receives no data from radio_sender.py on master, but does receive data from my radio_sender.py in this patch

Specifically:

The only change that makes a difference is using my radio_sender.py in this branch...!

Unfortunately I haven't yet determined what those changes are in device terms - the commands I'm sending from Python look to be the same...

(I also just tried with Python 3.7.2 on the Kali box, which made no difference either)

lolsborn commented 5 years ago

Thanks for the PR!