From 23869fdcd2e83018dab11fda299bfee9dd80443f Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Thu, 8 Jul 2021 15:31:35 -0700 Subject: [PATCH 1/5] Changed wording about the need for Save Settings -- please verify, I may have it wrong. --- wfmain.ui | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wfmain.ui b/wfmain.ui index 5a81b1b..d6e6566 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -18,7 +18,7 @@ - 3 + 0 @@ -2678,7 +2678,7 @@ - Please note: Changing CI-V Address, Serial Device, and Baud rate requires pressing "Save Settings", closing wfview, and re-opening. + Please note: Changing the built-in network server requires pressing "Save Settings", closing wfview, and re-opening. From e50b0327165066728cf80b9c2e142fb63a318323 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Fri, 9 Jul 2021 12:02:50 -0700 Subject: [PATCH 2/5] Added time, date, and UTC offset commands. Currently initiated by the debug button. There seems to be a bug in the 7300 where the UTC offset has one hour subtracted, ie, -7 HRS becomes -8 HRS. The hex command appears to be sent correctly. --- rigcommander.cpp | 137 +++++++++++++++++++++++++++++++++++++++++++++++ rigcommander.h | 19 +++++++ wfmain.cpp | 103 ++++++++++++++++++++++++++++++++++- wfmain.h | 22 +++++++- 4 files changed, 278 insertions(+), 3 deletions(-) diff --git a/rigcommander.cpp b/rigcommander.cpp index 6eac210..3ebca4f 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -2020,6 +2020,143 @@ void rigCommander::setRefAdjustFine(unsigned char level) prepDataAndSend(payload); } +void rigCommander::setTime(timekind t) +{ + QByteArray payload; + + switch(rigCaps.model) + { + case model705: + payload.setRawData("\x1A\x05\x01\x66", 4); + break; + case model7300: + payload.setRawData("\x1A\x05\x00\x95", 4); + break; + case model7610: + payload.setRawData("\x1A\x05\x01\x59", 4); + break; + case model7700: + payload.setRawData("\x1A\x05\x00\x59", 4); + break; + case model7850: + payload.setRawData("\x1A\x05\x00\x96", 4); + break; + case model9700: + payload.setRawData("\x1A\x05\x01\x80", 4); + break; + case modelR8600: + payload.setRawData("\x1A\x05\x01\x32", 4); + break; + default: + return; + break; + + } + payload.append(convertNumberToHex(t.hours)); + payload.append(convertNumberToHex(t.minutes)); + //qDebug(logRig()) << "Setting time to this: "; + //printHex(payload); + prepDataAndSend(payload); +} + +void rigCommander::setDate(datekind d) +{ + QByteArray payload; + + switch(rigCaps.model) + { + case model705: + payload.setRawData("\x1A\x05\x01\x65", 4); + break; + case model7300: + payload.setRawData("\x1A\x05\x00\x94", 4); + break; + case model7610: + payload.setRawData("\x1A\x05\x01\x58", 4); + break; + case model7700: + payload.setRawData("\x1A\x05\x00\x58", 4); + break; + case model7850: + payload.setRawData("\x1A\x05\x00\x95", 4); + break; + case model9700: + payload.setRawData("\x1A\x05\x01\x79", 4); + break; + case modelR8600: + payload.setRawData("\x1A\x05\x01\x31", 4); + break; + default: + return; + break; + + } + // YYYYMMDD + payload.append(convertNumberToHex(d.year/100)); // 20 + payload.append(convertNumberToHex(d.year - 100*(d.year/100))); // 21 + payload.append(convertNumberToHex(d.month)); + payload.append(convertNumberToHex(d.day)); + //qDebug(logRig()) << "Setting date to this: "; + //printHex(payload); + prepDataAndSend(payload); +} + +void rigCommander::setUTCOffset(timekind t) +{ + QByteArray payload; + + switch(rigCaps.model) + { + case model705: + payload.setRawData("\x1A\x05\x01\x70", 4); + break; + case model7300: + payload.setRawData("\x1A\x05\x00\x96", 4); + break; + case model7610: + payload.setRawData("\x1A\x05\x01\x62", 4); + break; + case model7700: + payload.setRawData("\x1A\x05\x00\x61", 4); + break; + case model7850: + // Clock 1: + payload.setRawData("\x1A\x05\x00\x99", 4); + break; + case model9700: + payload.setRawData("\x1A\x05\x01\x84", 4); + break; + case modelR8600: + payload.setRawData("\x1A\x05\x01\x35", 4); + break; + default: + return; + break; + + } + payload.append(convertNumberToHex(t.hours)); + payload.append(convertNumberToHex(t.minutes)); + payload.append((unsigned char)t.isMinus); + //qDebug(logRig()) << "Setting UTC Offset to this: "; + //printHex(payload); + prepDataAndSend(payload); +} + +unsigned char rigCommander::convertNumberToHex(unsigned char num) +{ + // Two digit only + if(num > 99) + { + qInfo(logRig()) << "Invalid numeric conversion from num " << num << " to hex."; + return 0xFA; + } + unsigned char result = 0; + result = (num/10) << 4; + result |= (num - 10*(num/10)); + qDebug(logRig()) << "Converting number: " << num << " to hex: " + QString("0x%1").arg(result, 2, 16, QChar('0')); + return result; +} + void rigCommander::sendLevelCmd(unsigned char levAddr, unsigned char level) { QByteArray payload("\x14"); diff --git a/rigcommander.h b/rigcommander.h index d073484..f9dbc8a 100644 --- a/rigcommander.h +++ b/rigcommander.h @@ -41,6 +41,18 @@ struct freqt { double MHzDouble; }; +struct datekind { + uint16_t year; + unsigned char month; + unsigned char day; +}; + +struct timekind { + unsigned char hours; + unsigned char minutes; + bool isMinus; +}; + struct rigStateStruct { freqt vfoAFreq; freqt vfoBFreq; @@ -226,6 +238,12 @@ public slots: void setRefAdjustCourse(unsigned char level); void setRefAdjustFine(unsigned char level); + // Time and Date: + void setTime(timekind t); + void setDate(datekind d); + void setUTCOffset(timekind t); + + // Satellite: void setSatelliteMode(bool enabled); void getSatelliteMode(); @@ -350,6 +368,7 @@ private: QByteArray makeFreqPayload(freqt freq); QByteArray encodeTone(quint16 tone, bool tinv, bool rinv); QByteArray encodeTone(quint16 tone); + unsigned char convertNumberToHex(unsigned char num); quint16 decodeTone(QByteArray eTone); quint16 decodeTone(QByteArray eTone, bool &tinv, bool &rinv); diff --git a/wfmain.cpp b/wfmain.cpp index b39934a..a1ecef1 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -44,6 +44,9 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, const QString s qRegisterMetaType(); qRegisterMetaType(); qRegisterMetaType (); + qRegisterMetaType (); + qRegisterMetaType (); + haveRigCaps = false; @@ -336,6 +339,11 @@ void wfmain::rigConnections() connect(cal, SIGNAL(setRefAdjustCourse(unsigned char)), rig, SLOT(setRefAdjustCourse(unsigned char))); connect(cal, SIGNAL(setRefAdjustFine(unsigned char)), rig, SLOT(setRefAdjustFine(unsigned char))); + // Date and Time: + connect(this, SIGNAL(setTime(timekind)), rig, SLOT(setTime(timekind))); + connect(this, SIGNAL(setDate(datekind)), rig, SLOT(setDate(datekind))); + connect(this, SIGNAL(setUTCOffset(timekind)), rig, SLOT(setUTCOffset(timekind))); + } //void wfmain::removeRigConnections() @@ -834,6 +842,10 @@ void wfmain::setInitialTiming() pttTimer->setInterval(180*1000); // 3 minute max transmit time in ms pttTimer->setSingleShot(true); connect(pttTimer, SIGNAL(timeout()), this, SLOT(handlePttLimit())); + + timeSync = new QTimer(this); + connect(timeSync, SIGNAL(timeout()), this, SLOT(setRadioTimeDateSend())); + waitingToSetTimeDate = false; } void wfmain::setServerToPrefs() @@ -2317,6 +2329,24 @@ void wfmain::doCmd(commandtype cmddata) emit setATU(atuOn); break; } + case cmdSetUTCOffset: + { + timekind u = (*std::static_pointer_cast(data)); + emit setUTCOffset(u); + break; + } + case cmdSetTime: + { + timekind t = (*std::static_pointer_cast(data)); + emit setTime(t); + break; + } + case cmdSetDate: + { + datekind d = (*std::static_pointer_cast(data)); + emit setDate(d); + break; + } default: doCmd(cmd); break; @@ -2608,10 +2638,27 @@ void wfmain::issueCmd(cmds cmd, freqt f) commandtype cmddata; cmddata.cmd = cmd; cmddata.data = std::shared_ptr(new freqt(f)); - //*static_cast(cmddata.data.get()) = f; delayedCmdQue.push_back(cmddata); } +void wfmain::issueCmd(cmds cmd, timekind t) +{ + qDebug(logSystem()) << "Issuing timekind command with data: " << t.hours << " hours, " << t.minutes << " minutes, " << t.isMinus << " isMinus"; + commandtype cmddata; + cmddata.cmd = cmd; + cmddata.data = std::shared_ptr(new timekind(t)); + delayedCmdQue.push_front(cmddata); +} + +void wfmain::issueCmd(cmds cmd, datekind d) +{ + qDebug(logSystem()) << "Issuing datekind command with data: " << d.day << " day, " << d.month << " month, " << d.year << " year."; + commandtype cmddata; + cmddata.cmd = cmd; + cmddata.data = std::shared_ptr(new datekind(d)); + delayedCmdQue.push_front(cmddata); +} + void wfmain::issueCmd(cmds cmd, int i) { commandtype cmddata; @@ -4190,6 +4237,57 @@ void wfmain::on_satOpsBtn_clicked() sat->show(); } +void wfmain::setRadioTimeDatePrep() +{ + if(!waitingToSetTimeDate) + { + // 1: Find the current time and date + QDateTime now = QDateTime::currentDateTime(); + now.setTime(QTime::currentTime()); + + int second = now.time().second(); + + // 2: Find how many mseconds until next minute + int msecdelay = QTime::currentTime().msecsTo( QTime::currentTime().addSecs(60-second) ); + + // 3: Compute time and date at one minute later + QDateTime setpoint = now.addMSecs(msecdelay); // at HMS or posibly HMS + some ms. Never under though. + + // 4: Prepare data structs for the time at one minute later + timesetpoint.hours = (unsigned char)setpoint.time().hour(); + timesetpoint.minutes = (unsigned char)setpoint.time().minute(); + datesetpoint.day = (unsigned char)setpoint.date().day(); + datesetpoint.month = (unsigned char)setpoint.date().month(); + datesetpoint.year = (uint16_t)setpoint.date().year(); + unsigned int utcOffsetSeconds = (unsigned int)abs(setpoint.offsetFromUtc()); + bool isMinus = setpoint.offsetFromUtc() < 0; + utcsetting.hours = utcOffsetSeconds / 60 / 60; + utcsetting.minutes = (utcOffsetSeconds - (utcsetting.hours*60*60) ) / 60; + utcsetting.isMinus = isMinus; + + timeSync->setInterval(msecdelay); + timeSync->setSingleShot(true); + + // 5: start one-shot timer for the delta computed in #2. + timeSync->start(); + waitingToSetTimeDate = true; + showStatusBarText(QString("Setting time, date, and UTC offset for radio in %1 seconds.").arg(msecdelay/1000)); + } +} + +void wfmain::setRadioTimeDateSend() +{ + // Issue priority commands for UTC offset, date, and time + // UTC offset must come first, otherwise the radio may "help" and correct for any changes. + + showStatusBarText(QString("Setting time, date, and UTC offset for radio now.")); + + issueCmd(cmdSetTime, timesetpoint); + issueCmd(cmdSetDate, datesetpoint); + issueCmd(cmdSetUTCOffset, utcsetting); + waitingToSetTimeDate = false; +} + void wfmain::changeSliderQuietly(QSlider *slider, int value) { slider->blockSignals(true); @@ -4946,6 +5044,7 @@ void wfmain::on_pollingBtn_clicked() void wfmain::on_debugBtn_clicked() { qInfo(logSystem()) << "Debug button pressed."; - trxadj->show(); + //trxadj->show(); + setRadioTimeDatePrep(); } diff --git a/wfmain.h b/wfmain.h index d442265..416f003 100644 --- a/wfmain.h +++ b/wfmain.h @@ -125,6 +125,11 @@ signals: void setATU(bool atuEnabled); void getATUStatus(); + // Time and date: + void setTime(timekind t); + void setDate(datekind d); + void setUTCOffset(timekind t); + void getRigID(); // this is the model of the rig void getRigCIV(); // get the rig's CIV addr void spectOutputEnable(); @@ -245,6 +250,9 @@ private slots: void serverConfigRequested(SERVERCONFIG conf, bool store); void receiveBaudRate(quint32 baudrate); + void setRadioTimeDateSend(); + + // void on_getFreqBtn_clicked(); // void on_getModeBtn_clicked(); @@ -591,7 +599,8 @@ private: cmdGetTxPower, cmdSetTxPower, cmdGetMicGain, cmdSetMicGain, cmdSetModLevel, cmdGetSpectrumRefLevel, cmdGetDuplexMode, cmdGetModInput, cmdGetModDataInput, cmdGetCurrentModLevel, cmdStartRegularPolling, cmdStopRegularPolling, cmdQueNormalSpeed, cmdGetVdMeter, cmdGetIdMeter, cmdGetSMeter, cmdGetPowerMeter, cmdGetALCMeter, cmdGetCompMeter, cmdGetTxRxMeter, - cmdGetTone, cmdGetTSQL, cmdGetDTCS, cmdGetRptAccessMode, cmdGetPreamp, cmdGetAttenuator, cmdGetAntenna}; + cmdGetTone, cmdGetTSQL, cmdGetDTCS, cmdGetRptAccessMode, cmdGetPreamp, cmdGetAttenuator, cmdGetAntenna, + cmdSetTime, cmdSetDate, cmdSetUTCOffset}; struct commandtype { cmds cmd; @@ -606,6 +615,8 @@ private: void issueCmd(cmds cmd, freqt f); void issueCmd(cmds cmd, mode_info m); + void issueCmd(cmds cmd, timekind t); + void issueCmd(cmds cmd, datekind d); void issueCmd(cmds cmd, int i); void issueCmd(cmds cmd, unsigned char c); void issueCmd(cmds cmd, char c); @@ -626,6 +637,13 @@ private: bool runPeriodicCommands; bool usingLAN = false; + QTimer *timeSync; + bool waitingToSetTimeDate; + void setRadioTimeDatePrep(); + timekind timesetpoint; + timekind utcsetting; + datekind datesetpoint; + freqMemory mem; struct colors { QColor Dark_PlotBackground; @@ -785,6 +803,8 @@ Q_DECLARE_METATYPE(struct udpPreferences) Q_DECLARE_METATYPE(struct rigStateStruct) Q_DECLARE_METATYPE(struct audioPacket) Q_DECLARE_METATYPE(struct audioSetup) +Q_DECLARE_METATYPE(struct timekind) +Q_DECLARE_METATYPE(struct datekind) Q_DECLARE_METATYPE(enum rigInput) Q_DECLARE_METATYPE(enum meterKind) Q_DECLARE_METATYPE(enum spectrumMode) From b6cac33ee96cb227102a1a2e7718b57e3c3ac234 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Fri, 9 Jul 2021 15:15:04 -0700 Subject: [PATCH 3/5] Added more support for the IC-7600 in rigCaps. --- rigcommander.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/rigcommander.cpp b/rigcommander.cpp index 3ebca4f..628e2f9 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -2937,6 +2937,29 @@ void rigCommander::determineRigCaps() rigCaps.bsr[band2m] = 0x01; rigCaps.modes = commonModes; break; + case model7600: + rigCaps.modelName = QString("IC-7600"); + rigCaps.hasSpectrum = false; + rigCaps.inputs.append(inputACC); + rigCaps.inputs.append(inputUSB); + rigCaps.hasLan = false; + rigCaps.hasEthernet = false; + rigCaps.hasWiFi = false; + rigCaps.hasFDcomms = false; + rigCaps.hasATU = true; + rigCaps.hasCTCSS = false; + rigCaps.hasDTCS = false; + rigCaps.attenuators.insert(rigCaps.attenuators.end(), {0x00, 0x06, 0x12, 0x18}); + rigCaps.preamps.push_back('\x01'); + rigCaps.preamps.push_back('\x02'); + rigCaps.antennas = {0x00, 0x01}; + rigCaps.bands = standardHF; + rigCaps.bands.push_back(bandGen); + rigCaps.bsr[bandGen] = 0x11; + rigCaps.modes = commonModes; + rigCaps.modes.insert(rigCaps.modes.end(), {createMode(modePSK, 0x12, "PSK"), + createMode(modePSK_R, 0x13, "PSK-R")}); + break; case model7610: rigCaps.modelName = QString("IC-7610"); rigCaps.hasSpectrum = true; From 2e9c734b64b3fa70628da839746b463a9ad5a8b8 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Fri, 9 Jul 2021 18:13:11 -0700 Subject: [PATCH 4/5] Added a fix to keep the local frequency in-sync with any recent commands sent to the radio. --- wfmain.cpp | 75 ++++++++++++++++++++++++++++++++---------------------- wfmain.h | 3 +++ 2 files changed, 47 insertions(+), 31 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index a1ecef1..f42d871 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -846,6 +846,7 @@ void wfmain::setInitialTiming() timeSync = new QTimer(this); connect(timeSync, SIGNAL(timeout()), this, SLOT(setRadioTimeDateSend())); waitingToSetTimeDate = false; + lastFreqCmdTime_ms = QDateTime::currentMSecsSinceEpoch() - 5000; // 5 seconds ago } void wfmain::setServerToPrefs() @@ -2264,6 +2265,7 @@ void wfmain::doCmd(commandtype cmddata) { case cmdSetFreq: { + lastFreqCmdTime_ms = QDateTime::currentMSecsSinceEpoch(); freqt f = (*std::static_pointer_cast(data)); emit setFrequency(f); break; @@ -2954,10 +2956,15 @@ void wfmain::insertSlowPeriodicCommand(cmds cmd, unsigned char priority) void wfmain::receiveFreq(freqt freqStruct) { - //qInfo(logSystem()) << "HEY WE GOT A Frequency: " << freqMhz; - ui->freqLabel->setText(QString("%1").arg(freqStruct.MHzDouble, 0, 'f')); - freq = freqStruct; - //showStatusBarText(QString("Frequency: %1").arg(freqMhz)); + qint64 tnow_ms = QDateTime::currentMSecsSinceEpoch(); + if(tnow_ms - lastFreqCmdTime_ms > delayedCommand->interval() * 2) + { + ui->freqLabel->setText(QString("%1").arg(freqStruct.MHzDouble, 0, 'f')); + freq = freqStruct; + } else { + qDebug(logSystem()) << "Rejecting stale frequency: " << freqStruct.Hz << " Hz, delta time ms = " << tnow_ms - lastFreqCmdTime_ms\ + << ", tnow_ms " << tnow_ms << ", last: " << lastFreqCmdTime_ms; + } } void wfmain::receivePTTstatus(bool pttOn) @@ -3101,20 +3108,23 @@ void wfmain::receiveSpectrumMode(spectrumMode spectMode) void wfmain::handlePlotDoubleClick(QMouseEvent *me) { double x; - freqt freq; + freqt freqGo; //double y; //double px; if(!freqLock) { //y = plot->yAxis->pixelToCoord(me->pos().y()); x = plot->xAxis->pixelToCoord(me->pos().x()); - freq.Hz = x*1E6; + freqGo.Hz = x*1E6; - freq.Hz = roundFrequency(freq.Hz, tsWfScrollHz); + freqGo.Hz = roundFrequency(freqGo.Hz, tsWfScrollHz); + freqGo.MHzDouble = (float)freqGo.Hz / 1E6; //emit setFrequency(freq); - issueCmd(cmdSetFreq, freq); - issueDelayedCommand(cmdGetFreq); + issueCmd(cmdSetFreq, freqGo); + freq = freqGo; + setUIFreq(); + //issueDelayedCommand(cmdGetFreq); showStatusBarText(QString("Going to %1 MHz").arg(x)); } } @@ -3122,7 +3132,7 @@ void wfmain::handlePlotDoubleClick(QMouseEvent *me) void wfmain::handleWFDoubleClick(QMouseEvent *me) { double x; - freqt freq; + freqt freqGo; //double y; //x = wf->xAxis->pixelToCoord(me->pos().x()); //y = wf->yAxis->pixelToCoord(me->pos().y()); @@ -3130,13 +3140,15 @@ void wfmain::handleWFDoubleClick(QMouseEvent *me) if(!freqLock) { x = plot->xAxis->pixelToCoord(me->pos().x()); - freq.Hz = x*1E6; + freqGo.Hz = x*1E6; - freq.Hz = roundFrequency(freq.Hz, tsWfScrollHz); + freqGo.Hz = roundFrequency(freqGo.Hz, tsWfScrollHz); + freqGo.MHzDouble = (float)freqGo.Hz / 1E6; //emit setFrequency(freq); - issueCmd(cmdSetFreq, freq); - issueDelayedCommand(cmdGetFreq); + issueCmd(cmdSetFreq, freqGo); + freq = freqGo; + setUIFreq(); showStatusBarText(QString("Going to %1 MHz").arg(x)); } } @@ -3191,7 +3203,7 @@ void wfmain::handleWFScroll(QWheelEvent *we) //emit setFrequency(f); issueCmdUniquePriority(cmdSetFreq, f); ui->freqLabel->setText(QString("%1").arg(f.MHzDouble, 0, 'f')); - issueDelayedCommandUnique(cmdGetFreq); + //issueDelayedCommandUnique(cmdGetFreq); } void wfmain::handlePlotScroll(QWheelEvent *we) @@ -3310,32 +3322,32 @@ void wfmain::on_goFreqBtn_clicked() { freqt f; bool ok = false; - double freq = 0; + double freqDbl = 0; int KHz = 0; if(ui->freqMhzLineEdit->text().contains(".")) { - freq = ui->freqMhzLineEdit->text().toDouble(&ok); + freqDbl = ui->freqMhzLineEdit->text().toDouble(&ok); if(ok) { - f.Hz = freq*1E6; - //emit setFrequency(f); - issueCmd(cmdSetFreq, f); - //issueCmdSetFreq(f); - issueDelayedCommand(cmdGetFreq); + f.Hz = freqDbl*1E6; + issueCmd(cmdSetFreq, f); } } else { KHz = ui->freqMhzLineEdit->text().toInt(&ok); if(ok) { f.Hz = KHz*1E3; - //issueCmdSetFreq(f); - //emit setFrequency(f); issueCmd(cmdSetFreq, f); - issueDelayedCommand(cmdGetFreq); } } + if(ok) + { + f.MHzDouble = (float)f.Hz / 1E6; + freq = f; + setUIFreq(); + } ui->freqMhzLineEdit->selectAll(); freqTextSelected = true; @@ -3615,17 +3627,19 @@ void wfmain::on_freqDial_valueChanged(int value) } } -void wfmain::receiveBandStackReg(freqt freq, char mode, char filter, bool dataOn) +void wfmain::receiveBandStackReg(freqt freqGo, char mode, char filter, bool dataOn) { // read the band stack and apply by sending out commands - qInfo(logSystem()) << __func__ << "BSR received into main: Freq: " << freq.Hz << ", mode: " << (unsigned int)mode << ", filter: " << (unsigned int)filter << ", data mode: " << dataOn; + qInfo(logSystem()) << __func__ << "BSR received into main: Freq: " << freqGo.Hz << ", mode: " << (unsigned int)mode << ", filter: " << (unsigned int)filter << ", data mode: " << dataOn; //emit setFrequency(freq); - issueCmd(cmdSetFreq, freq); + issueCmd(cmdSetFreq, freqGo); setModeVal = (unsigned char) mode; setFilterVal = (unsigned char) filter; issueDelayedCommand(cmdSetModeFilter); + freq = freqGo; + setUIFreq(); if(dataOn) { @@ -3633,8 +3647,8 @@ void wfmain::receiveBandStackReg(freqt freq, char mode, char filter, bool dataOn } else { issueDelayedCommand(cmdSetDataModeOff); } - issueDelayedCommand(cmdGetFreq); - issueDelayedCommand(cmdGetMode); + //issueDelayedCommand(cmdGetFreq); + //issueDelayedCommand(cmdGetMode); ui->tabWidget->setCurrentIndex(0); receiveMode((unsigned char) mode, (unsigned char) filter); // update UI @@ -3856,7 +3870,6 @@ void wfmain::on_fRclBtn_clicked() setModeVal = temp.mode; setFilterVal = ui->modeFilterCombo->currentIndex()+1; // TODO, add to memory issueDelayedCommand(cmdSetModeFilter); - issueDelayedCommand(cmdGetFreq); issueDelayedCommand(cmdGetMode); } else { qInfo(logSystem()) << "Could not recall preset. Valid presets are 0 through 99."; diff --git a/wfmain.h b/wfmain.h index 416f003..2cec6dc 100644 --- a/wfmain.h +++ b/wfmain.h @@ -630,6 +630,8 @@ private: void removeSimilarCommand(cmds cmd); + qint64 lastFreqCmdTime_ms; + int pCmdNum = 0; int delayedCmdIntervalLAN_ms = 100; int delayedCmdIntervalSerial_ms = 100; @@ -637,6 +639,7 @@ private: bool runPeriodicCommands; bool usingLAN = false; + // Radio time sync: QTimer *timeSync; bool waitingToSetTimeDate; void setRadioTimeDatePrep(); From d54562469d53fe66719a710ce2466e80e7bea8cd Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Fri, 9 Jul 2021 23:59:32 -0700 Subject: [PATCH 5/5] Reset PTT timer for control-R keystroke. --- wfmain.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index f42d871..fa4afd5 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -1808,7 +1808,7 @@ void wfmain::shortcutF10() void wfmain::shortcutF12() { - // Speak current frequency and mode via IC-7300 + // Speak current frequency and mode from the radio showStatusBarText("Sending speech command to radio."); emit sayAll(); } @@ -1824,8 +1824,8 @@ void wfmain::shortcutControlT() void wfmain::shortcutControlR() { // Receive - emit setPTT(false); - issueDelayedCommand(cmdGetPTT); + issueCmdUniquePriority(cmdSetPTT, false); + pttTimer->stop(); } void wfmain::shortcutControlI()