From 98ef65b5a2e9c35eabfd80a466327a9fdbb8e38e Mon Sep 17 00:00:00 2001 From: beegee-tokyo Date: Sat, 24 Feb 2024 20:27:45 +0800 Subject: [PATCH] Fix callbacks for P2P RX and TX timeout not being called --- CHANGELOG.md | 3 +++ README.md | 2 ++ library.json | 2 +- library.properties | 2 +- src/radio/sx126x/radio.cpp | 16 ++++++++++++---- 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 44952c1..c9d087e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ Arduino library for LoRa communication with Semtech SX126x chips. It is based on # Release Notes +## V2.0.24 Fix P2P RX timeout callback fails + - Fix callbacks for P2P RX and TX timeout not being called + ## V2.0.23 Add support for the Arduino Pico BSP - Added support for the RAK11300 in [arduino-pico](https://github.com/earlephilhower/arduino-pico) BSP _**still experimental**_ diff --git a/README.md b/README.md index cdfb599..d5ea6f3 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---- ## Changelog [Code releases](CHANGELOG.md) +- 2024-02-24 + - Fix callbacks for P2P RX and TX timeout not being called - 2023-12-14 - Seems RAK11300 and arduino-pico BSP is working now. _**still experimental**_ - 2023-12-12 diff --git a/library.json b/library.json index 31e2f5b..72b6e17 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "SX126x-Arduino", - "version": "2.0.23", + "version": "2.0.24", "keywords": [ "lora", "Semtech", diff --git a/library.properties b/library.properties index 1053ee9..a20718d 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=SX126x-Arduino -version=2.0.23 +version=2.0.24 author=Bernd Giesecke maintainer=Bernd Giesecke sentence=Arduino library to use Semtech SX126x LoRa chips and modules to communicate diff --git a/src/radio/sx126x/radio.cpp b/src/radio/sx126x/radio.cpp index b611002..0dea0f5 100644 --- a/src/radio/sx126x/radio.cpp +++ b/src/radio/sx126x/radio.cpp @@ -1040,8 +1040,8 @@ void RadioStandby(void) void RadioRx(uint32_t timeout) { SX126xRXena(); - SX126xSetDioIrqParams(IRQ_RADIO_ALL, // IRQ_RX_DONE | IRQ_RX_TX_TIMEOUT, - IRQ_RADIO_ALL, // IRQ_RX_DONE | IRQ_RX_TX_TIMEOUT, + SX126xSetDioIrqParams(IRQ_RX_DONE | IRQ_RX_TX_TIMEOUT | IRQ_HEADER_ERROR | IRQ_CRC_ERROR, // IRQ_RADIO_ALL + IRQ_RX_DONE | IRQ_RX_TX_TIMEOUT | IRQ_HEADER_ERROR | IRQ_CRC_ERROR, // IRQ_RADIO_ALL IRQ_RADIO_NONE, IRQ_RADIO_NONE); @@ -1064,8 +1064,8 @@ void RadioRx(uint32_t timeout) void RadioRxBoosted(uint32_t timeout) { - SX126xSetDioIrqParams(IRQ_RADIO_ALL, // IRQ_RX_DONE | IRQ_RX_TX_TIMEOUT, - IRQ_RADIO_ALL, // IRQ_RX_DONE | IRQ_RX_TX_TIMEOUT, + SX126xSetDioIrqParams(IRQ_RX_DONE | IRQ_RX_TX_TIMEOUT | IRQ_HEADER_ERROR | IRQ_CRC_ERROR, // IRQ_RADIO_ALL + IRQ_RX_DONE | IRQ_RX_TX_TIMEOUT | IRQ_HEADER_ERROR | IRQ_CRC_ERROR, // IRQ_RADIO_ALL IRQ_RADIO_NONE, IRQ_RADIO_NONE); @@ -1234,6 +1234,10 @@ void RadioOnTxTimeoutIrq(void) TimerTxTimeout = true; BoardEnableIrq(); TimerStop(&TxTimeoutTimer); + + RadioBgIrqProcess(); + RadioStandby(); + RadioSleep(); } void RadioOnRxTimeoutIrq(void) @@ -1246,6 +1250,10 @@ void RadioOnRxTimeoutIrq(void) TimerRxTimeout = true; BoardEnableIrq(); TimerStop(&RxTimeoutTimer); + + RadioBgIrqProcess(); + RadioStandby(); + RadioSleep(); } #if defined NRF52_SERIES || defined ESP32 || defined ARDUINO_RAKWIRELESS_RAK11300