LoRaRF-Python icon indicating copy to clipboard operation
LoRaRF-Python copied to clipboard

Repeat calls to methods using IRQ causes lockup

Open CraigBurden opened this issue 5 months ago • 0 comments

Repeated calls to the .request(LoRa.RX_CONTINUOUS) method causes main thread to lockup. This is because of the use of the following on ln551 in SX127x.py:

if isinstance(self._monitoring, Thread):
                self._monitoring.join()

The monitoring thread has no way to exit and by default .join() is a blocking call. The timeout passed to the monitor_continuous method is ~1000s, so the main thread will block until this timeout is reached. To fix this you need to provide a way for the monitor_continuous method to exit when requested to do so. This should be done either with a ThreadEvent that is used to break out of the while loop or simply a class attribute to do the same.

I have not yet tested this, but I assume that this issue will occur anytime that .request() or .endPacket() is called anything other than the first time as the same lines exist on ln474.

CraigBurden avatar Sep 18 '24 09:09 CraigBurden