mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-05-29 13:32:26 -04:00
UDP sink plugin: implement auto RW balance toggle button
This commit is contained in:
parent
115379bcf2
commit
21cfac0cac
@ -374,6 +374,7 @@ bool UDPSink::handleMessage(const Message& cmd)
|
|||||||
m_config.m_squelch = CalcDb::powerFromdB(cfg.getSquelchDB());
|
m_config.m_squelch = CalcDb::powerFromdB(cfg.getSquelchDB());
|
||||||
m_config.m_squelchGate = cfg.getSquelchGate();
|
m_config.m_squelchGate = cfg.getSquelchGate();
|
||||||
m_config.m_squelchEnabled = cfg.getSquelchEnabled();
|
m_config.m_squelchEnabled = cfg.getSquelchEnabled();
|
||||||
|
m_config.m_autoRWBalance = cfg.getAutoRWBalance();
|
||||||
|
|
||||||
apply(cfg.getForce());
|
apply(cfg.getForce());
|
||||||
|
|
||||||
@ -389,7 +390,8 @@ bool UDPSink::handleMessage(const Message& cmd)
|
|||||||
<< " squelchDB: " << cfg.getSquelchDB()
|
<< " squelchDB: " << cfg.getSquelchDB()
|
||||||
<< " m_squelchGate: " << m_config.m_squelchGate
|
<< " m_squelchGate: " << m_config.m_squelchGate
|
||||||
<< " m_squelch: " << m_config.m_squelch
|
<< " m_squelch: " << m_config.m_squelch
|
||||||
<< " m_squelchEnabled: " << m_config.m_squelchEnabled;
|
<< " m_squelchEnabled: " << m_config.m_squelchEnabled
|
||||||
|
<< " m_autoRWBalance: " << m_config.m_autoRWBalance;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -489,6 +491,7 @@ void UDPSink::configure(MessageQueue* messageQueue,
|
|||||||
Real squelchDB,
|
Real squelchDB,
|
||||||
Real squelchGate,
|
Real squelchGate,
|
||||||
bool squelchEnabled,
|
bool squelchEnabled,
|
||||||
|
bool autoRWBalance,
|
||||||
bool force)
|
bool force)
|
||||||
{
|
{
|
||||||
Message* cmd = MsgUDPSinkConfigure::create(sampleFormat,
|
Message* cmd = MsgUDPSinkConfigure::create(sampleFormat,
|
||||||
@ -503,6 +506,7 @@ void UDPSink::configure(MessageQueue* messageQueue,
|
|||||||
squelchDB,
|
squelchDB,
|
||||||
squelchGate,
|
squelchGate,
|
||||||
squelchEnabled,
|
squelchEnabled,
|
||||||
|
autoRWBalance,
|
||||||
force);
|
force);
|
||||||
messageQueue->push(cmd);
|
messageQueue->push(cmd);
|
||||||
}
|
}
|
||||||
|
@ -73,6 +73,7 @@ public:
|
|||||||
Real squelchDB,
|
Real squelchDB,
|
||||||
Real squelchGate,
|
Real squelchGate,
|
||||||
bool squelchEnabled,
|
bool squelchEnabled,
|
||||||
|
bool autoRWBalance,
|
||||||
bool force = false);
|
bool force = false);
|
||||||
void setSpectrum(MessageQueue* messageQueue, bool enabled);
|
void setSpectrum(MessageQueue* messageQueue, bool enabled);
|
||||||
void resetReadIndex(MessageQueue* messageQueue);
|
void resetReadIndex(MessageQueue* messageQueue);
|
||||||
@ -104,6 +105,7 @@ private:
|
|||||||
Real getSquelchGate() const { return m_squelchGate; }
|
Real getSquelchGate() const { return m_squelchGate; }
|
||||||
bool getSquelchEnabled() const { return m_squelchEnabled; }
|
bool getSquelchEnabled() const { return m_squelchEnabled; }
|
||||||
bool getForce() const { return m_force; }
|
bool getForce() const { return m_force; }
|
||||||
|
bool getAutoRWBalance() const { return m_autoRWBalance; }
|
||||||
|
|
||||||
static MsgUDPSinkConfigure* create(SampleFormat
|
static MsgUDPSinkConfigure* create(SampleFormat
|
||||||
sampleFormat,
|
sampleFormat,
|
||||||
@ -118,6 +120,7 @@ private:
|
|||||||
Real squelchDB,
|
Real squelchDB,
|
||||||
Real squelchGate,
|
Real squelchGate,
|
||||||
bool squelchEnabled,
|
bool squelchEnabled,
|
||||||
|
bool autoRWBalance,
|
||||||
bool force)
|
bool force)
|
||||||
{
|
{
|
||||||
return new MsgUDPSinkConfigure(sampleFormat,
|
return new MsgUDPSinkConfigure(sampleFormat,
|
||||||
@ -132,6 +135,7 @@ private:
|
|||||||
squelchDB,
|
squelchDB,
|
||||||
squelchGate,
|
squelchGate,
|
||||||
squelchEnabled,
|
squelchEnabled,
|
||||||
|
autoRWBalance,
|
||||||
force);
|
force);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,6 +152,7 @@ private:
|
|||||||
Real m_squelchDB;
|
Real m_squelchDB;
|
||||||
Real m_squelchGate;
|
Real m_squelchGate;
|
||||||
bool m_squelchEnabled;
|
bool m_squelchEnabled;
|
||||||
|
bool m_autoRWBalance;
|
||||||
bool m_force;
|
bool m_force;
|
||||||
|
|
||||||
MsgUDPSinkConfigure(SampleFormat sampleFormat,
|
MsgUDPSinkConfigure(SampleFormat sampleFormat,
|
||||||
@ -162,6 +167,7 @@ private:
|
|||||||
Real squelchDB,
|
Real squelchDB,
|
||||||
Real squelchGate,
|
Real squelchGate,
|
||||||
bool squelchEnabled,
|
bool squelchEnabled,
|
||||||
|
bool autoRWBalance,
|
||||||
bool force) :
|
bool force) :
|
||||||
Message(),
|
Message(),
|
||||||
m_sampleFormat(sampleFormat),
|
m_sampleFormat(sampleFormat),
|
||||||
@ -176,6 +182,7 @@ private:
|
|||||||
m_squelchDB(squelchDB),
|
m_squelchDB(squelchDB),
|
||||||
m_squelchGate(squelchGate),
|
m_squelchGate(squelchGate),
|
||||||
m_squelchEnabled(squelchEnabled),
|
m_squelchEnabled(squelchEnabled),
|
||||||
|
m_autoRWBalance(autoRWBalance),
|
||||||
m_force(force)
|
m_force(force)
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
@ -232,6 +239,7 @@ private:
|
|||||||
Real m_squelch; //!< squared magnitude
|
Real m_squelch; //!< squared magnitude
|
||||||
Real m_squelchGate; //!< seconds
|
Real m_squelchGate; //!< seconds
|
||||||
bool m_squelchEnabled;
|
bool m_squelchEnabled;
|
||||||
|
bool m_autoRWBalance;
|
||||||
|
|
||||||
QString m_udpAddressStr;
|
QString m_udpAddressStr;
|
||||||
quint16 m_udpPort;
|
quint16 m_udpPort;
|
||||||
@ -251,6 +259,7 @@ private:
|
|||||||
m_squelch(-50.0),
|
m_squelch(-50.0),
|
||||||
m_squelchGate(0.05),
|
m_squelchGate(0.05),
|
||||||
m_squelchEnabled(true),
|
m_squelchEnabled(true),
|
||||||
|
m_autoRWBalance(true),
|
||||||
m_udpAddressStr("127.0.0.1"),
|
m_udpAddressStr("127.0.0.1"),
|
||||||
m_udpPort(9999)
|
m_udpPort(9999)
|
||||||
{}
|
{}
|
||||||
|
@ -95,6 +95,7 @@ QByteArray UDPSinkGUI::serialize() const
|
|||||||
s.writeString(13, m_channelMarker.getTitle());
|
s.writeString(13, m_channelMarker.getTitle());
|
||||||
s.writeS32(14, ui->squelch->value());
|
s.writeS32(14, ui->squelch->value());
|
||||||
s.writeS32(15, ui->squelchGate->value());
|
s.writeS32(15, ui->squelchGate->value());
|
||||||
|
s.writeBool(16, ui->autoRWBalance->isChecked());
|
||||||
return s.final();
|
return s.final();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,6 +116,7 @@ bool UDPSinkGUI::deserialize(const QByteArray& data)
|
|||||||
qint32 s32tmp;
|
qint32 s32tmp;
|
||||||
quint32 u32tmp;
|
quint32 u32tmp;
|
||||||
Real realtmp;
|
Real realtmp;
|
||||||
|
bool booltmp;
|
||||||
|
|
||||||
blockApplySettings(true);
|
blockApplySettings(true);
|
||||||
m_channelMarker.blockSignals(true);
|
m_channelMarker.blockSignals(true);
|
||||||
@ -184,6 +186,8 @@ bool UDPSinkGUI::deserialize(const QByteArray& data)
|
|||||||
d.readS32(15, &s32tmp, 5);
|
d.readS32(15, &s32tmp, 5);
|
||||||
ui->squelchGate->setValue(s32tmp);
|
ui->squelchGate->setValue(s32tmp);
|
||||||
ui->squelchGateText->setText(tr("%1").arg(s32tmp*10.0, 0, 'f', 0));
|
ui->squelchGateText->setText(tr("%1").arg(s32tmp*10.0, 0, 'f', 0));
|
||||||
|
d.readBool(16, &booltmp, true);
|
||||||
|
ui->autoRWBalance->setChecked(booltmp);
|
||||||
|
|
||||||
blockApplySettings(false);
|
blockApplySettings(false);
|
||||||
m_channelMarker.blockSignals(false);
|
m_channelMarker.blockSignals(false);
|
||||||
@ -412,6 +416,7 @@ void UDPSinkGUI::applySettings(bool force)
|
|||||||
ui->squelch->value() * 1.0f,
|
ui->squelch->value() * 1.0f,
|
||||||
ui->squelchGate->value() * 0.01f,
|
ui->squelchGate->value() * 0.01f,
|
||||||
ui->squelch->value() != -100,
|
ui->squelch->value() != -100,
|
||||||
|
ui->autoRWBalance->isChecked(),
|
||||||
force);
|
force);
|
||||||
|
|
||||||
ui->applyBtn->setEnabled(false);
|
ui->applyBtn->setEnabled(false);
|
||||||
@ -532,6 +537,11 @@ void UDPSinkGUI::on_resetUDPReadIndex_clicked()
|
|||||||
m_udpSink->resetReadIndex(m_udpSink->getInputMessageQueue());
|
m_udpSink->resetReadIndex(m_udpSink->getInputMessageQueue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UDPSinkGUI::on_autoRWBalance_toggled(bool checked __attribute__((unused)))
|
||||||
|
{
|
||||||
|
applySettings();
|
||||||
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::onWidgetRolled(QWidget* widget, bool rollDown)
|
void UDPSinkGUI::onWidgetRolled(QWidget* widget, bool rollDown)
|
||||||
{
|
{
|
||||||
if ((widget == ui->spectrumBox) && (m_udpSink != 0))
|
if ((widget == ui->spectrumBox) && (m_udpSink != 0))
|
||||||
|
@ -73,6 +73,7 @@ private slots:
|
|||||||
void on_squelchGate_valueChanged(int value);
|
void on_squelchGate_valueChanged(int value);
|
||||||
void on_channelMute_toggled(bool checked);
|
void on_channelMute_toggled(bool checked);
|
||||||
void on_resetUDPReadIndex_clicked();
|
void on_resetUDPReadIndex_clicked();
|
||||||
|
void on_autoRWBalance_toggled(bool checked);
|
||||||
void tick();
|
void tick();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -654,6 +654,31 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="ButtonSwitch" name="autoRWBalance">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>22</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>22</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Automatic R/W balance compensation</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>G</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_2">
|
<spacer name="horizontalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
@ -897,6 +922,11 @@
|
|||||||
<header>gui/levelmeter.h</header>
|
<header>gui/levelmeter.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>ButtonSwitch</class>
|
||||||
|
<extends>QToolButton</extends>
|
||||||
|
<header location="global">gui/buttonswitch.h</header>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../../../sdrbase/resources/res.qrc"/>
|
<include location="../../../sdrbase/resources/res.qrc"/>
|
||||||
|
@ -36,6 +36,7 @@ UDPSinkUDPHandler::UDPSinkUDPHandler() :
|
|||||||
m_readIndex(0),
|
m_readIndex(0),
|
||||||
m_rwDelta(m_minNbUDPFrames/2),
|
m_rwDelta(m_minNbUDPFrames/2),
|
||||||
m_d(0),
|
m_d(0),
|
||||||
|
m_autoRWBalance(true),
|
||||||
m_feedbackMessageQueue(0)
|
m_feedbackMessageQueue(0)
|
||||||
{
|
{
|
||||||
m_udpBuf = new udpBlk_t[m_minNbUDPFrames];
|
m_udpBuf = new udpBlk_t[m_minNbUDPFrames];
|
||||||
@ -192,7 +193,7 @@ void UDPSinkUDPHandler::advanceReadPointer(int nbBytes)
|
|||||||
c = c < -0.05 ? -0.05 : c > 0.05 ? 0.05 : c; // limit
|
c = c < -0.05 ? -0.05 : c > 0.05 ? 0.05 : c; // limit
|
||||||
UDPSinkMessages::MsgSampleRateCorrection *msg = UDPSinkMessages::MsgSampleRateCorrection::create(c, d);
|
UDPSinkMessages::MsgSampleRateCorrection *msg = UDPSinkMessages::MsgSampleRateCorrection::create(c, d);
|
||||||
|
|
||||||
if (m_feedbackMessageQueue) {
|
if (m_autoRWBalance && m_feedbackMessageQueue) {
|
||||||
m_feedbackMessageQueue->push(msg);
|
m_feedbackMessageQueue->push(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@ public:
|
|||||||
void readSample(FixReal &t);
|
void readSample(FixReal &t);
|
||||||
void readSample(Sample &s);
|
void readSample(Sample &s);
|
||||||
|
|
||||||
|
void setAutoRWBalance(bool autoRWBalance) { m_autoRWBalance = autoRWBalance; }
|
||||||
void setFeedbackMessageQueue(MessageQueue *messageQueue) { m_feedbackMessageQueue = messageQueue; }
|
void setFeedbackMessageQueue(MessageQueue *messageQueue) { m_feedbackMessageQueue = messageQueue; }
|
||||||
|
|
||||||
/** Get buffer gauge value in % of buffer size ([-50:50])
|
/** Get buffer gauge value in % of buffer size ([-50:50])
|
||||||
@ -107,6 +108,7 @@ private:
|
|||||||
int m_readIndex;
|
int m_readIndex;
|
||||||
int m_rwDelta;
|
int m_rwDelta;
|
||||||
float m_d;
|
float m_d;
|
||||||
|
bool m_autoRWBalance;
|
||||||
MessageQueue *m_feedbackMessageQueue;
|
MessageQueue *m_feedbackMessageQueue;
|
||||||
MessageQueue m_inputMessageQueue;
|
MessageQueue m_inputMessageQueue;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user