Skip to content

Commit bdb19fc

Browse files
committed
ISM bands: if filter enable , filter CRC errors
1 parent e60ad13 commit bdb19fc

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

tinyGS/src/Radio/Radio.cpp

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,9 @@ uint8_t Radio::listen()
371371
status.lastPacketInfo.snr = newPacketInfo.snr;
372372
status.lastPacketInfo.frequencyerror = newPacketInfo.frequencyerror;
373373

374+
// print RSSI (Received Signal Strength Indicator)
375+
Log::console(PSTR("[SX12x8] RSSI:\t\t%f dBm\n[SX12x8] SNR:\t\t%f dB\n[SX12x8] Frequency error:\t%f Hz"), status.lastPacketInfo.rssi, status.lastPacketInfo.snr, status.lastPacketInfo.frequencyerror);
376+
374377
if (state == ERR_NONE && respLen > 0)
375378
{
376379
// read optional data
@@ -408,7 +411,7 @@ uint8_t Radio::listen()
408411
startRx();
409412
return 5;
410413
}
411-
414+
412415
}
413416

414417
status.lastPacketInfo.crc_error = false;
@@ -417,10 +420,18 @@ uint8_t Radio::listen()
417420
}
418421
else if (state == ERR_CRC_MISMATCH)
419422
{
420-
// packet was received, but is malformed
421-
status.lastPacketInfo.crc_error = true;
422-
String error_encoded = base64::encode("Error_CRC");
423-
MQTT_Client::getInstance().sendRx(error_encoded, noisyInterrupt);
423+
// if filter is active, filter the CRC errors
424+
if (status.modeminfo.filter[0]==0) {
425+
// packet was received, but is malformed
426+
status.lastPacketInfo.crc_error = true;
427+
String error_encoded = base64::encode("Error_CRC");
428+
MQTT_Client::getInstance().sendRx(error_encoded, noisyInterrupt);
429+
} else {
430+
Log::console(PSTR("Filter enabled, Error CRC filtered"));
431+
delete[] respFrame;
432+
startRx();
433+
return 5;
434+
}
424435
}
425436

426437
delete[] respFrame;
@@ -447,8 +458,6 @@ uint8_t Radio::listen()
447458
status.lastPacketInfo.time = thisTime;
448459
}
449460

450-
// print RSSI (Received Signal Strength Indicator)
451-
Log::console(PSTR("[SX12x8] RSSI:\t\t%f dBm\n[SX12x8] SNR:\t\t%f dB\n[SX12x8] Frequency error:\t%f Hz"), status.lastPacketInfo.rssi, status.lastPacketInfo.snr, status.lastPacketInfo.frequencyerror);
452461

453462
noisyInterrupt = false;
454463

tinyGS/src/Status.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ struct TextFrame {
6262
};
6363

6464
struct Status {
65-
const uint32_t version = 2104181; // version year month day release
65+
const uint32_t version = 2104192; // version year month day release
6666
const char* git_version = GIT_VERSION;
6767
bool mqtt_connected = false;
6868
bool radio_ready = false;

0 commit comments

Comments
 (0)