Merge pull request #3739 from A13xB0/fix/rx-header-no-crc

Drop received packets whose LoRa header says no CRC in RadioLib override
This commit is contained in:
ripplebiz authored and GitHub committed 2026-10-31 12:29:10 +11:00
commit e8202db662
9 files changed
+39

No files matched your search

@@ -20,6 +20,11 @@ public:
}
bool lastRxHadCRC() override {
bool crc = true;
((CustomLLCC68 *)_radio)->getLoRaRxHeaderInfo(NULL, &crc);
return crc;
}
bool isReceivingPacket() override {
return ((CustomLLCC68 *)_radio)->isReceiving();
}
@@ -19,6 +19,11 @@ public:
((CustomLR1110 *)_radio)->setMaxPayloadMillis(pm.payloadMillis);
}
bool lastRxHadCRC() override {
bool crc = true;
((CustomLR1110 *)_radio)->getLoRaRxHeaderInfo(NULL, &crc);
return crc;
}
bool isReceivingPacket() override {
return ((CustomLR1110 *)_radio)->isReceiving();
}
@@ -20,6 +20,11 @@ public:
}
void doResetAGC() override { lr11x0ResetAGC((LR11x0 *)_radio, ((CustomLR1121 *)_radio)->getFreqMHz(), getRxBoostedGainMode()); }
bool lastRxHadCRC() override {
bool crc = true;
((CustomLR1121 *)_radio)->getLoRaRxHeaderInfo(NULL, &crc);
return crc;
}
bool isReceivingPacket() override {
return ((CustomLR1121 *)_radio)->isReceiving();
}
@@ -81,6 +81,11 @@ public:
return tSym;
}
bool lastRxHadCRC() override {
bool crc = true;
((CustomLR2021 *)_radio)->getLoRaRxHeaderInfo(NULL, &crc);
return crc;
}
bool isReceivingPacket() override {
return ((CustomLR2021 *)_radio)->isReceiving();
}
@@ -20,6 +20,11 @@ public:
((CustomSTM32WLx *)_radio)->setMaxPayloadMillis(pm.payloadMillis);
}
bool lastRxHadCRC() override {
bool crc = true;
((CustomSTM32WLx *)_radio)->getLoRaRxHeaderInfo(NULL, &crc);
return crc;
}
bool isReceivingPacket() override {
return ((CustomSTM32WLx *)_radio)->isReceiving();
}
@@ -23,6 +23,11 @@ public:
((CustomSX1262 *)_radio)->setMaxPayloadMillis(pm.payloadMillis);
}
bool lastRxHadCRC() override {
bool crc = true;
((CustomSX1262 *)_radio)->getLoRaRxHeaderInfo(NULL, &crc);
return crc;
}
bool isReceivingPacket() override {
return ((CustomSX1262 *)_radio)->isReceiving();
}
@@ -23,6 +23,11 @@ public:
((CustomSX1268 *)_radio)->setMaxPayloadMillis(pm.payloadMillis);
}
bool lastRxHadCRC() override {
bool crc = true;
((CustomSX1268 *)_radio)->getLoRaRxHeaderInfo(NULL, &crc);
return crc;
}
bool isReceivingPacket() override {
return ((CustomSX1268 *)_radio)->isReceiving();
}
@@ -132,6 +132,9 @@ int RadioLibWrapper::recvRaw(uint8_t* bytes, int sz) {
if (len > 0) {
if (len > sz) { len = sz; }
int err = _radio->readData(bytes, len);
if (err == RADIOLIB_ERR_NONE && !lastRxHadCRC()) {
err = RADIOLIB_ERR_LORA_HEADER_DAMAGED; // header says no CRC, so the payload was never checked
}
if (err != RADIOLIB_ERR_NONE) {
MESH_DEBUG_PRINTLN("RadioLibWrapper: error: readData(%d)", err);
len = 0;
+1
View File
@@ -26,6 +26,7 @@ protected:
void startRecv();
float packetScoreInt(float snr, int sf, int packet_len);
virtual bool isReceivingPacket() =0;
virtual bool lastRxHadCRC() { return true; }
virtual void doResetAGC();
public: