Browse Source

fix: remove getPacketLength override (#2), use LR2021 IRQ constants (#3), make irqDioNum configurable (#4)

pull/2739/head
c03rad0r 1 month ago
parent
commit
627909ad1e
  1. 17
      src/helpers/radiolib/CustomLR2021.h

17
src/helpers/radiolib/CustomLR2021.h

@ -8,16 +8,7 @@ class CustomLR2021 : public LR2021 {
public: public:
CustomLR2021(Module *mod) : LR2021(mod) { CustomLR2021(Module *mod) : LR2021(mod) {
irqDioNum = 9; irqDioNum = LR2021_IRQ_DIO;
}
size_t getPacketLength(bool update) override {
size_t len = LR2021::getPacketLength(update);
if (len == 0 && getIrqStatus() & RADIOLIB_LR11X0_IRQ_HEADER_ERR) {
MESH_DEBUG_PRINTLN("LR2021: got header err, calling standby()");
standby();
}
return len;
} }
float getFreqMHz() const { return freqMHz; } float getFreqMHz() const { return freqMHz; }
@ -33,8 +24,14 @@ class CustomLR2021 : public LR2021 {
bool isReceiving() { bool isReceiving() {
uint32_t irq = getIrqStatus(); uint32_t irq = getIrqStatus();
// Use LR2021-specific IRQ flags if available, fall back to LR11x0
#ifdef RADIOLIB_LR2021_IRQ_PREAMBLE_DETECTED
bool detected = (irq & RADIOLIB_LR2021_IRQ_LORA_HEADER_VALID) ||
(irq & RADIOLIB_LR2021_IRQ_PREAMBLE_DETECTED);
#else
bool detected = (irq & RADIOLIB_LR11X0_IRQ_SYNC_WORD_HEADER_VALID) || bool detected = (irq & RADIOLIB_LR11X0_IRQ_SYNC_WORD_HEADER_VALID) ||
(irq & RADIOLIB_LR11X0_IRQ_PREAMBLE_DETECTED); (irq & RADIOLIB_LR11X0_IRQ_PREAMBLE_DETECTED);
#endif
return detected; return detected;
} }

Loading…
Cancel
Save