From 14b0ba2151c0fd83a4b1db0db7e12e054e87f339 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Fri, 7 May 2021 14:52:19 -0700 Subject: [PATCH] The band stacking register now uses the newer integer frequency parsing. We also communicate a little slower to the serial rigs, which seems more reliable. --- rigcommander.cpp | 22 +++++++++++++--------- rigcommander.h | 2 +- wfmain.cpp | 16 ++++++++-------- wfmain.h | 2 +- 4 files changed, 23 insertions(+), 19 deletions(-) diff --git a/rigcommander.cpp b/rigcommander.cpp index 8cc731a..03a38e5 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -2133,19 +2133,21 @@ void rigCommander::parseRegister16() void rigCommander::parseBandStackReg() { - // qDebug(logRig()) << "Band stacking register response received: "; - // printHex(payloadIn, false, true); + qDebug(logRig()) << "Band stacking register response received: "; + printHex(payloadIn, false, true); + // Reference output, 20 meters, regCode 01 (latest): // "INDEX: 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 " // "DATA: 1a 01 05 01 60 03 23 14 00 00 03 10 00 08 85 00 08 85 fd " - // char band = payloadIn[2]; - // char regCode = payloadIn[3]; + + //char band = payloadIn[2]; + //char regCode = payloadIn[3]; freqt freqs = parseFrequency(payloadIn, 7); - float freq = (float)freqs.MHzDouble; + //float freq = (float)freqs.MHzDouble; bool dataOn = (payloadIn[11] & 0x10) >> 4; // not sure... char mode = payloadIn[9]; - + char filter = payloadIn[10]; // 09, 10 mode // 11 digit RH: data mode on (1) or off (0) // 11 digit LH: CTCSS 0 = off, 1 = TONE, 2 = TSQL @@ -2154,9 +2156,11 @@ void rigCommander::parseBandStackReg() // 14, 15 tone squelch freq setting // if more, memory name (label) ascii - // qDebug(logRig()) << "band: " << QString("%1").arg(band) << " regCode: " << (QString)regCode << " freq: " << freq; - // qDebug(logRig()) << "mode: " << (QString)mode << " dataOn: " << dataOn; - emit haveBandStackReg(freq, mode, dataOn); + //qDebug(logRig()) << "band: " << QString("%1").arg(band) << " regCode: " << (QString)regCode << " freq float: " << freq; + //qDebug(logRig()) << "mode: " << (QString)mode << " dataOn: " << dataOn; + //qDebug(logRig()) << "Freq Hz: " << freqs.Hz; + + emit haveBandStackReg(freqs, mode, filter, dataOn); } void rigCommander::parseDetailedRegisters1A05() diff --git a/rigcommander.h b/rigcommander.h index 277e7f8..ecab4ba 100644 --- a/rigcommander.h +++ b/rigcommander.h @@ -249,7 +249,7 @@ signals: void haveFrequency(freqt freqStruct); void haveMode(unsigned char mode, unsigned char filter); void haveDataMode(bool dataModeEnabled); - void haveBandStackReg(float freq, char mode, bool dataOn); + void haveBandStackReg(freqt f, char mode, char filter, bool dataOn); void haveRitEnabled(bool ritEnabled); void haveRitFrequency(int ritHz); diff --git a/wfmain.cpp b/wfmain.cpp index 61fed7e..b49e6e9 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -334,7 +334,7 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, QWidget *parent rigName->setFixedWidth(50); delayedCmdIntervalLAN_ms = 10; // interval for regular delayed commands, including initial rig/UI state queries - delayedCmdIntervalSerial_ms = 50; // interval for regular delayed commands, including initial rig/UI state queries + delayedCmdIntervalSerial_ms = 100; // interval for regular delayed commands, including initial rig/UI state queries delayedCmdStartupInterval_ms = 250; // interval for rigID polling delayedCommand = new QTimer(this); delayedCommand->setInterval(delayedCmdStartupInterval_ms); // 250ms until we find rig civ and id, then 100ms. @@ -371,7 +371,7 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, QWidget *parent connect(rig, SIGNAL(havePTTStatus(bool)), this, SLOT(receivePTTstatus(bool))); connect(this, SIGNAL(setPTT(bool)), rig, SLOT(setPTT(bool))); connect(this, SIGNAL(getPTT()), rig, SLOT(getPTT())); - connect(rig, SIGNAL(haveBandStackReg(float,char,bool)), this, SLOT(receiveBandStackReg(float,char,bool))); + connect(rig, SIGNAL(haveBandStackReg(freqt,char,char,bool)), this, SLOT(receiveBandStackReg(freqt,char,char,bool))); connect(this, SIGNAL(setRitEnable(bool)), rig, SLOT(setRitEnable(bool))); connect(this, SIGNAL(setRitValue(int)), rig, SLOT(setRitValue(int))); connect(rig, SIGNAL(haveRitEnabled(bool)), this, SLOT(receiveRITStatus(bool))); @@ -2899,15 +2899,15 @@ void wfmain::on_freqDial_valueChanged(int value) } } -void wfmain::receiveBandStackReg(float freq, char mode, bool dataOn) +void wfmain::receiveBandStackReg(freqt freq, char mode, char filter, bool dataOn) { // read the band stack and apply by sending out commands - freqt f; - f.Hz = freq * 1E6; - setFrequency(f); - int filterSelection = ui->modeFilterCombo->currentData().toInt(); - setMode(mode, (unsigned char)filterSelection); // make sure this is what you think it is + //freqt f; + //f.Hz = freq * 1E6; + setFrequency(freq); + //int filterSelection = ui->modeFilterCombo->currentData().toInt(); + setMode((unsigned char)mode, (unsigned char)filter); // make sure this is what you think it is // setDataMode(dataOn); // signal out if(dataOn) diff --git a/wfmain.h b/wfmain.h index ece9d45..f4fa9ce 100644 --- a/wfmain.h +++ b/wfmain.h @@ -184,7 +184,7 @@ private slots: void receiveSpectrumSpan(freqt freqspan, bool isSub); void receivePTTstatus(bool pttOn); void receiveDataModeStatus(bool dataOn); - void receiveBandStackReg(float freq, char mode, bool dataOn); // freq, mode, (filter,) datamode + void receiveBandStackReg(freqt f, char mode, char filter, bool dataOn); // freq, mode, (filter,) datamode void receiveRITStatus(bool ritEnabled); void receiveRITValue(int ritValHz); void receiveModInput(rigInput input, bool dataOn);