Implemented rxSquelchOpen() function for M17 opmode handler, returning true in case of valid stream data.

This commit is contained in:
Silvano Seva 2023-09-12 17:42:02 +02:00
parent 0adab74255
commit 8fe9837035
2 changed files with 14 additions and 6 deletions

View File

@ -92,7 +92,7 @@ public:
*/ */
virtual bool rxSquelchOpen() override virtual bool rxSquelchOpen() override
{ {
return false; return dataValid;
} }
private: private:
@ -125,6 +125,7 @@ private:
bool startRx; ///< Flag for RX management. bool startRx; ///< Flag for RX management.
bool startTx; ///< Flag for TX management. bool startTx; ///< Flag for TX management.
bool locked; ///< Demodulator locked on data stream. bool locked; ///< Demodulator locked on data stream.
bool dataValid; ///< Demodulated data is valid
bool invertTxPhase; ///< TX signal phase inversion setting. bool invertTxPhase; ///< TX signal phase inversion setting.
bool invertRxPhase; ///< RX signal phase inversion setting. bool invertRxPhase; ///< RX signal phase inversion setting.
pathId rxAudioPath; ///< Audio path ID for RX pathId rxAudioPath; ///< Audio path ID for RX

View File

@ -39,7 +39,8 @@ using namespace std;
using namespace M17; using namespace M17;
OpMode_M17::OpMode_M17() : startRx(false), startTx(false), locked(false), 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(); codec_init();
modulator.init(); modulator.init();
demodulator.init(); demodulator.init();
locked = false; locked = false;
startRx = true; dataValid = false;
startTx = false; startRx = true;
startTx = false;
} }
void OpMode_M17::disable() void OpMode_M17::disable()
@ -129,7 +131,7 @@ void OpMode_M17::update(rtxStatus_t *const status, const bool newCfg)
{ {
case RX: case RX:
if(locked) if(dataValid)
platform_ledOn(GREEN); platform_ledOn(GREEN);
else else
platform_ledOff(GREEN); platform_ledOff(GREEN);
@ -214,6 +216,8 @@ void OpMode_M17::rxState(rtxStatus_t *const status)
if(status->lsfOk) if(status->lsfOk)
{ {
dataValid = true;
// Retrieve stream source and destination data // Retrieve stream source and destination data
std::string dst = lsf.getDestination(); std::string dst = lsf.getDestination();
std::string src = lsf.getSource(); 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) // Force invalidation of LSF data as soon as lock is lost (for whatever cause)
if(locked == false) if(locked == false)
{
status->lsfOk = false; status->lsfOk = false;
dataValid = false;
}
} }
void OpMode_M17::txState(rtxStatus_t *const status) void OpMode_M17::txState(rtxStatus_t *const status)