diff --git a/openrtx/include/rtx/OpMode_M17.hpp b/openrtx/include/rtx/OpMode_M17.hpp index cf82013f..1f827d25 100644 --- a/openrtx/include/rtx/OpMode_M17.hpp +++ b/openrtx/include/rtx/OpMode_M17.hpp @@ -92,7 +92,7 @@ public: */ virtual bool rxSquelchOpen() override { - return false; + return dataValid; } private: @@ -125,6 +125,7 @@ private: bool startRx; ///< Flag for RX management. bool startTx; ///< Flag for TX management. bool locked; ///< Demodulator locked on data stream. + bool dataValid; ///< Demodulated data is valid bool invertTxPhase; ///< TX signal phase inversion setting. bool invertRxPhase; ///< RX signal phase inversion setting. pathId rxAudioPath; ///< Audio path ID for RX diff --git a/openrtx/src/rtx/OpMode_M17.cpp b/openrtx/src/rtx/OpMode_M17.cpp index eb8e9029..90c1aa71 100644 --- a/openrtx/src/rtx/OpMode_M17.cpp +++ b/openrtx/src/rtx/OpMode_M17.cpp @@ -39,7 +39,8 @@ using namespace std; using namespace M17; OpMode_M17::OpMode_M17() : startRx(false), startTx(false), locked(false), - invertTxPhase(false), invertRxPhase(false) + dataValid(false), invertTxPhase(false), + invertRxPhase(false) { } @@ -54,9 +55,10 @@ void OpMode_M17::enable() codec_init(); modulator.init(); demodulator.init(); - locked = false; - startRx = true; - startTx = false; + locked = false; + dataValid = false; + startRx = true; + startTx = false; } void OpMode_M17::disable() @@ -129,7 +131,7 @@ void OpMode_M17::update(rtxStatus_t *const status, const bool newCfg) { case RX: - if(locked) + if(dataValid) platform_ledOn(GREEN); else platform_ledOff(GREEN); @@ -214,6 +216,8 @@ void OpMode_M17::rxState(rtxStatus_t *const status) if(status->lsfOk) { + dataValid = true; + // Retrieve stream source and destination data std::string dst = lsf.getDestination(); std::string src = lsf.getSource(); @@ -261,7 +265,10 @@ void OpMode_M17::rxState(rtxStatus_t *const status) // Force invalidation of LSF data as soon as lock is lost (for whatever cause) if(locked == false) + { status->lsfOk = false; + dataValid = false; + } } void OpMode_M17::txState(rtxStatus_t *const status)