mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-04-03 10:08:30 -04:00
DSD demod: use settings in GUI
This commit is contained in:
parent
eccea4a4fc
commit
2bcf9e0933
@ -73,112 +73,116 @@ void DSDDemodGUI::setCenterFrequency(qint64 centerFrequency)
|
||||
|
||||
void DSDDemodGUI::resetToDefaults()
|
||||
{
|
||||
m_settings.resetToDefaults();
|
||||
blockApplySettings(true);
|
||||
|
||||
ui->rfBW->setValue(100); // x100 Hz
|
||||
ui->demodGain->setValue(100); // 100ths
|
||||
ui->fmDeviation->setValue(50); // x100 Hz
|
||||
ui->volume->setValue(20); // /10.0
|
||||
ui->baudRate->setCurrentIndex(DSDDemodBaudRates::getDefaultRateIndex());
|
||||
ui->squelchGate->setValue(5);
|
||||
ui->squelch->setValue(-40);
|
||||
ui->deltaFrequency->setValue(0);
|
||||
ui->symbolPLLLock->setChecked(true);
|
||||
|
||||
displaySettings();
|
||||
blockApplySettings(false);
|
||||
applySettings();
|
||||
}
|
||||
|
||||
QByteArray DSDDemodGUI::serialize() const
|
||||
{
|
||||
SimpleSerializer s(1);
|
||||
s.writeS32(1, m_channelMarker.getCenterFrequency());
|
||||
s.writeS32(2, ui->rfBW->value());
|
||||
s.writeS32(3, ui->demodGain->value());
|
||||
s.writeS32(4, ui->fmDeviation->value());
|
||||
s.writeS32(5, ui->squelch->value());
|
||||
s.writeU32(7, m_channelMarker.getColor().rgb());
|
||||
s.writeS32(8, ui->squelchGate->value());
|
||||
s.writeS32(9, ui->volume->value());
|
||||
s.writeBlob(10, ui->scopeGUI->serialize());
|
||||
s.writeS32(11, ui->baudRate->currentIndex());
|
||||
s.writeBool(12, m_enableCosineFiltering);
|
||||
s.writeBool(13, m_syncOrConstellation);
|
||||
s.writeBool(14, m_slot1On);
|
||||
s.writeBool(15, m_slot2On);
|
||||
s.writeBool(16, m_tdmaStereo);
|
||||
s.writeBlob(17, m_channelMarker.serialize());
|
||||
return s.final();
|
||||
return m_settings.serialize();
|
||||
// SimpleSerializer s(1);
|
||||
// s.writeS32(1, m_channelMarker.getCenterFrequency());
|
||||
// s.writeS32(2, ui->rfBW->value());
|
||||
// s.writeS32(3, ui->demodGain->value());
|
||||
// s.writeS32(4, ui->fmDeviation->value());
|
||||
// s.writeS32(5, ui->squelch->value());
|
||||
// s.writeU32(7, m_channelMarker.getColor().rgb());
|
||||
// s.writeS32(8, ui->squelchGate->value());
|
||||
// s.writeS32(9, ui->volume->value());
|
||||
// s.writeBlob(10, ui->scopeGUI->serialize());
|
||||
// s.writeS32(11, ui->baudRate->currentIndex());
|
||||
// s.writeBool(12, m_enableCosineFiltering);
|
||||
// s.writeBool(13, m_syncOrConstellation);
|
||||
// s.writeBool(14, m_slot1On);
|
||||
// s.writeBool(15, m_slot2On);
|
||||
// s.writeBool(16, m_tdmaStereo);
|
||||
// s.writeBlob(17, m_channelMarker.serialize());
|
||||
// return s.final();
|
||||
}
|
||||
|
||||
bool DSDDemodGUI::deserialize(const QByteArray& data)
|
||||
{
|
||||
SimpleDeserializer d(data);
|
||||
if (m_settings.deserialize(data))
|
||||
{
|
||||
displaySettings();
|
||||
applySettings(true);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
resetToDefaults();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!d.isValid())
|
||||
{
|
||||
resetToDefaults();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (d.getVersion() == 1)
|
||||
{
|
||||
QByteArray bytetmp;
|
||||
QString strtmp;
|
||||
quint32 u32tmp;
|
||||
qint32 tmp;
|
||||
|
||||
blockApplySettings(true);
|
||||
m_channelMarker.blockSignals(true);
|
||||
|
||||
d.readBlob(17, &bytetmp);
|
||||
m_channelMarker.deserialize(bytetmp);
|
||||
|
||||
d.readS32(1, &tmp, 0);
|
||||
m_channelMarker.setCenterFrequency(tmp);
|
||||
d.readS32(2, &tmp, 4);
|
||||
ui->rfBW->setValue(tmp);
|
||||
d.readS32(3, &tmp, 3);
|
||||
ui->demodGain->setValue(tmp);
|
||||
d.readS32(4, &tmp, 20);
|
||||
ui->fmDeviation->setValue(tmp);
|
||||
d.readS32(5, &tmp, -40);
|
||||
ui->squelch->setValue(tmp);
|
||||
|
||||
if(d.readU32(7, &u32tmp))
|
||||
{
|
||||
m_channelMarker.setColor(u32tmp);
|
||||
}
|
||||
|
||||
d.readS32(8, &tmp, 5);
|
||||
ui->squelchGate->setValue(tmp);
|
||||
d.readS32(9, &tmp, 20);
|
||||
ui->volume->setValue(tmp);
|
||||
d.readBlob(10, &bytetmp);
|
||||
ui->scopeGUI->deserialize(bytetmp);
|
||||
d.readS32(11, &tmp, 20);
|
||||
ui->baudRate->setCurrentIndex(tmp);
|
||||
d.readBool(12, &m_enableCosineFiltering, false);
|
||||
d.readBool(13, &m_syncOrConstellation, false);
|
||||
d.readBool(14, &m_slot1On, false);
|
||||
d.readBool(15, &m_slot2On, false);
|
||||
d.readBool(16, &m_tdmaStereo, false);
|
||||
|
||||
this->setWindowTitle(m_channelMarker.getTitle());
|
||||
displayUDPAddress();
|
||||
|
||||
blockApplySettings(false);
|
||||
m_channelMarker.blockSignals(false);
|
||||
|
||||
updateMyPosition(); // we do it also here to be able to refresh with latest settings
|
||||
applySettings(true);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
resetToDefaults();
|
||||
return false;
|
||||
}
|
||||
// SimpleDeserializer d(data);
|
||||
//
|
||||
// if (!d.isValid())
|
||||
// {
|
||||
// resetToDefaults();
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// if (d.getVersion() == 1)
|
||||
// {
|
||||
// QByteArray bytetmp;
|
||||
// QString strtmp;
|
||||
// quint32 u32tmp;
|
||||
// qint32 tmp;
|
||||
//
|
||||
// blockApplySettings(true);
|
||||
// m_channelMarker.blockSignals(true);
|
||||
//
|
||||
// d.readBlob(17, &bytetmp);
|
||||
// m_channelMarker.deserialize(bytetmp);
|
||||
//
|
||||
// d.readS32(1, &tmp, 0);
|
||||
// m_channelMarker.setCenterFrequency(tmp);
|
||||
// d.readS32(2, &tmp, 4);
|
||||
// ui->rfBW->setValue(tmp);
|
||||
// d.readS32(3, &tmp, 3);
|
||||
// ui->demodGain->setValue(tmp);
|
||||
// d.readS32(4, &tmp, 20);
|
||||
// ui->fmDeviation->setValue(tmp);
|
||||
// d.readS32(5, &tmp, -40);
|
||||
// ui->squelch->setValue(tmp);
|
||||
//
|
||||
// if(d.readU32(7, &u32tmp))
|
||||
// {
|
||||
// m_channelMarker.setColor(u32tmp);
|
||||
// }
|
||||
//
|
||||
// d.readS32(8, &tmp, 5);
|
||||
// ui->squelchGate->setValue(tmp);
|
||||
// d.readS32(9, &tmp, 20);
|
||||
// ui->volume->setValue(tmp);
|
||||
// d.readBlob(10, &bytetmp);
|
||||
// ui->scopeGUI->deserialize(bytetmp);
|
||||
// d.readS32(11, &tmp, 20);
|
||||
// ui->baudRate->setCurrentIndex(tmp);
|
||||
// d.readBool(12, &m_enableCosineFiltering, false);
|
||||
// d.readBool(13, &m_syncOrConstellation, false);
|
||||
// d.readBool(14, &m_slot1On, false);
|
||||
// d.readBool(15, &m_slot2On, false);
|
||||
// d.readBool(16, &m_tdmaStereo, false);
|
||||
//
|
||||
// this->setWindowTitle(m_channelMarker.getTitle());
|
||||
// displayUDPAddress();
|
||||
//
|
||||
// blockApplySettings(false);
|
||||
// m_channelMarker.blockSignals(false);
|
||||
//
|
||||
// updateMyPosition(); // we do it also here to be able to refresh with latest settings
|
||||
// applySettings(true);
|
||||
// return true;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// resetToDefaults();
|
||||
// return false;
|
||||
// }
|
||||
}
|
||||
|
||||
bool DSDDemodGUI::handleMessage(const Message& message __attribute__((unused)))
|
||||
@ -189,79 +193,92 @@ bool DSDDemodGUI::handleMessage(const Message& message __attribute__((unused)))
|
||||
void DSDDemodGUI::on_deltaFrequency_changed(qint64 value)
|
||||
{
|
||||
m_channelMarker.setCenterFrequency(value);
|
||||
m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency();
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void DSDDemodGUI::on_rfBW_valueChanged(int value)
|
||||
{
|
||||
qDebug() << "DSDDemodGUI::on_rfBW_valueChanged" << value * 100;
|
||||
m_channelMarker.setBandwidth(value * 100);
|
||||
m_settings.m_rfBandwidth = value * 100.0;
|
||||
ui->rfBWText->setText(QString("%1k").arg(value / 10.0, 0, 'f', 1));
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void DSDDemodGUI::on_demodGain_valueChanged(int value __attribute__((unused)))
|
||||
void DSDDemodGUI::on_demodGain_valueChanged(int value)
|
||||
{
|
||||
m_settings.m_demodGain = value / 100.0;
|
||||
ui->demodGainText->setText(QString("%1").arg(value / 100.0, 0, 'f', 2));
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void DSDDemodGUI::on_fmDeviation_valueChanged(int value __attribute__((unused)))
|
||||
void DSDDemodGUI::on_fmDeviation_valueChanged(int value)
|
||||
{
|
||||
m_settings.m_fmDeviation = value * 100.0;
|
||||
ui->fmDeviationText->setText(QString("%1k").arg(value / 10.0, 0, 'f', 1));
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void DSDDemodGUI::on_volume_valueChanged(int value __attribute__((unused)))
|
||||
void DSDDemodGUI::on_volume_valueChanged(int value)
|
||||
{
|
||||
m_settings.m_volume= value / 10.0;
|
||||
ui->volumeText->setText(QString("%1").arg(value / 10.0, 0, 'f', 1));
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void DSDDemodGUI::on_baudRate_currentIndexChanged(int index __attribute__((unused)))
|
||||
void DSDDemodGUI::on_baudRate_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_baudRate = DSDDemodBaudRates::getRate(index);
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void DSDDemodGUI::on_enableCosineFiltering_toggled(bool enable)
|
||||
{
|
||||
m_enableCosineFiltering = enable;
|
||||
m_settings.m_enableCosineFiltering = enable;
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void DSDDemodGUI::on_syncOrConstellation_toggled(bool checked)
|
||||
{
|
||||
m_syncOrConstellation = checked;
|
||||
m_settings.m_syncOrConstellation = checked;
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void DSDDemodGUI::on_slot1On_toggled(bool checked)
|
||||
{
|
||||
m_slot1On = checked;
|
||||
m_settings.m_slot1On = checked;
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void DSDDemodGUI::on_slot2On_toggled(bool checked)
|
||||
{
|
||||
m_slot2On = checked;
|
||||
m_settings.m_slot2On = checked;
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void DSDDemodGUI::on_tdmaStereoSplit_toggled(bool checked)
|
||||
{
|
||||
m_tdmaStereo = checked;
|
||||
m_settings.m_tdmaStereo = checked;
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void DSDDemodGUI::on_squelchGate_valueChanged(int value __attribute__((unused)))
|
||||
void DSDDemodGUI::on_squelchGate_valueChanged(int value)
|
||||
{
|
||||
m_settings.m_squelchGate = value;
|
||||
ui->squelchGateText->setText(QString("%1").arg(value * 10.0, 0, 'f', 0));
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void DSDDemodGUI::on_squelch_valueChanged(int value)
|
||||
{
|
||||
ui->squelchText->setText(QString("%1").arg(value / 10.0, 0, 'f', 1));
|
||||
m_settings.m_squelch = value / 10.0;
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void DSDDemodGUI::on_audioMute_toggled(bool checked)
|
||||
{
|
||||
m_audioMute = checked;
|
||||
m_settings.m_audioMute = checked;
|
||||
applySettings();
|
||||
}
|
||||
|
||||
@ -272,11 +289,13 @@ void DSDDemodGUI::on_symbolPLLLock_toggled(bool checked)
|
||||
} else {
|
||||
ui->symbolPLLLock->setStyleSheet("QToolButton { background:rgb(53,53,53); }");
|
||||
}
|
||||
m_settings.m_pllLock = checked;
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void DSDDemodGUI::on_udpOutput_toggled(bool checked __attribute__((unused)))
|
||||
void DSDDemodGUI::on_udpOutput_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_udpCopyAudio = checked;
|
||||
applySettings();
|
||||
}
|
||||
|
||||
@ -352,7 +371,11 @@ DSDDemodGUI::DSDDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidg
|
||||
|
||||
ui->scopeGUI->setBuddies(m_scopeVis->getInputMessageQueue(), m_scopeVis, ui->glScope);
|
||||
|
||||
m_settings.setChannelMarker(&m_channelMarker);
|
||||
m_settings.setScopeGUI(ui->scopeGUI);
|
||||
|
||||
updateMyPosition();
|
||||
displaySettings();
|
||||
displayUDPAddress();
|
||||
applySettings(true);
|
||||
}
|
||||
@ -382,46 +405,91 @@ void DSDDemodGUI::displayUDPAddress()
|
||||
ui->udpOutput->setToolTip(QString("Copy audio output to UDP %1:%2").arg(m_channelMarker.getUDPAddress()).arg(m_channelMarker.getUDPSendPort()));
|
||||
}
|
||||
|
||||
void DSDDemodGUI::displaySettings()
|
||||
{
|
||||
blockApplySettings(true);
|
||||
|
||||
m_channelMarker.blockSignals(true);
|
||||
m_channelMarker.setCenterFrequency(m_settings.m_inputFrequencyOffset);
|
||||
m_channelMarker.setUDPAddress(m_settings.m_udpAddress);
|
||||
m_channelMarker.setUDPSendPort(m_settings.m_udpPort);
|
||||
m_channelMarker.setColor(m_settings.m_rgbColor);
|
||||
this->setWindowTitle(m_channelMarker.getTitle());
|
||||
setTitleColor(m_settings.m_rgbColor);
|
||||
m_channelMarker.blockSignals(false);
|
||||
|
||||
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
|
||||
|
||||
ui->rfBW->setValue(m_settings.m_rfBandwidth / 100.0);
|
||||
ui->rfBWText->setText(QString("%1k").arg(ui->rfBW->value() / 10.0, 0, 'f', 1));
|
||||
|
||||
ui->fmDeviation->setValue(m_settings.m_fmDeviation / 100.0);
|
||||
ui->fmDeviationText->setText(QString("%1k").arg(ui->fmDeviation->value() / 10.0, 0, 'f', 1));
|
||||
|
||||
ui->squelch->setValue(m_settings.m_squelch * 10.0);
|
||||
ui->squelchText->setText(QString("%1").arg(ui->squelch->value() / 10.0, 0, 'f', 1));
|
||||
|
||||
ui->squelchGate->setValue(m_settings.m_squelchGate);
|
||||
ui->squelchGateText->setText(QString("%1").arg(ui->squelchGate->value() * 10.0, 0, 'f', 0));
|
||||
|
||||
ui->demodGain->setValue(m_settings.m_demodGain * 100.0);
|
||||
ui->demodGainText->setText(QString("%1").arg(ui->demodGain->value() / 100.0, 0, 'f', 2));
|
||||
|
||||
ui->volume->setValue(m_settings.m_volume * 10.0);
|
||||
ui->volumeText->setText(QString("%1").arg(ui->volume->value() / 10.0, 0, 'f', 1));
|
||||
|
||||
ui->enableCosineFiltering->setChecked(m_settings.m_enableCosineFiltering);
|
||||
ui->syncOrConstellation->setChecked(m_settings.m_syncOrConstellation);
|
||||
ui->slot1On->setChecked(m_settings.m_slot1On);
|
||||
ui->slot2On->setChecked(m_settings.m_slot2On);
|
||||
ui->tdmaStereoSplit->setChecked(m_settings.m_tdmaStereo);
|
||||
ui->audioMute->setChecked(m_settings.m_audioMute);
|
||||
ui->udpOutput->setChecked(m_settings.m_udpCopyAudio);
|
||||
ui->symbolPLLLock->setChecked(m_settings.m_pllLock);
|
||||
|
||||
ui->baudRate->setCurrentIndex(DSDDemodBaudRates::getRateIndex(m_settings.m_baudRate));
|
||||
|
||||
blockApplySettings(false);
|
||||
}
|
||||
|
||||
void DSDDemodGUI::applySettings(bool force)
|
||||
{
|
||||
if (m_doApplySettings)
|
||||
{
|
||||
qDebug() << "DSDDemodGUI::applySettings";
|
||||
|
||||
setTitleColor(m_channelMarker.getColor());
|
||||
|
||||
DSDDemod::MsgConfigureChannelizer* channelConfigMsg = DSDDemod::MsgConfigureChannelizer::create(
|
||||
48000, m_channelMarker.getCenterFrequency());
|
||||
m_dsdDemod->getInputMessageQueue()->push(channelConfigMsg);
|
||||
|
||||
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
|
||||
ui->rfBWText->setText(QString("%1k").arg(ui->rfBW->value() / 10.0, 0, 'f', 1));
|
||||
ui->demodGainText->setText(QString("%1").arg(ui->demodGain->value() / 100.0, 0, 'f', 2));
|
||||
ui->fmDeviationText->setText(QString("%1k").arg(ui->fmDeviation->value() / 10.0, 0, 'f', 1));
|
||||
ui->squelchGateText->setText(QString("%1").arg(ui->squelchGate->value() * 10.0, 0, 'f', 0));
|
||||
ui->volumeText->setText(QString("%1").arg(ui->volume->value() / 10.0, 0, 'f', 1));
|
||||
ui->enableCosineFiltering->setChecked(m_enableCosineFiltering);
|
||||
ui->syncOrConstellation->setChecked(m_syncOrConstellation);
|
||||
ui->slot1On->setChecked(m_slot1On);
|
||||
ui->slot2On->setChecked(m_slot2On);
|
||||
ui->tdmaStereoSplit->setChecked(m_tdmaStereo);
|
||||
// ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
|
||||
// ui->rfBWText->setText(QString("%1k").arg(ui->rfBW->value() / 10.0, 0, 'f', 1));
|
||||
// ui->demodGainText->setText(QString("%1").arg(ui->demodGain->value() / 100.0, 0, 'f', 2));
|
||||
// ui->fmDeviationText->setText(QString("%1k").arg(ui->fmDeviation->value() / 10.0, 0, 'f', 1));
|
||||
// ui->squelchGateText->setText(QString("%1").arg(ui->squelchGate->value() * 10.0, 0, 'f', 0));
|
||||
// ui->volumeText->setText(QString("%1").arg(ui->volume->value() / 10.0, 0, 'f', 1));
|
||||
// ui->enableCosineFiltering->setChecked(m_enableCosineFiltering);
|
||||
// ui->syncOrConstellation->setChecked(m_syncOrConstellation);
|
||||
// ui->slot1On->setChecked(m_slot1On);
|
||||
// ui->slot2On->setChecked(m_slot2On);
|
||||
// ui->tdmaStereoSplit->setChecked(m_tdmaStereo);
|
||||
|
||||
m_dsdDemod->configure(m_dsdDemod->getInputMessageQueue(),
|
||||
ui->rfBW->value() * 100.0,
|
||||
ui->fmDeviation->value() * 100.0,
|
||||
ui->demodGain->value() / 100.0,
|
||||
ui->volume->value() / 10.0,
|
||||
m_settings.m_rfBandwidth,
|
||||
m_settings.m_fmDeviation,
|
||||
m_settings.m_demodGain,
|
||||
m_settings.m_volume,
|
||||
DSDDemodBaudRates::getRate(ui->baudRate->currentIndex()),
|
||||
ui->squelchGate->value(), // in 10ths of ms
|
||||
ui->squelch->value() / 10.0,
|
||||
ui->audioMute->isChecked(),
|
||||
m_enableCosineFiltering,
|
||||
m_syncOrConstellation,
|
||||
m_slot1On,
|
||||
m_slot2On,
|
||||
m_tdmaStereo,
|
||||
ui->symbolPLLLock->isChecked(),
|
||||
ui->udpOutput->isChecked(),
|
||||
m_settings.m_squelchGate, // in 10ths of ms
|
||||
m_settings.m_squelch,
|
||||
m_settings.m_audioMute,
|
||||
m_settings.m_enableCosineFiltering,
|
||||
m_settings.m_syncOrConstellation,
|
||||
m_settings.m_slot1On,
|
||||
m_settings.m_slot2On,
|
||||
m_settings.m_tdmaStereo,
|
||||
m_settings.m_pllLock,
|
||||
m_settings.m_udpCopyAudio,
|
||||
m_channelMarker.getUDPAddress(),
|
||||
m_channelMarker.getUDPSendPort(),
|
||||
force);
|
||||
|
@ -27,6 +27,8 @@
|
||||
#include "dsp/movingaverage.h"
|
||||
#include "util/messagequeue.h"
|
||||
|
||||
#include "dsddemodsettings.h"
|
||||
|
||||
class PluginAPI;
|
||||
class DeviceSourceAPI;
|
||||
|
||||
@ -94,6 +96,7 @@ private:
|
||||
PluginAPI* m_pluginAPI;
|
||||
DeviceSourceAPI* m_deviceAPI;
|
||||
ChannelMarker m_channelMarker;
|
||||
DSDDemodSettings m_settings;
|
||||
bool m_doApplySettings;
|
||||
char m_formatStatusText[82+1]; //!< Fixed signal format dependent status text
|
||||
SignalFormat m_signalFormat;
|
||||
@ -120,6 +123,7 @@ private:
|
||||
|
||||
void blockApplySettings(bool block);
|
||||
void applySettings(bool force = false);
|
||||
void displaySettings();
|
||||
void updateMyPosition();
|
||||
void displayUDPAddress();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user