diff --git a/plugins/channelrx/udpsrc/udpsrc.cpp b/plugins/channelrx/udpsrc/udpsrc.cpp
index 0fafbb0b3..16fad9a05 100644
--- a/plugins/channelrx/udpsrc/udpsrc.cpp
+++ b/plugins/channelrx/udpsrc/udpsrc.cpp
@@ -411,6 +411,7 @@ void UDPSrc::apply(bool force)
if ((m_config.m_squelchGate != m_running.m_squelchGate) || force)
{
m_squelchThreshold = m_config.m_outputSampleRate * m_config.m_squelchGate;
+ initSquelch(m_squelchOpen);
}
if ((m_config.m_udpAddressStr != m_running.m_udpAddressStr) || force)
diff --git a/plugins/channelrx/udpsrc/udpsrcgui.cpp b/plugins/channelrx/udpsrc/udpsrcgui.cpp
index caf1f7302..64c71d504 100644
--- a/plugins/channelrx/udpsrc/udpsrcgui.cpp
+++ b/plugins/channelrx/udpsrc/udpsrcgui.cpp
@@ -106,6 +106,7 @@ QByteArray UDPSrcGUI::serialize() const
s.writeBool(14, m_audioStereo);
s.writeS32(15, m_fmDeviation);
s.writeS32(16, ui->squelch->value());
+ s.writeS32(17, ui->squelchGate->value());
return s.final();
}
@@ -193,8 +194,11 @@ bool UDPSrcGUI::deserialize(const QByteArray& data)
d.readS32(16, &s32tmp, -60);
ui->squelch->setValue(s32tmp);
ui->squelchText->setText(tr("%1").arg(s32tmp*1.0, 0, 'f', 0));
+ d.readS32(17, &s32tmp, 5);
+ ui->squelchGate->setValue(s32tmp);
+ ui->squelchGateText->setText(tr("%1").arg(s32tmp*10.0, 0, 'f', 0));
- blockApplySettings(false);
+ blockApplySettings(false);
m_channelMarker.blockSignals(false);
applySettingsImmediate(true);
diff --git a/plugins/channelrx/udpsrc/udpsrcgui.ui b/plugins/channelrx/udpsrc/udpsrcgui.ui
index 3d5a59027..65fae711d 100644
--- a/plugins/channelrx/udpsrc/udpsrcgui.ui
+++ b/plugins/channelrx/udpsrc/udpsrcgui.ui
@@ -550,68 +550,6 @@
- -
-
-
-
-
-
- Gain
-
-
-
- -
-
-
- Output linear gain
-
-
- 100
-
-
- 1
-
-
- 10
-
-
- Qt::Horizontal
-
-
-
- -
-
-
-
- 28
- 0
-
-
-
- Output linear gain
-
-
- 00.0
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
-
-
-
- -
-
-
- false
-
-
- Apply text input and/or samples format
-
-
- Apply
-
-
-
-
-
@@ -711,6 +649,68 @@
+ -
+
+
-
+
+
+ Gain
+
+
+
+ -
+
+
+ Output linear gain
+
+
+ 100
+
+
+ 1
+
+
+ 10
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+
+ 28
+ 0
+
+
+
+ Output linear gain
+
+
+ 00.0
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+
+
+ -
+
+
+ false
+
+
+ Apply text input and/or samples format
+
+
+ Apply
+
+
+
diff --git a/plugins/channeltx/udpsink/udpsink.cpp b/plugins/channeltx/udpsink/udpsink.cpp
index c3072e5d1..e707cb95f 100644
--- a/plugins/channeltx/udpsink/udpsink.cpp
+++ b/plugins/channeltx/udpsink/udpsink.cpp
@@ -266,6 +266,7 @@ bool UDPSink::handleMessage(const Message& cmd)
m_config.m_channelMute = cfg.getChannelMute();
m_config.m_gain = cfg.getGain();
m_config.m_squelch = CalcDb::powerFromdB(cfg.getSquelchDB());
+ m_config.m_squelchGate = cfg.getSquelchGate();
m_config.m_squelchEnabled = cfg.getSquelchEnabled();
apply(cfg.getForce());
@@ -280,6 +281,7 @@ bool UDPSink::handleMessage(const Message& cmd)
<< " m_channelMute: " << m_config.m_channelMute
<< " m_gain: " << m_config.m_gain
<< " squelchDB: " << cfg.getSquelchDB()
+ << " m_squelchGate: " << m_config.m_squelchGate
<< " m_squelch: " << m_config.m_squelch
<< " m_squelchEnabled: " << m_config.m_squelchEnabled;
@@ -378,6 +380,7 @@ void UDPSink::configure(MessageQueue* messageQueue,
bool channelMute,
Real gain,
Real squelchDB,
+ Real squelchGate,
bool squelchEnabled,
bool force)
{
@@ -390,6 +393,7 @@ void UDPSink::configure(MessageQueue* messageQueue,
channelMute,
gain,
squelchDB,
+ squelchGate,
squelchEnabled,
force);
messageQueue->push(cmd);
@@ -439,10 +443,17 @@ void UDPSink::apply(bool force)
m_levelSum = 0.0f;
m_udpHandler.resizeBuffer(m_config.m_inputSampleRate);
m_inMovingAverage.resize(m_config.m_inputSampleRate * 0.01, 1e-10); // 10 ms
- m_squelchThreshold = m_config.m_inputSampleRate * 0.1; // 100 ms
+ m_squelchThreshold = m_config.m_inputSampleRate * m_config.m_squelchGate;
+ initSquelch(m_squelchOpen);
m_settingsMutex.unlock();
}
+ if ((m_config.m_squelchGate != m_running.m_squelchGate) || force)
+ {
+ m_squelchThreshold = m_config.m_outputSampleRate * m_config.m_squelchGate;
+ initSquelch(m_squelchOpen);
+ }
+
if ((m_config.m_udpAddressStr != m_running.m_udpAddressStr) ||
(m_config.m_udpPort != m_running.m_udpPort) || force)
{
diff --git a/plugins/channeltx/udpsink/udpsink.h b/plugins/channeltx/udpsink/udpsink.h
index 8bf8e1614..4033318d7 100644
--- a/plugins/channeltx/udpsink/udpsink.h
+++ b/plugins/channeltx/udpsink/udpsink.h
@@ -69,6 +69,7 @@ public:
bool channelMute,
Real gain,
Real squelchDB,
+ Real squelchGate,
bool squelchEnabled,
bool force = false);
void setSpectrum(MessageQueue* messageQueue, bool enabled);
@@ -97,6 +98,7 @@ private:
bool getChannelMute() const { return m_channelMute; }
Real getGain() const { return m_gain; }
Real getSquelchDB() const { return m_squelchDB; }
+ Real getSquelchGate() const { return m_squelchGate; }
bool getSquelchEnabled() const { return m_squelchEnabled; }
bool getForce() const { return m_force; }
@@ -110,6 +112,7 @@ private:
bool channelMute,
Real gain,
Real squelchDB,
+ Real squelchGate,
bool squelchEnabled,
bool force)
{
@@ -122,6 +125,7 @@ private:
channelMute,
gain,
squelchDB,
+ squelchGate,
squelchEnabled,
force);
}
@@ -136,6 +140,7 @@ private:
bool m_channelMute;
Real m_gain;
Real m_squelchDB;
+ Real m_squelchGate;
bool m_squelchEnabled;
bool m_force;
@@ -148,6 +153,7 @@ private:
bool channelMute,
Real gain,
Real squelchDB,
+ Real squelchGate,
bool squelchEnabled,
bool force) :
Message(),
@@ -160,6 +166,7 @@ private:
m_channelMute(channelMute),
m_gain(gain),
m_squelchDB(squelchDB),
+ m_squelchGate(squelchGate),
m_squelchEnabled(squelchEnabled),
m_force(force)
{ }
@@ -213,6 +220,7 @@ private:
bool m_channelMute;
Real m_gain;
Real m_squelch; //!< squared magnitude
+ Real m_squelchGate; //!< seconds
bool m_squelchEnabled;
QString m_udpAddressStr;
@@ -229,6 +237,7 @@ private:
m_channelMute(false),
m_gain(1.0),
m_squelch(-50.0),
+ m_squelchGate(0.05),
m_squelchEnabled(true),
m_udpAddressStr("127.0.0.1"),
m_udpPort(9999)
@@ -289,21 +298,41 @@ private:
{
if ((!m_running.m_squelchEnabled) || (value > m_running.m_squelch))
{
- if (m_squelchOpenCount < m_squelchThreshold) {
- m_squelchOpenCount++;
- } else {
- m_squelchCloseCount = m_squelchThreshold;
+ if (m_squelchThreshold == 0)
+ {
m_squelchOpen = true;
}
+ else
+ {
+ if (m_squelchOpenCount < m_squelchThreshold)
+ {
+ m_squelchOpenCount++;
+ }
+ else
+ {
+ m_squelchCloseCount = m_squelchThreshold;
+ m_squelchOpen = true;
+ }
+ }
}
else
{
- if (m_squelchCloseCount > 0) {
- m_squelchCloseCount--;
- } else {
- m_squelchOpenCount = 0;
+ if (m_squelchThreshold == 0)
+ {
m_squelchOpen = false;
}
+ else
+ {
+ if (m_squelchCloseCount > 0)
+ {
+ m_squelchCloseCount--;
+ }
+ else
+ {
+ m_squelchOpenCount = 0;
+ m_squelchOpen = false;
+ }
+ }
}
}
diff --git a/plugins/channeltx/udpsink/udpsinkgui.cpp b/plugins/channeltx/udpsink/udpsinkgui.cpp
index 997ffbabb..3a6eec741 100644
--- a/plugins/channeltx/udpsink/udpsinkgui.cpp
+++ b/plugins/channeltx/udpsink/udpsinkgui.cpp
@@ -94,6 +94,7 @@ QByteArray UDPSinkGUI::serialize() const
s.writeU32(12, m_channelMarker.getColor().rgb());
s.writeString(13, m_channelMarker.getTitle());
s.writeS32(14, ui->squelch->value());
+ s.writeS32(15, ui->squelchGate->value());
return s.final();
}
@@ -180,6 +181,9 @@ bool UDPSinkGUI::deserialize(const QByteArray& data)
d.readS32(14, &s32tmp, -60);
ui->squelch->setValue(s32tmp);
ui->squelchText->setText(tr("%1").arg(s32tmp*1.0, 0, 'f', 0));
+ d.readS32(15, &s32tmp, 5);
+ ui->squelchGate->setValue(s32tmp);
+ ui->squelchGateText->setText(tr("%1").arg(s32tmp*10.0, 0, 'f', 0));
blockApplySettings(false);
m_channelMarker.blockSignals(false);
@@ -398,6 +402,7 @@ void UDPSinkGUI::applySettings(bool force)
ui->channelMute->isChecked(),
ui->gain->value() / 10.0f,
ui->squelch->value() * 1.0f,
+ ui->squelchGate->value() * 0.01f,
ui->squelch->value() != -100,
force);
@@ -409,6 +414,7 @@ void UDPSinkGUI::displaySettings()
{
ui->gainText->setText(tr("%1").arg(ui->gain->value()/10.0, 0, 'f', 1));
ui->squelchText->setText(tr("%1").arg(ui->squelch->value()*1.0, 0, 'f', 0));
+ ui->squelchGateText->setText(tr("%1").arg(ui->squelchGate->value()*10.0, 0, 'f', 0));
}
void UDPSinkGUI::channelMarkerChanged()
@@ -478,6 +484,12 @@ void UDPSinkGUI::on_squelch_valueChanged(int value)
applySettings();
}
+void UDPSinkGUI::on_squelchGate_valueChanged(int value)
+{
+ ui->squelchGateText->setText(tr("%1").arg(value*10.0, 0, 'f', 0));
+ applySettings();
+}
+
void UDPSinkGUI::on_channelMute_toggled(bool checked __attribute__((unused)))
{
applySettings();
diff --git a/plugins/channeltx/udpsink/udpsinkgui.h b/plugins/channeltx/udpsink/udpsinkgui.h
index 70ad678bc..2dc82c0a6 100644
--- a/plugins/channeltx/udpsink/udpsinkgui.h
+++ b/plugins/channeltx/udpsink/udpsinkgui.h
@@ -69,6 +69,7 @@ private slots:
void onMenuDoubleClicked();
void on_gain_valueChanged(int value);
void on_squelch_valueChanged(int value);
+ void on_squelchGate_valueChanged(int value);
void on_channelMute_toggled(bool checked);
void on_resetUDPReadIndex_clicked();
void tick();
diff --git a/plugins/channeltx/udpsink/udpsinkgui.ui b/plugins/channeltx/udpsink/udpsinkgui.ui
index abe417cf3..697a123d4 100644
--- a/plugins/channeltx/udpsink/udpsinkgui.ui
+++ b/plugins/channeltx/udpsink/udpsinkgui.ui
@@ -6,13 +6,13 @@
0
0
- 348
+ 342
400
- 316
+ 342
0
@@ -48,7 +48,7 @@
- 330
+ 340
0
@@ -111,72 +111,15 @@
-
-
-
- Sq
-
-
-
- -
-
-
-
- 22
- 22
-
+
+
+ false
- Power squelch threshold (dB)
-
-
- -100
-
-
- 0
-
-
- 1
-
-
- -50
-
-
-
- -
-
-
-
- 22
- 0
-
-
-
- Power squelch threshold (dB)
+ Apply text input and/or samples format
- -00
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
-
- -
-
-
-
- 40
- 0
-
-
-
- Input power (dB) to which squelch applies
-
-
- -100.0
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+ Apply
@@ -228,6 +171,19 @@
-
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
-
@@ -250,19 +206,6 @@
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
@@ -408,6 +351,38 @@
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 40
+ 0
+
+
+
+ Input power (dB) to which squelch applies
+
+
+ -100.0
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
-
@@ -715,17 +690,97 @@
-
-
-
- false
-
-
- Apply text input and/or samples format
-
-
- Apply
-
-
+
+
-
+
+
+ Sq
+
+
+
+ -
+
+
+ Power squelch threshold (dB)
+
+
+ -100
+
+
+ 0
+
+
+ 1
+
+
+ -50
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+
+ 22
+ 0
+
+
+
+ Power squelch threshold (dB)
+
+
+ -00
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+
+ 22
+ 22
+
+
+
+ Squelch gate (ms)
+
+
+ 50
+
+
+ 1
+
+
+ 5
+
+
+
+ -
+
+
+
+ 24
+ 0
+
+
+
+ Squelch gate (ms)
+
+
+ 000
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+