From 17cdf3c67b5c4f1bb40600ff9f074e3b40ae7946 Mon Sep 17 00:00:00 2001 From: mark Date: Sun, 17 Oct 2021 17:22:26 -0700 Subject: [PATCH] https://github.com/OpenRTX/OpenRTX/issues/43 Force Squelch re-detection when coming out of TX. --- openrtx/src/rtx/OpMode_FM.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/openrtx/src/rtx/OpMode_FM.cpp b/openrtx/src/rtx/OpMode_FM.cpp index 31d798c0..5767bbb0 100644 --- a/openrtx/src/rtx/OpMode_FM.cpp +++ b/openrtx/src/rtx/OpMode_FM.cpp @@ -101,8 +101,12 @@ void OpMode_FM::update(rtxStatus_t *const status, const bool newCfg) if(status->opStatus == RX) { // RF squelch mechanism + // This turns squelch (0 to 15) into RSSI (-127.0dbm to -61dbm) float squelch = -127.0f + status->sqlLevel * 66.0f / 15.0f; float rssi = rtx_getRssi(); + + // Provide a bit of hysteresis, only change state if the RSSI has + // moved more than .1dbm on either side of the current squelch setting. if((rfSqlOpen == false) && (rssi > (squelch + 0.1f))) rfSqlOpen = true; if((rfSqlOpen == true) && (rssi < (squelch - 0.1f))) rfSqlOpen = false; @@ -158,6 +162,7 @@ void OpMode_FM::update(rtxStatus_t *const status, const bool newCfg) status->opStatus = OFF; enterRx = true; + sqlOpen = false; // Force squelch to be redetected. } // Led control logic