From b1bd7f8409685b8d85ec036347952d7198d611d4 Mon Sep 17 00:00:00 2001 From: f4exb Date: Wed, 11 Nov 2020 11:41:49 +0100 Subject: [PATCH] GLSpectrum settings: removed confusing invert indicator and added ssb and usb --- sdrbase/dsp/glspectrumsettings.cpp | 4 ++-- sdrbase/websockets/wsspectrum.cpp | 16 +++++++++++----- sdrbase/websockets/wsspectrum.h | 8 ++++++-- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/sdrbase/dsp/glspectrumsettings.cpp b/sdrbase/dsp/glspectrumsettings.cpp index 454585a03..8e47827ca 100644 --- a/sdrbase/dsp/glspectrumsettings.cpp +++ b/sdrbase/dsp/glspectrumsettings.cpp @@ -42,7 +42,7 @@ void GLSpectrumSettings::resetToDefaults() m_waterfallShare = 0.66; m_displayCurrent = true; m_displayWaterfall = true; - m_invertedWaterfall = true; + m_invertedWaterfall = false; m_displayMaxHold = false; m_displayHistogram = false; m_displayGrid = false; @@ -109,7 +109,7 @@ bool GLSpectrumSettings::deserialize(const QByteArray& data) d.readReal(4, &m_refLevel, 0); d.readReal(5, &m_powerRange, 100); d.readBool(6, &m_displayWaterfall, true); - d.readBool(7, &m_invertedWaterfall, true); + d.readBool(7, &m_invertedWaterfall, false); d.readBool(8, &m_displayMaxHold, false); d.readBool(9, &m_displayHistogram, false); d.readS32(10, &m_decay, 1); diff --git a/sdrbase/websockets/wsspectrum.cpp b/sdrbase/websockets/wsspectrum.cpp index 53dc4cd4f..1b79abb4f 100644 --- a/sdrbase/websockets/wsspectrum.cpp +++ b/sdrbase/websockets/wsspectrum.cpp @@ -117,7 +117,9 @@ void WSSpectrum::newSpectrum( int fftSize, uint64_t centerFrequency, int bandwidth, - bool linear + bool linear, + bool ssb, + bool usb ) { if (m_timer.elapsed() < 200) { // Max 5 frames per second @@ -137,7 +139,9 @@ void WSSpectrum::newSpectrum( nowMs, centerFrequency, bandwidth, - linear + linear, + ssb, + usb ); //qDebug() << "WSSpectrum::newSpectrum: " << payload.size() << " bytes in " << elapsed << " ms"; emit payloadToSend(payload); @@ -159,7 +163,9 @@ void WSSpectrum::buildPayload( uint64_t timestampMs, uint64_t centerFrequency, int bandwidth, - bool linear + bool linear, + bool ssb, + bool usb ) { QBuffer buffer(&bytes); @@ -169,8 +175,8 @@ void WSSpectrum::buildPayload( buffer.write((char*) ×tampMs, sizeof(uint64_t)); // 16 buffer.write((char*) &fftSize, sizeof(int)); // 24 buffer.write((char*) &bandwidth, sizeof(int)); // 28 - int linearInt = linear ? 1 : 0; - buffer.write((char*) &linearInt, sizeof(int)); // 32 + int indicators = (linear ? 1 : 0) + (ssb ? 2 : 0) + (usb ? 4 : 0); + buffer.write((char*) &indicators, sizeof(int)); // 32 buffer.write((char*) spectrum.data(), fftSize*sizeof(Real)); // 36 buffer.close(); } diff --git a/sdrbase/websockets/wsspectrum.h b/sdrbase/websockets/wsspectrum.h index 133526e85..bcc092c2a 100644 --- a/sdrbase/websockets/wsspectrum.h +++ b/sdrbase/websockets/wsspectrum.h @@ -49,7 +49,9 @@ public: int fftSize, uint64_t centerFrequency, int bandwidth, - bool linear + bool linear, + bool ssb = false, + bool usb = true ); signals: @@ -77,7 +79,9 @@ private: uint64_t timestampMs, uint64_t centerFrequency, int bandwidth, - bool linear + bool linear, + bool ssb, + bool usb ); };