Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/helpers/radiolib/CustomLLCC68Wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ class CustomLLCC68Wrapper : public RadioLibWrapper {

}

bool lastRxHadCRC() override {
bool crc = true;
((CustomLLCC68 *)_radio)->getLoRaRxHeaderInfo(NULL, &crc);
return crc;
}
bool isReceivingPacket() override {
return ((CustomLLCC68 *)_radio)->isReceiving();
}
Expand Down
5 changes: 5 additions & 0 deletions src/helpers/radiolib/CustomLR1110Wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ class CustomLR1110Wrapper : public RadioLibWrapper {
((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();
}
Expand Down
5 changes: 5 additions & 0 deletions src/helpers/radiolib/CustomLR1121Wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ class CustomLR1121Wrapper : public RadioLibWrapper {
}

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();
}
Expand Down
5 changes: 5 additions & 0 deletions src/helpers/radiolib/CustomLR2021Wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ class CustomLR2021Wrapper : public RadioLibWrapper {
return tSym;
}

bool lastRxHadCRC() override {
bool crc = true;
((CustomLR2021 *)_radio)->getLoRaRxHeaderInfo(NULL, &crc);
return crc;
}
bool isReceivingPacket() override {
return ((CustomLR2021 *)_radio)->isReceiving();
}
Expand Down
5 changes: 5 additions & 0 deletions src/helpers/radiolib/CustomSTM32WLxWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ class CustomSTM32WLxWrapper : public RadioLibWrapper {
((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();
}
Expand Down
5 changes: 5 additions & 0 deletions src/helpers/radiolib/CustomSX1262Wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ class CustomSX1262Wrapper : public RadioLibWrapper {
((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();
}
Expand Down
5 changes: 5 additions & 0 deletions src/helpers/radiolib/CustomSX1268Wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ class CustomSX1268Wrapper : public RadioLibWrapper {
((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();
}
Expand Down
3 changes: 3 additions & 0 deletions src/helpers/radiolib/RadioLibWrappers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/helpers/radiolib/RadioLibWrappers.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class RadioLibWrapper : public mesh::Radio {
void startRecv();
float packetScoreInt(float snr, int sf, int packet_len);
virtual bool isReceivingPacket() =0;
virtual bool lastRxHadCRC() { return true; }
virtual void doResetAGC();

public:
Expand Down
Loading