Spactrum: allow arbitrary FPS (API) or in a range of FPS (GUI) with possible no limit. Implements #772

This commit is contained in:
f4exb 2021-02-12 00:53:18 +01:00
parent 6a6098ffe9
commit b5d501e6ab
37 changed files with 240 additions and 68 deletions

View File

@ -126,7 +126,6 @@ InterferometerGUI::InterferometerGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUI
ui->glSpectrum->setLsbDisplay(false);
ui->glScope->setTraceModulo(Interferometer::m_fftSize);
ui->glSpectrum->connectTimer(MainCore::instance()->getMasterTimer());
ui->glScope->connectTimer(MainCore::instance()->getMasterTimer());
connect(&MainCore::instance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));

View File

@ -132,6 +132,7 @@ void InterferometerWebAPIAdapter::webapiFormatChannelSettings(
swgSpectrum->setDisplayWaterfall(spectrumSettings.m_displayWaterfall ? 1 : 0);
swgSpectrum->setFftOverlap(spectrumSettings.m_fftOverlap);
swgSpectrum->setFftSize(spectrumSettings.m_fftSize);
swgSpectrum->setFpsPeriodMs(spectrumSettings.m_fpsPeriodMs);
}
int InterferometerWebAPIAdapter::webapiSettingsPutPatch(
@ -369,6 +370,9 @@ void InterferometerWebAPIAdapter::webapiUpdateChannelSettings(
if (channelSettingsKeys.contains("spectrumConfig.fftSize")) {
spectrumSettings.m_fftSize = response.getInterferometerSettings()->getSpectrumConfig()->getFftSize();
}
if (channelSettingsKeys.contains("spectrumConfig.fpsPeriodMs")) {
spectrumSettings.m_fpsPeriodMs = response.getInterferometerSettings()->getSpectrumConfig()->getFpsPeriodMs();
}
}
}

View File

@ -392,7 +392,6 @@ ChannelAnalyzerGUI::ChannelAnalyzerGUI(PluginAPI* pluginAPI, DeviceUISet *device
ui->glSpectrum->setSsbSpectrum(false);
ui->glSpectrum->setLsbDisplay(false);
ui->glSpectrum->connectTimer(MainCore::instance()->getMasterTimer());
ui->glScope->connectTimer(MainCore::instance()->getMasterTimer());
connect(&MainCore::instance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
@ -427,7 +426,6 @@ ChannelAnalyzerGUI::ChannelAnalyzerGUI(PluginAPI* pluginAPI, DeviceUISet *device
ChannelAnalyzerGUI::~ChannelAnalyzerGUI()
{
qDebug("ChannelAnalyzerGUI::~ChannelAnalyzerGUI");
ui->glSpectrum->disconnectTimer();
ui->glScope->disconnectTimer();
delete ui;
delete m_spectrumScopeComboVis;

View File

@ -144,6 +144,7 @@ void ChannelAnalyzerWebAPIAdapter::webapiFormatChannelSettings(
swgSpectrum->setDisplayWaterfall(spectrumSettings.m_displayWaterfall ? 1 : 0);
swgSpectrum->setFftOverlap(spectrumSettings.m_fftOverlap);
swgSpectrum->setFftSize(spectrumSettings.m_fftSize);
swgSpectrum->setFpsPeriodMs(spectrumSettings.m_fpsPeriodMs);
}
int ChannelAnalyzerWebAPIAdapter::webapiSettingsPutPatch(
@ -417,6 +418,9 @@ void ChannelAnalyzerWebAPIAdapter::webapiUpdateChannelSettings(
if (channelSettingsKeys.contains("spectrumConfig.fftSize")) {
spectrumSettings.m_fftSize = response.getChannelAnalyzerSettings()->getSpectrumConfig()->getFftSize();
}
if (channelSettingsKeys.contains("spectrumConfig.fpsPeriodMs")) {
spectrumSettings.m_fpsPeriodMs = response.getChannelAnalyzerSettings()->getSpectrumConfig()->getFpsPeriodMs();
}
}
}

View File

@ -266,7 +266,6 @@ FreeDVDemodGUI::FreeDVDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, B
ui->glSpectrum->setDisplayWaterfall(true);
ui->glSpectrum->setDisplayMaxHold(true);
ui->glSpectrum->setSsbSpectrum(true);
ui->glSpectrum->connectTimer(MainCore::instance()->getMasterTimer());
connect(&MainCore::instance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));

View File

@ -308,7 +308,6 @@ SSBDemodGUI::SSBDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
ui->glSpectrum->setDisplayWaterfall(true);
ui->glSpectrum->setDisplayMaxHold(true);
ui->glSpectrum->setSsbSpectrum(true);
ui->glSpectrum->connectTimer(MainCore::instance()->getMasterTimer());
connect(&MainCore::instance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));

View File

@ -167,7 +167,6 @@ UDPSinkGUI::UDPSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandS
ui->glSpectrum->setDisplayWaterfall(true);
ui->glSpectrum->setDisplayMaxHold(true);
ui->glSpectrum->connectTimer(MainCore::instance()->getMasterTimer());
connect(&MainCore::instance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
m_channelMarker.blockSignals(true);

View File

@ -385,7 +385,6 @@ IEEE_802_15_4_ModGUI::IEEE_802_15_4_ModGUI(PluginAPI* pluginAPI, DeviceUISet *de
ui->glSpectrum->setDisplayWaterfall(false);
ui->glSpectrum->setDisplayMaxHold(false);
ui->glSpectrum->setDisplayHistogram(false);
ui->glSpectrum->connectTimer(MainCore::instance()->getMasterTimer());
CRightClickEnabler *repeatRightClickEnabler = new CRightClickEnabler(ui->repeat);
connect(repeatRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(repeatSelect()));

View File

@ -361,7 +361,6 @@ FreeDVModGUI::FreeDVModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseb
ui->glSpectrum->setDisplayWaterfall(true);
ui->glSpectrum->setDisplayMaxHold(true);
ui->glSpectrum->setSsbSpectrum(true);
ui->glSpectrum->connectTimer(MainCore::instance()->getMasterTimer());
connect(&MainCore::instance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));

View File

@ -420,7 +420,6 @@ PacketModGUI::PacketModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseb
ui->glSpectrum->setDisplayWaterfall(false);
ui->glSpectrum->setDisplayMaxHold(false);
ui->glSpectrum->setDisplayHistogram(false);
ui->glSpectrum->connectTimer(MainCore::instance()->getMasterTimer());
CRightClickEnabler *repeatRightClickEnabler = new CRightClickEnabler(ui->repeat);
connect(repeatRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(repeatSelect()));

View File

@ -426,7 +426,6 @@ SSBModGUI::SSBModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam
ui->glSpectrum->setDisplayWaterfall(true);
ui->glSpectrum->setDisplayMaxHold(true);
ui->glSpectrum->setSsbSpectrum(true);
ui->glSpectrum->connectTimer(MainCore::instance()->getMasterTimer());
connect(&MainCore::instance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));

View File

@ -125,7 +125,6 @@ UDPSourceGUI::UDPSourceGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseb
ui->glSpectrum->setDisplayWaterfall(true);
ui->glSpectrum->setDisplayMaxHold(true);
ui->glSpectrum->connectTimer(MainCore::instance()->getMasterTimer());
connect(&MainCore::instance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
m_channelMarker.blockSignals(true);

View File

@ -163,7 +163,6 @@ DemodAnalyzerGUI::DemodAnalyzerGUI(PluginAPI* pluginAPI, FeatureUISet *featureUI
m_scopeVis->setLiveRate(m_sampleRate/(1<<m_settings.m_log2Decim));
displaySampleRate(m_sampleRate/(1<<m_settings.m_log2Decim));
ui->glSpectrum->connectTimer(MainCore::instance()->getMasterTimer());
ui->glScope->connectTimer(MainCore::instance()->getMasterTimer());
connect(&MainCore::instance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));

View File

@ -62,7 +62,6 @@ TestMOSyncGui::TestMOSyncGui(DeviceUISet *deviceUISet, QWidget* parent) :
m_spectrumVis->setGLSpectrum(ui->glSpectrum);
ui->glSpectrum->setCenterFrequency(m_settings.m_centerFrequency);
ui->glSpectrum->setSampleRate(m_settings.m_sampleRate*(1<<m_settings.m_log2Interp));
ui->glSpectrum->connectTimer(MainCore::instance()->getMasterTimer());
ui->spectrumGUI->setBuddies(m_spectrumVis, ui->glSpectrum);
connect(&(m_deviceUISet->m_deviceAPI->getMasterTimer()), SIGNAL(timeout()), this, SLOT(tick()));

View File

@ -61,7 +61,6 @@ TestSinkGui::TestSinkGui(DeviceUISet *deviceUISet, QWidget* parent) :
m_spectrumVis->setGLSpectrum(ui->glSpectrum);
ui->glSpectrum->setCenterFrequency(m_settings.m_centerFrequency);
ui->glSpectrum->setSampleRate(m_settings.m_sampleRate*(1<<m_settings.m_log2Interp));
ui->glSpectrum->connectTimer(MainCore::instance()->getMasterTimer());
ui->spectrumGUI->setBuddies(m_spectrumVis, ui->glSpectrum);
connect(&(m_deviceUISet->m_deviceAPI->getMasterTimer()), SIGNAL(timeout()), this, SLOT(tick()));

View File

@ -34,6 +34,7 @@ void GLSpectrumSettings::resetToDefaults()
m_fftWindow = FFTWindow::Hanning;
m_refLevel = 0;
m_powerRange = 100;
m_fpsPeriodMs = 50;
m_decay = 1;
m_decayDivisor = 1;
m_histogramStroke = 30;
@ -65,6 +66,7 @@ QByteArray GLSpectrumSettings::serialize() const
s.writeS32(3, (int) m_fftWindow);
s.writeReal(4, m_refLevel);
s.writeReal(5, m_powerRange);
s.writeS32(26, m_fpsPeriodMs);
s.writeBool(6, m_displayWaterfall);
s.writeBool(7, m_invertedWaterfall);
s.writeBool(8, m_displayMaxHold);
@ -108,6 +110,7 @@ bool GLSpectrumSettings::deserialize(const QByteArray& data)
m_fftWindow = (FFTWindow::Function) tmp;
d.readReal(4, &m_refLevel, 0);
d.readReal(5, &m_powerRange, 100);
d.readS32(26, &m_fpsPeriodMs, 50);
d.readBool(6, &m_displayWaterfall, true);
d.readBool(7, &m_invertedWaterfall, true);
d.readBool(8, &m_displayMaxHold, false);

View File

@ -41,6 +41,7 @@ public:
FFTWindow::Function m_fftWindow;
Real m_refLevel;
Real m_powerRange;
int m_fpsPeriodMs; //!< FPS capping period in ms FPS = 1000/m_fpsPeriodMs. If zero: no limit.
int m_decay;
int m_decayDivisor;
int m_histogramStroke;

View File

@ -721,6 +721,7 @@ void SpectrumVis::applySettings(const GLSpectrumSettings& settings, bool force)
<< " m_averagingMode: " << settings.m_averagingMode
<< " m_refLevel: " << settings.m_refLevel
<< " m_powerRange: " << settings.m_powerRange
<< " m_fpsPeriodMs: " << settings.m_fpsPeriodMs
<< " m_linear: " << settings.m_linear
<< " m_ssb: " << settings.m_ssb
<< " m_usb: " << settings.m_usb
@ -919,6 +920,7 @@ void SpectrumVis::webapiFormatSpectrumSettings(SWGSDRangel::SWGGLSpectrum& respo
response.setFftWindow((int) settings.m_fftWindow);
response.setRefLevel(settings.m_refLevel);
response.setPowerRange(settings.m_powerRange);
response.setFpsPeriodMs(settings.m_fpsPeriodMs);
response.setDecay(settings.m_decay);
response.setDecayDivisor(settings.m_decayDivisor);
response.setHistogramStroke(settings.m_histogramStroke);
@ -965,6 +967,9 @@ void SpectrumVis::webapiUpdateSpectrumSettings(
if (spectrumSettingsKeys.contains("powerRange")) {
settings.m_powerRange = response.getPowerRange();
}
if (spectrumSettingsKeys.contains("fpsPeriodMs")) {
settings.m_fpsPeriodMs = response.getFpsPeriodMs();
}
if (spectrumSettingsKeys.contains("decay")) {
settings.m_decay = response.getDecay();
}

View File

@ -4835,6 +4835,10 @@ margin-bottom: 20px;
"type" : "number",
"format" : "float"
},
"fpsPeriodMs" : {
"type" : "integer",
"description" : "FPS capping period in milliseconds. 0 for no limit."
},
"displayWaterfall" : {
"type" : "integer",
"description" : "boolean"
@ -6278,9 +6282,9 @@ margin-bottom: 20px;
"type" : "integer",
"description" : "Angle to rotate the image by"
},
"imageFixedSize" : {
"imageMinZoom" : {
"type" : "integer",
"description" : "Keep the image the same size, regardless of map zoom level (1 for yes, 0 for no)"
"description" : "Minimim zoom value"
},
"text" : {
"type" : "string"
@ -6294,6 +6298,11 @@ margin-bottom: 20px;
"type" : "number",
"format" : "float",
"description" : "Longitude in decimal degrees, positive to the east"
},
"altitude" : {
"type" : "number",
"format" : "float",
"description" : "Altitude / height above sea level in metres"
}
},
"description" : "An item to draw on the map. Set image to an empty string to remove item from the map."
@ -6313,9 +6322,9 @@ margin-bottom: 20px;
"type" : "integer",
"description" : "Angle to rotate the image by"
},
"imageFixedSize" : {
"imageMinZoom" : {
"type" : "integer",
"description" : "Keep the image the same size, regardless of map zoom level (1 for yes, 0 for no)"
"description" : "Minimim zoom value"
},
"text" : {
"type" : "string"
@ -6329,6 +6338,11 @@ margin-bottom: 20px;
"type" : "number",
"format" : "float",
"description" : "Longitude in decimal degrees, positive to the east"
},
"altitude" : {
"type" : "number",
"format" : "float",
"description" : "Altitude / height above sea level in metres"
}
},
"description" : "An item to draw on the map. Set image to an empty string to remove item from the map."
@ -45272,7 +45286,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2021-01-13T17:40:49.583+01:00
Generated 2021-02-11T23:51:16.152+01:00
</div>
</div>
</div>

View File

@ -4,15 +4,15 @@ APRSSettings:
igateServer:
type: string
igatePort:
type: integer
type: integer
igateCallsign:
type: string
igatePasscode:
type: string
igateFilter:
type: string
type: string
igateEnabled:
type: integer
type: integer
title:
type: string
rgbColor:

View File

@ -14,6 +14,9 @@ GLSpectrum:
powerRange:
type: number
format: float
fpsPeriodMs:
type: integer
description: FPS capping period in milliseconds. 0 for no limit.
displayWaterfall:
description: boolean
type: integer

View File

@ -34,16 +34,18 @@ MapItem:
properties:
name:
description: "A name for the item"
type: string
type: string
image:
description: "Filename or URL of image to draw on the map"
type: string
imageRotation:
description: "Angle to rotate the image by"
type: integer
imageFixedSize:
description: "Keep the image the same size, regardless of map zoom level (1 for yes, 0 for no)"
default: 0
imageMinZoom:
description: "Minimim zoom value"
type: integer
default: 11
text:
descrption: "Text to draw on the map when item is selected"
type: string
@ -55,3 +57,7 @@ MapItem:
description: "Longitude in decimal degrees, positive to the east"
type: number
format: float
altitude:
description: "Altitude / height above sea level in metres"
type: number
format: float

View File

@ -9,25 +9,25 @@ StarTrackerSettings:
type: string
dec:
description: "Declination of custom target"
type: string
latitude:
type: string
latitude:
description: "Latitude in decimal degrees (North positive) of observation/antenna location"
type: number
format: float
longitude:
description: "Longitude in decimal degrees (East positive) of observation/antenna location"
type: number
type: number
format: float
dateTime:
description: "Date and time of observation. ISO 8601 extended format: yyyy-MM-ddTHH:mm:ss with Z suffix for UTC. Empty string for current time."
description: "Date and time of observation. ISO 8601 extended format: yyyy-MM-ddTHH:mm:ss with Z suffix for UTC. Empty string for current time."
type: string
refraction:
refraction:
description: "Atmospheric refraction correction (None or Saemundsson)"
type: string
pressure:
description: "Air pressure in millibars, for refraction"
type: number
format: float
format: float
temperature:
description: "Air temperature in Celsuis, for refraction"
type: number
@ -47,17 +47,17 @@ StarTrackerSettings:
frequency:
description: "Frequency of radio waves being observed in MHz"
type: number
format: float
format: float
stellariumServerEnabled:
descrption: "Enable Stellarium server (1 for yes, 0 for no)"
type: integer
type: integer
stellariumPort:
description: "IP port number for Stellarium server to listen on (Default is 10001)."
type: integer
updatePeriod:
description: "Time in seconds between each calculation of the target's position"
type: number
format: float
format: float
epoch:
description: "Epoch for RA and Dec (J2000 or JNOW)"
type: string
@ -69,7 +69,7 @@ StarTrackerSettings:
type: integer
drawStarOnMap:
description: "Draw the overhead position of the target Star on the Map (1 for yes, 0 for no)"
type: integer
type: integer
title:
type: string
rgbColor:

View File

@ -149,6 +149,7 @@ void WebAPIAdapterBase::webapiFormatPreset(
swgSpectrumConfig->setFftWindow((int) m_spectrumSettings.m_fftWindow);
swgSpectrumConfig->setRefLevel(m_spectrumSettings.m_refLevel);
swgSpectrumConfig->setPowerRange(m_spectrumSettings.m_powerRange);
swgSpectrumConfig->setFpsPeriodMs(m_spectrumSettings.m_fpsPeriodMs);
swgSpectrumConfig->setDisplayWaterfall(m_spectrumSettings.m_displayWaterfall ? 1 : 0);
swgSpectrumConfig->setInvertedWaterfall(m_spectrumSettings.m_invertedWaterfall ? 1 : 0);
swgSpectrumConfig->setDisplayMaxHold(m_spectrumSettings.m_displayMaxHold ? 1 : 0);
@ -369,6 +370,9 @@ void WebAPIAdapterBase::webapiUpdatePreset(
if (spectrumIt->contains("refLevel")) {
spectrumSettings.m_refLevel = apiPreset->getSpectrumConfig()->getRefLevel();
}
if (spectrumIt->contains("fpsPeriodMs")) {
spectrumSettings.m_fpsPeriodMs = apiPreset->getSpectrumConfig()->getFpsPeriodMs();
}
if (spectrumIt->contains("waterfallShare")) {
spectrumSettings.m_waterfallShare = apiPreset->getSpectrumConfig()->getWaterfallShare();
}

View File

@ -3391,6 +3391,11 @@ bool WebAPIRequestMapper::validateSpectrumSettings(SWGSDRangel::SWGGLSpectrum& s
spectrumSettings.setPowerRange(jsonObject["powerRange"].toDouble(100.0));
spectrumSettingsKeys.append("powerRange");
}
if (jsonObject.contains("fpsPeriodMs"))
{
spectrumSettings.setFpsPeriodMs(jsonObject["fpsPeriodMs"].toInt(50));
spectrumSettingsKeys.append("fpsPeriodMs");
}
if (jsonObject.contains("displayWaterfall"))
{
spectrumSettings.setDisplayWaterfall(jsonObject["displayWaterfall"].toInt(0));

View File

@ -36,12 +36,11 @@
#include "deviceuiset.h"
DeviceUISet::DeviceUISet(int tabIndex, DeviceSet *deviceSet, QTimer& timer)
DeviceUISet::DeviceUISet(int tabIndex, DeviceSet *deviceSet)
{
m_spectrum = new GLSpectrum;
m_spectrumVis = deviceSet->m_spectrumVis;
m_spectrumVis->setGLSpectrum(m_spectrum);
m_spectrum->connectTimer(timer);
m_spectrumGUI = new GLSpectrumGUI;
m_spectrumGUI->setBuddies(m_spectrumVis, m_spectrum);
m_channelWindow = new ChannelWindow;

View File

@ -61,7 +61,7 @@ public:
DSPDeviceMIMOEngine *m_deviceMIMOEngine;
QByteArray m_mainWindowState;
DeviceUISet(int tabIndex, DeviceSet *deviceSet, QTimer& timer);
DeviceUISet(int tabIndex, DeviceSet *deviceSet);
~DeviceUISet();
GLSpectrum *getSpectrum() { return m_spectrum; } //!< Direct spectrum getter

View File

@ -37,7 +37,7 @@ GLSpectrum::GLSpectrum(QWidget* parent) :
QGLWidget(parent),
m_cursorState(CSNormal),
m_cursorChannel(0),
m_masterTimer(nullptr),
m_fpsPeriodMs(50),
m_mouseInside(false),
m_changesPending(true),
m_centerFrequency(100000000),
@ -160,8 +160,9 @@ GLSpectrum::GLSpectrum(QWidget* parent) :
m_textOverlayFont.setBold(true);
// m_textOverlayFont.setPointSize(font().pointSize() - 1);
m_timer.setTimerType(Qt::PreciseTimer);
connect(&m_timer, SIGNAL(timeout()), this, SLOT(tick()));
m_timer.start(50);
m_timer.start(m_fpsPeriodMs);
}
GLSpectrum::~GLSpectrum()
@ -428,6 +429,10 @@ void GLSpectrum::newSpectrum(const std::vector<Real>& spectrum, int fftSize)
updateWaterfall(spectrum);
updateHistogram(spectrum);
if (m_fpsPeriodMs == 0) {
update();
}
}
void GLSpectrum::updateWaterfall(const std::vector<Real>& spectrum)
@ -2288,24 +2293,20 @@ void GLSpectrum::setWaterfallShare(Real waterfallShare)
m_changesPending = true;
}
void GLSpectrum::connectTimer(const QTimer& timer)
void GLSpectrum::setFPSPeriodMs(int fpsPeriodMs)
{
qDebug() << "GLSpectrum::connectTimer";
disconnect(&m_timer, SIGNAL(timeout()), this, SLOT(tick()));
connect(&timer, SIGNAL(timeout()), this, SLOT(tick()));
m_masterTimer = &timer;
m_timer.stop();
}
if (fpsPeriodMs == 0)
{
disconnect(&m_timer, SIGNAL(timeout()), this, SLOT(tick()));
m_timer.stop();
}
else
{
connect(&m_timer, SIGNAL(timeout()), this, SLOT(tick()));
m_timer.start(fpsPeriodMs);
}
void GLSpectrum::disconnectTimer()
{
qDebug() << "GLScope::disconnectTimer";
if (m_masterTimer) {
disconnect(m_masterTimer, SIGNAL(timeout()), this, SLOT(tick()));
}
m_masterTimer = nullptr;
m_fpsPeriodMs = fpsPeriodMs;
}
void GLSpectrum::cleanup()

View File

@ -108,8 +108,7 @@ public:
Real getWaterfallShare() const { return m_waterfallShare; }
void setWaterfallShare(Real waterfallShare);
void connectTimer(const QTimer& timer);
void disconnectTimer();
void setFPSPeriodMs(int fpsPeriodMs);
void setDisplayedStream(bool sourceOrSink, int streamIndex)
{
@ -237,7 +236,7 @@ private:
int m_cursorChannel;
QTimer m_timer;
const QTimer *m_masterTimer;
int m_fpsPeriodMs;
QMutex m_mutex;
bool m_mouseInside;
bool m_changesPending;

View File

@ -32,6 +32,8 @@
#include "util/db.h"
#include "ui_glspectrumgui.h"
const int GLSpectrumGUI::m_fpsMs[] = {500, 200, 100, 50, 20, 10, 5, 0};
GLSpectrumGUI::GLSpectrumGUI(QWidget* parent) :
QWidget(parent),
ui(new Ui::GLSpectrumGUI),
@ -144,6 +146,24 @@ void GLSpectrumGUI::displaySettings()
}
}
if (m_settings.m_fpsPeriodMs == 0)
{
ui->fps->setCurrentIndex(sizeof(m_fpsMs)/sizeof(m_fpsMs[0]) - 1);
}
else
{
unsigned int i = 0;
for (; i < sizeof(m_fpsMs)/sizeof(m_fpsMs[0]); i++)
{
if (m_settings.m_fpsPeriodMs >= m_fpsMs[i]) {
break;
}
}
ui->fps->setCurrentIndex(i);
}
ui->fftOverlap->setValue(m_settings.m_fftOverlap);
setMaximumOverlap();
ui->averaging->setCurrentIndex(m_settings.m_averagingIndex);
@ -208,6 +228,7 @@ void GLSpectrumGUI::applyGLSpectrumSettings()
qDebug("GLSpectrumGUI::applySettings: refLevel: %e powerRange: %e", refLevel, powerRange);
m_glSpectrum->setReferenceLevel(refLevel);
m_glSpectrum->setPowerRange(powerRange);
m_glSpectrum->setFPSPeriodMs(m_settings.m_fpsPeriodMs);
m_glSpectrum->setLinear(m_settings.m_linear);
}
@ -323,6 +344,13 @@ void GLSpectrumGUI::on_levelRange_valueChanged(int value)
applySettings();
}
void GLSpectrumGUI::on_fps_currentIndexChanged(int index)
{
m_settings.m_fpsPeriodMs = m_fpsMs[index];
qDebug("GLSpectrumGUI::on_fps_currentIndexChanged: %d ms", m_settings.m_fpsPeriodMs);
applySettings();
}
void GLSpectrumGUI::on_decay_valueChanged(int index)
{
m_settings.m_decay = index;

View File

@ -67,6 +67,7 @@ private:
MessageQueue m_messageQueue;
GLSpectrumSettings m_settings;
bool m_doApplySettings;
static const int m_fpsMs[];
void blockApplySettings(bool block);
void applySettings();
@ -89,6 +90,7 @@ private slots:
void on_autoscale_clicked(bool checked);
void on_refLevel_valueChanged(int value);
void on_levelRange_valueChanged(int value);
void on_fps_currentIndexChanged(int index);
void on_decay_valueChanged(int index);
void on_decayDivisor_valueChanged(int index);
void on_stroke_valueChanged(int index);

View File

@ -226,7 +226,7 @@
<widget class="QComboBox" name="averaging">
<property name="minimumSize">
<size>
<width>45</width>
<width>55</width>
<height>0</height>
</size>
</property>
@ -443,6 +443,68 @@
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="fps">
<property name="minimumSize">
<size>
<width>55</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>45</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Spectrum maximum FPS (NL for No Limit)</string>
</property>
<property name="currentIndex">
<number>3</number>
</property>
<item>
<property name="text">
<string>2</string>
</property>
</item>
<item>
<property name="text">
<string>5</string>
</property>
</item>
<item>
<property name="text">
<string>10</string>
</property>
</item>
<item>
<property name="text">
<string>20</string>
</property>
</item>
<item>
<property name="text">
<string>50</string>
</property>
</item>
<item>
<property name="text">
<string>100</string>
</property>
</item>
<item>
<property name="text">
<string>200</string>
</property>
</item>
<item>
<property name="text">
<string>NL</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QToolButton" name="linscale">
<property name="toolTip">

View File

@ -304,7 +304,7 @@ void MainWindow::addSourceDevice(int deviceIndex)
ui->inputViewDock->addDevice(0, deviceTabIndex);
m_mainCore->appendDeviceSet(0);
m_deviceUIs.push_back(new DeviceUISet(deviceTabIndex, m_mainCore->m_deviceSets.back(), m_mainCore->m_masterTimer));
m_deviceUIs.push_back(new DeviceUISet(deviceTabIndex, m_mainCore->m_deviceSets.back()));
m_deviceUIs.back()->m_deviceSourceEngine = dspDeviceSourceEngine;
m_mainCore->m_deviceSets.back()->m_deviceSourceEngine = dspDeviceSourceEngine;
m_deviceUIs.back()->m_deviceSinkEngine = nullptr;
@ -383,7 +383,7 @@ void MainWindow::addSinkDevice()
ui->inputViewDock->addDevice(1, deviceTabIndex);
m_mainCore->appendDeviceSet(1);
m_deviceUIs.push_back(new DeviceUISet(deviceTabIndex, m_mainCore->m_deviceSets.back(), m_mainCore->m_masterTimer));
m_deviceUIs.push_back(new DeviceUISet(deviceTabIndex, m_mainCore->m_deviceSets.back()));
m_deviceUIs.back()->m_deviceSourceEngine = nullptr;
m_mainCore->m_deviceSets.back()->m_deviceSourceEngine = nullptr;
m_deviceUIs.back()->m_deviceSinkEngine = dspDeviceSinkEngine;
@ -460,7 +460,7 @@ void MainWindow::addMIMODevice()
ui->inputViewDock->addDevice(2, deviceTabIndex);
m_mainCore->appendDeviceSet(2);
m_deviceUIs.push_back(new DeviceUISet(deviceTabIndex, m_mainCore->m_deviceSets.back(), m_mainCore->m_masterTimer));
m_deviceUIs.push_back(new DeviceUISet(deviceTabIndex, m_mainCore->m_deviceSets.back()));
m_deviceUIs.back()->m_deviceSourceEngine = nullptr;
m_mainCore->m_deviceSets.back()->m_deviceSourceEngine = nullptr;
m_deviceUIs.back()->m_deviceSinkEngine = nullptr;

View File

@ -14,6 +14,9 @@ GLSpectrum:
powerRange:
type: number
format: float
fpsPeriodMs:
type: integer
description: FPS capping period in milliseconds. 0 for no limit.
displayWaterfall:
description: boolean
type: integer

View File

@ -4835,6 +4835,10 @@ margin-bottom: 20px;
"type" : "number",
"format" : "float"
},
"fpsPeriodMs" : {
"type" : "integer",
"description" : "FPS capping period in milliseconds. 0 for no limit."
},
"displayWaterfall" : {
"type" : "integer",
"description" : "boolean"
@ -6278,9 +6282,9 @@ margin-bottom: 20px;
"type" : "integer",
"description" : "Angle to rotate the image by"
},
"imageFixedSize" : {
"imageMinZoom" : {
"type" : "integer",
"description" : "Keep the image the same size, regardless of map zoom level (1 for yes, 0 for no)"
"description" : "Minimim zoom value"
},
"text" : {
"type" : "string"
@ -6294,6 +6298,11 @@ margin-bottom: 20px;
"type" : "number",
"format" : "float",
"description" : "Longitude in decimal degrees, positive to the east"
},
"altitude" : {
"type" : "number",
"format" : "float",
"description" : "Altitude / height above sea level in metres"
}
},
"description" : "An item to draw on the map. Set image to an empty string to remove item from the map."
@ -6313,9 +6322,9 @@ margin-bottom: 20px;
"type" : "integer",
"description" : "Angle to rotate the image by"
},
"imageFixedSize" : {
"imageMinZoom" : {
"type" : "integer",
"description" : "Keep the image the same size, regardless of map zoom level (1 for yes, 0 for no)"
"description" : "Minimim zoom value"
},
"text" : {
"type" : "string"
@ -6329,6 +6338,11 @@ margin-bottom: 20px;
"type" : "number",
"format" : "float",
"description" : "Longitude in decimal degrees, positive to the east"
},
"altitude" : {
"type" : "number",
"format" : "float",
"description" : "Altitude / height above sea level in metres"
}
},
"description" : "An item to draw on the map. Set image to an empty string to remove item from the map."
@ -45272,7 +45286,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2021-01-13T17:40:49.583+01:00
Generated 2021-02-11T23:51:16.152+01:00
</div>
</div>
</div>

View File

@ -38,6 +38,8 @@ SWGGLSpectrum::SWGGLSpectrum() {
m_ref_level_isSet = false;
power_range = 0.0f;
m_power_range_isSet = false;
fps_period_ms = 0;
m_fps_period_ms_isSet = false;
display_waterfall = 0;
m_display_waterfall_isSet = false;
inverted_waterfall = 0;
@ -94,6 +96,8 @@ SWGGLSpectrum::init() {
m_ref_level_isSet = false;
power_range = 0.0f;
m_power_range_isSet = false;
fps_period_ms = 0;
m_fps_period_ms_isSet = false;
display_waterfall = 0;
m_display_waterfall_isSet = false;
inverted_waterfall = 0;
@ -156,6 +160,7 @@ SWGGLSpectrum::cleanup() {
if(ws_spectrum_address != nullptr) {
@ -185,6 +190,8 @@ SWGGLSpectrum::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&power_range, pJson["powerRange"], "float", "");
::SWGSDRangel::setValue(&fps_period_ms, pJson["fpsPeriodMs"], "qint32", "");
::SWGSDRangel::setValue(&display_waterfall, pJson["displayWaterfall"], "qint32", "");
::SWGSDRangel::setValue(&inverted_waterfall, pJson["invertedWaterfall"], "qint32", "");
@ -254,6 +261,9 @@ SWGGLSpectrum::asJsonObject() {
if(m_power_range_isSet){
obj->insert("powerRange", QJsonValue(power_range));
}
if(m_fps_period_ms_isSet){
obj->insert("fpsPeriodMs", QJsonValue(fps_period_ms));
}
if(m_display_waterfall_isSet){
obj->insert("displayWaterfall", QJsonValue(display_waterfall));
}
@ -365,6 +375,16 @@ SWGGLSpectrum::setPowerRange(float power_range) {
this->m_power_range_isSet = true;
}
qint32
SWGGLSpectrum::getFpsPeriodMs() {
return fps_period_ms;
}
void
SWGGLSpectrum::setFpsPeriodMs(qint32 fps_period_ms) {
this->fps_period_ms = fps_period_ms;
this->m_fps_period_ms_isSet = true;
}
qint32
SWGGLSpectrum::getDisplayWaterfall() {
return display_waterfall;
@ -575,6 +595,9 @@ SWGGLSpectrum::isSet(){
if(m_power_range_isSet){
isObjectUpdated = true; break;
}
if(m_fps_period_ms_isSet){
isObjectUpdated = true; break;
}
if(m_display_waterfall_isSet){
isObjectUpdated = true; break;
}

View File

@ -57,6 +57,9 @@ public:
float getPowerRange();
void setPowerRange(float power_range);
qint32 getFpsPeriodMs();
void setFpsPeriodMs(qint32 fps_period_ms);
qint32 getDisplayWaterfall();
void setDisplayWaterfall(qint32 display_waterfall);
@ -133,6 +136,9 @@ private:
float power_range;
bool m_power_range_isSet;
qint32 fps_period_ms;
bool m_fps_period_ms_isSet;
qint32 display_waterfall;
bool m_display_waterfall_isSet;