diff --git a/plugins/channelrx/demodfreedv/freedvdemod.cpp b/plugins/channelrx/demodfreedv/freedvdemod.cpp index 97cd0bca7..d3a84a9f3 100644 --- a/plugins/channelrx/demodfreedv/freedvdemod.cpp +++ b/plugins/channelrx/demodfreedv/freedvdemod.cpp @@ -40,6 +40,7 @@ #include "freedvdemod.h" MESSAGE_CLASS_DEFINITION(FreeDVDemod::MsgConfigureFreeDVDemod, Message) +MESSAGE_CLASS_DEFINITION(FreeDVDemod::MsgResyncFreeDVDemod, Message) MESSAGE_CLASS_DEFINITION(FreeDVDemod::MsgConfigureFreeDVDemodPrivate, Message) MESSAGE_CLASS_DEFINITION(FreeDVDemod::MsgConfigureChannelizer, Message) @@ -84,13 +85,13 @@ void FreeDVDemod::FreeDVStats::collect(struct freedv *freeDV) m_ber = m_ber < 0 ? 0 : m_ber; m_berFrameCount = 0; m_lastTotalBitErrors = m_totalBitErrors; + qDebug("FreeDVStats::collect: demod sync: %d sync metric: %f demod snr: %3.2f dB BER: %d clock offset: %f freq offset: %f", + m_sync, m_syncMetric, m_snrEst, m_ber, m_clockOffset, m_freqOffset); } m_berFrameCount++; m_frameCount++; - qDebug("FreeDVStats::collect: demod sync: %d sync metric: %f demod snr: %3.2f dB BER: %d clock offset: %f freq offset: %f", - m_sync, m_syncMetric, m_snrEst, m_ber, m_clockOffset, m_freqOffset); } @@ -327,6 +328,14 @@ bool FreeDVDemod::handleMessage(const Message& cmd) return true; } + else if (MsgResyncFreeDVDemod::match(cmd)) + { + qDebug("FreeDVDemod::handleMessage: MsgResyncFreeDVDemod"); + m_settingsMutex.lock(); + freedv_set_sync(m_freeDV, unsync); + m_settingsMutex.unlock(); + return true; + } else if (BasebandSampleSink::MsgThreadedSink::match(cmd)) { BasebandSampleSink::MsgThreadedSink& cfg = (BasebandSampleSink::MsgThreadedSink&) cmd; diff --git a/plugins/channelrx/demodfreedv/freedvdemod.h b/plugins/channelrx/demodfreedv/freedvdemod.h index ae2f7049d..f2ad1a5d0 100644 --- a/plugins/channelrx/demodfreedv/freedvdemod.h +++ b/plugins/channelrx/demodfreedv/freedvdemod.h @@ -71,6 +71,19 @@ public: { } }; + class MsgResyncFreeDVDemod : public Message { + MESSAGE_CLASS_DECLARATION + + public: + static MsgResyncFreeDVDemod* create() { + return new MsgResyncFreeDVDemod(); + } + + private: + MsgResyncFreeDVDemod() + {} + }; + class MsgConfigureChannelizer : public Message { MESSAGE_CLASS_DECLARATION diff --git a/plugins/channelrx/demodfreedv/freedvdemodgui.cpp b/plugins/channelrx/demodfreedv/freedvdemodgui.cpp index 232180e3e..b8c6b2ee9 100644 --- a/plugins/channelrx/demodfreedv/freedvdemodgui.cpp +++ b/plugins/channelrx/demodfreedv/freedvdemodgui.cpp @@ -151,6 +151,12 @@ void FreeDVDemodGUI::on_deltaFrequency_changed(qint64 value) applySettings(); } +void FreeDVDemodGUI::on_reSync_clicked(bool checked) +{ + FreeDVDemod::MsgResyncFreeDVDemod* message = FreeDVDemod::MsgResyncFreeDVDemod::create(); + m_freeDVDemod->getInputMessageQueue()->push(message); +} + void FreeDVDemodGUI::on_freeDVMode_currentIndexChanged(int index) { m_settings.m_freeDVMode = (FreeDVDemodSettings::FreeDVMode) index; diff --git a/plugins/channelrx/demodfreedv/freedvdemodgui.h b/plugins/channelrx/demodfreedv/freedvdemodgui.h index cc26e49ca..51a031ecd 100644 --- a/plugins/channelrx/demodfreedv/freedvdemodgui.h +++ b/plugins/channelrx/demodfreedv/freedvdemodgui.h @@ -96,6 +96,7 @@ private: private slots: void on_deltaFrequency_changed(qint64 value); + void on_reSync_clicked(bool checked); void on_freeDVMode_currentIndexChanged(int index); void on_volume_valueChanged(int value); void on_agc_toggled(bool checked); diff --git a/plugins/channelrx/demodfreedv/freedvdemodgui.ui b/plugins/channelrx/demodfreedv/freedvdemodgui.ui index 6d97823de..561860fcb 100644 --- a/plugins/channelrx/demodfreedv/freedvdemodgui.ui +++ b/plugins/channelrx/demodfreedv/freedvdemodgui.ui @@ -172,6 +172,28 @@ 6 + + + + + 22 + 0 + + + + + 22 + 16777215 + + + + Force re-synchronization + + + S + + +