From dde49f8650882afbcd0d312e4c5cac10531ef13e Mon Sep 17 00:00:00 2001 From: John Greb Date: Mon, 12 Jan 2015 14:25:16 +0000 Subject: [PATCH] Housekeeping. --- plugins/channel/lora/lorademodgui.cpp | 30 ++++++++++--------- plugins/channel/lora/lorademodgui.h | 1 + plugins/channel/lora/lorademodgui.ui | 42 +++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 13 deletions(-) diff --git a/plugins/channel/lora/lorademodgui.cpp b/plugins/channel/lora/lorademodgui.cpp index 1d1c30264..a05c9ba9a 100644 --- a/plugins/channel/lora/lorademodgui.cpp +++ b/plugins/channel/lora/lorademodgui.cpp @@ -32,6 +32,7 @@ void LoRaDemodGUI::setName(const QString& name) void LoRaDemodGUI::resetToDefaults() { ui->BW->setValue(0); + ui->Spread->setValue(0); applySettings(); } @@ -40,8 +41,8 @@ QByteArray LoRaDemodGUI::serialize() const SimpleSerializer s(1); s.writeS32(1, m_channelMarker->getCenterFrequency()); s.writeS32(2, ui->BW->value()); - s.writeBlob(3, ui->spectrumGUI->serialize()); - s.writeU32(4, m_channelMarker->getColor().rgb()); + s.writeS32(3, ui->Spread->value()); + s.writeBlob(4, ui->spectrumGUI->serialize()); return s.final(); } @@ -56,16 +57,15 @@ bool LoRaDemodGUI::deserialize(const QByteArray& data) if(d.getVersion() == 1) { QByteArray bytetmp; - quint32 u32tmp; qint32 tmp; d.readS32(1, &tmp, 0); m_channelMarker->setCenterFrequency(tmp); d.readS32(2, &tmp, 0); ui->BW->setValue(tmp); - d.readBlob(3, &bytetmp); + d.readS32(3, &tmp, 0); + ui->Spread->setValue(tmp); + d.readBlob(4, &bytetmp); ui->spectrumGUI->deserialize(bytetmp); - if(d.readU32(4, &u32tmp)) - m_channelMarker->setColor(u32tmp); applySettings(); return true; } else { @@ -86,12 +86,17 @@ void LoRaDemodGUI::viewChanged() void LoRaDemodGUI::on_BW_valueChanged(int value) { - value = 7813; - ui->BWText->setText(QString("%1 Hz").arg(value)); - m_channelMarker->setBandwidth(value); + const int loraBW[] = {7813, 15625, 10417, 20833}; + int thisBW = loraBW[value]; + ui->BWText->setText(QString("%1 Hz").arg(thisBW)); + m_channelMarker->setBandwidth(thisBW); applySettings(); } +void LoRaDemodGUI::on_Spread_valueChanged(int value) +{ +} + void LoRaDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown) { /* @@ -126,8 +131,8 @@ LoRaDemodGUI::LoRaDemodGUI(PluginAPI* pluginAPI, QWidget* parent) : m_threadedSampleSink = new ThreadedSampleSink(m_channelizer); m_pluginAPI->addSampleSink(m_threadedSampleSink); - ui->glSpectrum->setCenterFrequency(0); - ui->glSpectrum->setSampleRate(7813); + ui->glSpectrum->setCenterFrequency(16000); + ui->glSpectrum->setSampleRate(32000); ui->glSpectrum->setDisplayWaterfall(true); ui->glSpectrum->setDisplayMaxHold(true); @@ -158,9 +163,8 @@ LoRaDemodGUI::~LoRaDemodGUI() void LoRaDemodGUI::applySettings() { - const int loraBW[] = {7813, 7813, 10417, 20833 }; + const int loraBW[] = {7813, 15625, 10417, 20833}; int thisBW = loraBW[ui->BW->value()]; - setTitleColor(m_channelMarker->getColor()); m_channelizer->configure(m_threadedSampleSink->getMessageQueue(), thisBW, m_channelMarker->getCenterFrequency()); diff --git a/plugins/channel/lora/lorademodgui.h b/plugins/channel/lora/lorademodgui.h index f64eeed9d..f0316ae64 100644 --- a/plugins/channel/lora/lorademodgui.h +++ b/plugins/channel/lora/lorademodgui.h @@ -33,6 +33,7 @@ public: private slots: void viewChanged(); void on_BW_valueChanged(int value); + void on_Spread_valueChanged(int value); void onWidgetRolled(QWidget* widget, bool rollDown); void onMenuDoubleClicked(); diff --git a/plugins/channel/lora/lorademodgui.ui b/plugins/channel/lora/lorademodgui.ui index 97afe9b35..276ed0bb6 100644 --- a/plugins/channel/lora/lorademodgui.ui +++ b/plugins/channel/lora/lorademodgui.ui @@ -39,6 +39,13 @@ + + + + Spreading + + + @@ -58,6 +65,25 @@ + + + + 0 + + + 1 + + + 1 + + + 0 + + + Qt::Horizontal + + + @@ -74,6 +100,22 @@ + + + + + 50 + 0 + + + + 2^8 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + +