Use hardware channel activity detection for checking interference
This commit is contained in:
committed by
Wessel Nieboer
parent
fb726e48c2
commit
952d12c8b9
@@ -168,10 +168,17 @@ void RadioLibWrapper::onSendFinished() {
|
||||
state = STATE_IDLE;
|
||||
}
|
||||
|
||||
int16_t RadioLibWrapper::performChannelScan() {
|
||||
return _radio->scanChannel();
|
||||
}
|
||||
|
||||
bool RadioLibWrapper::isChannelActive() {
|
||||
return _threshold == 0
|
||||
? false // interference check is disabled
|
||||
: getCurrentRSSI() > _noise_floor + _threshold;
|
||||
if (_threshold == 0) return false; // interference check is disabled
|
||||
|
||||
int16_t result = performChannelScan();
|
||||
// scanChannel() leaves radio in standby — restart RX regardless of result
|
||||
startRecv();
|
||||
return (result == RADIOLIB_LORA_DETECTED);
|
||||
}
|
||||
|
||||
float RadioLibWrapper::getLastRSSI() const {
|
||||
|
||||
@@ -31,13 +31,14 @@ public:
|
||||
bool isInRecvMode() const override;
|
||||
bool isChannelActive();
|
||||
|
||||
bool isReceiving() override {
|
||||
bool isReceiving() override {
|
||||
if (isReceivingPacket()) return true;
|
||||
|
||||
return isChannelActive();
|
||||
}
|
||||
|
||||
virtual float getCurrentRSSI() =0;
|
||||
virtual int16_t performChannelScan();
|
||||
|
||||
int getNoiseFloor() const override { return _noise_floor; }
|
||||
void triggerNoiseFloorCalibrate(int threshold) override;
|
||||
|
||||
Reference in New Issue
Block a user