From 88edba70bedf907f190d487fb40776b632ce2805 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Thu, 4 Feb 2021 22:44:15 -0800 Subject: [PATCH] Added fixed/center data from spectrum waterfall data. --- rigcommander.cpp | 8 +++++--- wfmain.cpp | 6 ++++++ wfmain.h | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/rigcommander.cpp b/rigcommander.cpp index 04e13fc..209e600 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -51,6 +51,7 @@ rigCommander::rigCommander(unsigned char rigCivAddr, QString rigSerialPort, quin lookingForRig = false; foundRig = false; + oldScopeMode = 3; // TODO: list full contents of /dev/serial, grep for IC-7300 // /dev/serial/by-path$ ls @@ -96,6 +97,7 @@ rigCommander::rigCommander(unsigned char rigCivAddr, QHostAddress ip, int cport, lookingForRig = false; foundRig = false; + oldScopeMode = 3; payloadSuffix = QByteArray("\xFD"); // TODO: list full contents of /dev/serial, grep for IC-7300 @@ -1103,12 +1105,12 @@ void rigCommander::parseSpectrum() unsigned char sequence = bcdHexToDecimal(payloadIn[03]); //unsigned char sequenceMax = bcdHexToDecimal(payloadIn[04]); - unsigned char scopeMode = bcdHexToDecimal(payloadIn[05]); + unsigned char scopeMode = bcdHexToDecimal(payloadIn[05]); // 0=center, 1=fixed if(scopeMode != oldScopeMode) { - //TODO: - // emit haveNewScopeMode(scopeMode); + //TODO: Figure out if this is the first spectrum, and if so, always emit. + emit haveSpectrumFixedMode(scopeMode==1); oldScopeMode = scopeMode; } diff --git a/wfmain.cpp b/wfmain.cpp index 11d8de2..2047b3d 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -252,6 +252,7 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, QWidget *parent connect(rig, SIGNAL(haveMode(QString)), this, SLOT(receiveMode(QString))); connect(rig, SIGNAL(haveDataMode(bool)), this, SLOT(receiveDataModeStatus(bool))); connect(rig, SIGNAL(haveSpectrumData(QByteArray, double, double)), this, SLOT(receiveSpectrumData(QByteArray, double, double))); + connect(rig, SIGNAL(haveSpectrumFixedMode(bool)), this, SLOT(receiveSpectrumFixedMode(bool))); connect(this, SIGNAL(setFrequency(double)), rig, SLOT(setFrequency(double))); connect(this, SIGNAL(setScopeCenterMode(bool)), rig, SLOT(setSpectrumCenteredMode(bool))); connect(this, SIGNAL(setScopeEdge(char)), rig, SLOT(setScopeEdge(char))); @@ -1365,6 +1366,11 @@ void wfmain::receiveSpectrumData(QByteArray spectrum, double startFreq, double e } } +void wfmain::receiveSpectrumFixedMode(bool isFixed) +{ + ui->scopeCenterModeChk->setChecked(!isFixed); +} + void wfmain::handlePlotDoubleClick(QMouseEvent *me) { double x; diff --git a/wfmain.h b/wfmain.h index db8afa7..54fc0d2 100644 --- a/wfmain.h +++ b/wfmain.h @@ -110,6 +110,7 @@ private slots: void receiveFreq(double); void receiveMode(QString); void receiveSpectrumData(QByteArray spectrum, double startFreq, double endFreq); + void receiveSpectrumFixedMode(bool isFixed); void receivePTTstatus(bool pttOn); void receiveDataModeStatus(bool dataOn); void receiveBandStackReg(float freq, char mode, bool dataOn); // freq, mode, (filter,) datamode