Skip to content

Commit 57dec9f

Browse files
committed
Fix interrupt detection in RX and TX operation
1 parent 62e55b4 commit 57dec9f

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

LoRaRF/SX126x.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,7 @@ def endPacket(self, timeout=TX_MODE_SINGLE) :
536536
self._transmitTime = time.time()
537537
if self._irq != -1 :
538538
self._statusInterrupt = self.STATUS_INT_INIT
539+
gpio.remove_event_detect(self._irq)
539540
gpio.add_event_detect(self._irq, gpio.RISING, callback=self._interruptTx, bouncetime=100)
540541
else :
541542
irqStat = self._waitIrq(timeout)
@@ -578,8 +579,8 @@ def request(self, timeout=RX_MODE_SINGLE) :
578579
self._setRx(rxTimeout)
579580
if self._irq != -1 :
580581
self._statusInterrupt = self.STATUS_INT_INIT
581-
try : gpio.add_event_detect(self._irq, gpio.RISING, callback=self._interruptRx, bouncetime=100)
582-
except : pass
582+
gpio.remove_event_detect(self._irq)
583+
gpio.add_event_detect(self._irq, gpio.RISING, callback=self._interruptRx, bouncetime=100)
583584
else :
584585
irqStat = self._waitIrq(timeout)
585586
payloadLengthRx = []; rxStartBufferPointer = []
@@ -607,8 +608,8 @@ def listen(self, rxPeriod, sleepPeriod) :
607608
self._setRxDutyCycle(rxPeriod, sleepPeriod)
608609
if self._irq != -1 :
609610
self._statusInterrupt = self.STATUS_INT_INIT
610-
try : gpio.add_event_detect(self._irq, gpio.RISING, callback=self._interruptRx, bouncetime=100)
611-
except : pass
611+
gpio.remove_event_detect(self._irq)
612+
gpio.add_event_detect(self._irq, gpio.RISING, callback=self._interruptRx, bouncetime=100)
612613
else :
613614
irqStat = self._waitIrq(timeout)
614615
payloadLengthRx = []; rxStartBufferPointer = []

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = LoRaRF
3-
version = 1.1.1
3+
version = 1.2.0
44
author = Chandra Wijaya Sentosa
55
author_email = [email protected]
66
description = Python library used for basic transmitting and receiving data using LoRa modem

0 commit comments

Comments
 (0)