Files
MeshCore-Solo/src/helpers/radiolib/CustomLR1110.h
T

28 lines
930 B
C++
Raw Normal View History

2025-02-14 09:54:06 +01:00
#pragma once
#include <RadioLib.h>
#include "MeshCore.h"
2025-02-14 09:54:06 +01:00
class CustomLR1110 : public LR1110 {
public:
CustomLR1110(Module *mod) : LR1110(mod) { }
2025-10-12 16:09:57 +01:00
size_t getPacketLength(bool update) override {
size_t len = LR1110::getPacketLength(update);
2025-10-24 20:12:02 +01:00
if (len == 0 && getIrqStatus() & RADIOLIB_LR11X0_IRQ_HEADER_ERR) {
2026-01-03 18:54:48 -07:00
// we've just received a corrupted packet
2025-10-24 20:12:02 +01:00
// this may have triggered a bug causing subsequent packets to be shifted
// call standby() to return radio to known-good state
// recvRaw will call startReceive() to restart rx
MESH_DEBUG_PRINTLN("LR1110: got header err, calling standby()");
standby();
2025-10-12 16:09:57 +01:00
}
return len;
}
2025-10-25 22:12:30 +01:00
2025-02-14 09:54:06 +01:00
bool isReceiving() {
uint16_t irq = getIrqStatus();
2025-10-25 22:12:30 +01:00
bool detected = ((irq & RADIOLIB_LR11X0_IRQ_SYNC_WORD_HEADER_VALID) || (irq & RADIOLIB_LR11X0_IRQ_PREAMBLE_DETECTED));
return detected;
2025-02-14 09:54:06 +01:00
}
};