diff --git a/CHANGELOG b/CHANGELOG index 68b9f91..0b8b099 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,83 @@ +commit eae5b93f0e404fc15561ad310e39fd3be9d01ccf +Merge: 2128e6f 02c1dcd +Author: Roeland Jansen +Date: Mon Feb 6 10:44:34 2023 +0100 + + Merge branch 'wsjtx-fix' + +commit 02c1dcdb8b2abefe0e78bb53cea4c1e17914746a +Author: Phil Taylor +Date: Sun Feb 5 21:58:49 2023 +0000 + + Request passband at startup + +commit f4e772e1c7903e0d31492917a053e849da38236f +Author: Phil Taylor +Date: Sun Feb 5 21:51:00 2023 +0000 + + Update wfmain.cpp + +commit 4a3f8692b553ad3d5030cf04796fd9f08e966cf6 +Author: Phil Taylor +Date: Sun Feb 5 21:50:24 2023 +0000 + + Update rigState on receipt of new passband from rig. + +commit 2ec62b6c807702fb96bc0a10eaa2614ec7bea5b4 +Author: Phil Taylor +Date: Sun Feb 5 21:43:51 2023 +0000 + + Make CRC hex + +commit 01e01321d397ef812ceb5d2b2c5e97082d99268b +Author: Phil Taylor +Date: Sun Feb 5 21:40:59 2023 +0000 + + This might cause a compile warning? + +commit f0c8842c058c3481463e8b99e542302eaf96b7a5 +Author: Phil Taylor +Date: Sun Feb 5 21:33:02 2023 +0000 + + Actually send the response! + +commit 979dffc1761c5e86821be46b2f16faf5db20c58a +Author: Phil Taylor +Date: Sun Feb 5 21:28:24 2023 +0000 + + Add some more commands + +commit 2128e6fc1080ea7c7a31597e5c23626f97dd4ae4 +Merge: fd86efa 27ac972 +Author: Phil Taylor +Date: Sun Feb 5 20:15:42 2023 +0000 + + Merge branch 'wsjtx-fix' into pbt-color-picker + +commit fd86efa4b90123882d45a2d86474f69784d35dcc +Author: Phil Taylor +Date: Sun Feb 5 13:21:12 2023 +0000 + + Add color picker for PBT + +commit 27ac972f4a1e5a0d9606d74df47d0a490b1298a0 +Author: Phil Taylor +Date: Sun Feb 5 11:30:38 2023 +0000 + + Add support for latest version of wsjt-x to rigctld + +commit bb632b8e2b1115c5e4cf7d56726e6c55046b93a8 +Author: Elliott Liggett +Date: Sat Feb 4 09:57:12 2023 -0800 + + Fixed placement of "out of range" data byte reading. + +commit 11f8cb702ff236f96b40ee1e9b255f97becb1a72 +Author: Roeland Jansen +Date: Sat Feb 4 14:49:58 2023 +0100 + + v1.60 milestone released + commit 82f268508ea210a8a3c89fcc31c7799833cb26ea Merge: a08ada4 a1db8d1 Author: Roeland Jansen diff --git a/rigctld.cpp b/rigctld.cpp index 3bd445c..a6168b3 100644 --- a/rigctld.cpp +++ b/rigctld.cpp @@ -1081,7 +1081,7 @@ void rigCtlClient::socketReadyRead() } else if (command[1] == "LOCK") { - result = rigState->getBool(LOCKFUNC); + result = rigState->getBool(LOCKFUNC); } else { qInfo(logRigCtlD()) << "Unimplemented func:" << command[0] << command[1]; @@ -1227,24 +1227,72 @@ void rigCtlClient::socketReadyRead() else if (command.length() > 0 && (command[0] == '\x88' || command[0] == "get_powerstat")) { - QString resp; - if (longReply && command.length() > 1) { - resp.append(QString("Power Status: ")); - } - resp.append(QString("%1").arg(1)); // Always reply with ON - response.append(resp); - + QString resp; + if (longReply) { + resp.append(QString("Power Status: ")); + } + resp.append(QString("%1").arg(1)); // Always reply with ON + response.append(resp); + } else if (command.length() > 1 && (command[0] == '\x87' || command[0] == "set_powerstat")) { - setCommand = true; - if (command[1] == "0") - { - rigState->set(POWERONOFF, false, true); - } - else { - rigState->set(POWERONOFF, true, true); - } + setCommand = true; + if (command[1] == "0") + { + rigState->set(POWERONOFF, false, true); + } + else { + rigState->set(POWERONOFF, true, true); + } + } + else if (command.length() > 0 && (command[0] == '\xa3' || command[0] == "get_lock_mode")) + { + QString resp; + if (longReply) { + resp.append(QString("Locked: ")); + } + resp.append(QString("%1").arg(0)); // Always reply with RIG_OK (0) + response.append(resp); + } + else if (command.length() > 0 && (command[0] == '\xf5' || command[0] == "get_rig_info")) + { + duplexMode split = rigState->getDuplex(DUPLEX); + quint8 rxa = 1; + quint8 txa = split == 0; + quint8 rxb = !rxa; + quint8 txb = split == 1; + QString resp = QString("VFO=%0 Freq=%1 Mode=%2 Width=%3 RX=%4 TX=%5\nVFO=%6 Freq=%7 Mode=%8 Width=%9 RX=%10 TX=%11\nSplit=%12 SatMode=%13\nRig=%14\nApp=wfview\nVersion=%15\n") + .arg(getVfoName(0)).arg(rigState->getInt64(VFOAFREQ)).arg(getMode(rigState->getChar(MODE), rigState->getBool(DATAMODE))).arg(rigState->getUInt16(PASSBAND)).arg(rxa).arg(txa) + .arg(getVfoName(1)).arg(rigState->getInt64(VFOBFREQ)).arg(getMode(rigState->getChar(MODE), rigState->getBool(DATAMODE))).arg(rigState->getUInt16(PASSBAND)).arg(rxb).arg(txb) + .arg(split).arg(rigState->getChar(SATMODEFUNC)).arg(rigCaps.modelName).arg(WFVIEW_VERSION); + unsigned long crc = doCrc((unsigned char*)resp.toStdString().c_str(), resp.length()); + resp = resp + QString("CRC=0x%0").arg(crc, 8, 16, QLatin1Char('0')); + response.append(resp); + } + else if (command.length() > 0 && (command[0] == "a" || command[0] == "get_trn")) + { + responseCode = -18; //Deprecated + } + else if (command.length() > 0 && (command[0] == "A" || command[0] == "set_trn")) + { + responseCode = -18; //Deprecated + } + else if (command.length() > 0 && (command[0] == "G" || command[0] == "vfo_op")) + { + responseCode = -11; //Not implemented + } + else if (command.length() > 0 && (command[0] == "u" || command[0] == "get_func")) + { + responseCode = -11; //Not implemented + } + else if (command.length() > 0 && (command[0] == "U" || command[0] == "set_func")) + { + responseCode = -11; //Not implemented + } + else if (command.length() > 0 && (command[0] == "_" || command[0] == "get_info")) + { + response.append("None"); } else { qInfo(logRigCtlD()) << "Unimplemented command" << commands; @@ -1549,6 +1597,26 @@ quint8 rigCtlClient::antFromName(QString name) { return ret; } +quint8 rigCtlClient::vfoFromName(QString vfo) { + + if (vfo.toUpper() == "VFOA" || vfo.toUpper() == "MAIN") return 0; + if (vfo.toUpper() == "VFOB" || vfo.toUpper() == "SUB") return 1; + if (vfo.toUpper() == "MEM") return 2; + return 0; +} + +QString rigCtlClient::getVfoName(quint8 vfo) +{ + QString ret; + switch (vfo) { + case 0: ret = "VFOA"; break; + case 1: ret = "VFOB"; break; + default: ret = "MEM"; break; + } + + return ret; +} + int rigCtlClient::getCalibratedValue(quint8 meter,cal_table_t cal) { int interp; @@ -1580,3 +1648,42 @@ int rigCtlClient::getCalibratedValue(quint8 meter,cal_table_t cal) { return cal.table[i].val - interp; } + +unsigned long rigCtlClient::doCrc(unsigned char* p, size_t n) +{ + unsigned long crc = 0xfffffffful; + size_t i; + + if (crcTable[0] == 0) { genCrc(crcTable); } + + for (i = 0; i < n; i++) + { + crc = crcTable[*p++ ^ (crc & 0xff)] ^ (crc >> 8); + } + + return ((~crc) & 0xffffffff); +} + +void rigCtlClient::genCrc(unsigned long crcTable[]) +{ + unsigned long POLYNOMIAL = 0xEDB88320; + unsigned char b = 0; + + while (0 != ++b) + { + unsigned long remainder = b; + unsigned long bit; + for (bit = 8; bit > 0; --bit) + { + if (remainder & 1) + { + remainder = (remainder >> 1) ^ POLYNOMIAL; + } + else + { + remainder = (remainder >> 1); + } + } + crcTable[(size_t)b] = remainder; + } +} \ No newline at end of file diff --git a/rigctld.h b/rigctld.h index d6b87cc..372b09f 100644 --- a/rigctld.h +++ b/rigctld.h @@ -403,6 +403,9 @@ private: rigstate* rigState = Q_NULLPTR; rigCtlD* parent; bool chkVfoEecuted=false; + unsigned long crcTable[256]; + unsigned long doCrc(unsigned char* p, size_t n); + void genCrc(unsigned long crcTable[]); QString getMode(quint8 mode, bool datamode); quint8 getMode(QString modeString); QString getFilter(quint8 mode, quint8 filter); @@ -410,6 +413,9 @@ private: quint64 getRadioModes(QString mode = ""); QString getAntName(quint8 ant); quint8 antFromName(QString name); + quint8 vfoFromName(QString vfo); + QString getVfoName(quint8 vfo); + int getCalibratedValue(quint8 meter,cal_table_t cal); }; diff --git a/wfmain.cpp b/wfmain.cpp index 6df750a..21fdb07 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -3506,6 +3506,7 @@ void wfmain:: getInitialRigState() { issueDelayedCommand(cmdGetSpectrumMode); issueDelayedCommand(cmdGetSpectrumSpan); + issueDelayedCommand(cmdGetPassband); } issueDelayedCommand(cmdNone); @@ -3515,7 +3516,7 @@ void wfmain:: getInitialRigState() { issueDelayedCommand(cmdGetATUStatus); } - + delayedCommand->start(); } @@ -6902,6 +6903,7 @@ void wfmain::receivePassband(quint16 pass) if (passbandWidth != (double)(pass / 1000000.0)) { passbandWidth = (double)(pass / 1000000.0); trxadj->updatePassband(pass); + rigState->set(PASSBAND, pass, false); showStatusBarText(QString("IF filter width %1 Hz").arg(pass)); } } @@ -8198,6 +8200,7 @@ void wfmain::loadColorPresetToUIandPlots(int presetNumber) setEditAndLedFromColor(p.plotBackground, ui->colorEditPlotBackground, ui->colorSwatchPlotBackground); setEditAndLedFromColor(p.tuningLine, ui->colorEditTuningLine, ui->colorSwatchTuningLine); setEditAndLedFromColor(p.passband, ui->colorEditPassband, ui->colorSwatchPassband); + setEditAndLedFromColor(p.pbt, ui->colorEditPBT, ui->colorSwatchPBT); setEditAndLedFromColor(p.meterLevel, ui->colorEditMeterLevel, ui->colorSwatchMeterLevel); setEditAndLedFromColor(p.meterAverage, ui->colorEditMeterAvg, ui->colorSwatchMeterAverage); @@ -8451,6 +8454,7 @@ void wfmain::on_colorSetBtnPassband_clicked() QColor* c = &(colorPreset[pos].passband); setColorButtonOperations(c, ui->colorEditPassband, ui->colorSwatchPassband); } + void wfmain::on_colorEditPassband_editingFinished() { int pos = ui->colorPresetCombo->currentIndex(); @@ -8458,6 +8462,20 @@ void wfmain::on_colorEditPassband_editingFinished() setColorLineEditOperations(c, ui->colorEditPassband, ui->colorSwatchPassband); } +void wfmain::on_colorSetBtnPBT_clicked() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor* c = &(colorPreset[pos].pbt); + setColorButtonOperations(c, ui->colorEditPBT, ui->colorSwatchPBT); +} + +void wfmain::on_colorEditPBT_editingFinished() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor* c = &(colorPreset[pos].pbt); + setColorLineEditOperations(c, ui->colorEditPBT, ui->colorSwatchPBT); +} + // Meter Level: void wfmain::on_colorSetBtnMeterLevel_clicked() { diff --git a/wfmain.h b/wfmain.h index 1087869..3507cfe 100644 --- a/wfmain.h +++ b/wfmain.h @@ -687,6 +687,10 @@ private slots: void on_colorEditPassband_editingFinished(); + void on_colorSetBtnPBT_clicked(); + + void on_colorEditPBT_editingFinished(); + void on_colorSetBtnMeterLevel_clicked(); void on_colorEditMeterLevel_editingFinished(); diff --git a/wfmain.ui b/wfmain.ui index 8ebb962..78f9851 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -18,7 +18,7 @@ - 0 + 3 @@ -1821,7 +1821,6 @@ DejaVu Sans Mono 14 - 75 true @@ -2246,7 +2245,7 @@ - 4 + 1 @@ -3444,8 +3443,8 @@ 0 0 - 570 - 224 + 820 + 302 @@ -3470,8 +3469,8 @@ 6 - - + + 10 @@ -3480,10 +3479,46 @@ - - + + + + + 10 + 0 + + + + + + + + + 90 + 16777215 + + - Text + #AARRGGBB + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Meter Text @@ -3494,20 +3529,59 @@ - - + + - Waterfall Axis + Text - - + + + + + 90 + 16777215 + + - Axis + #AARRGGBB + + + + + 10 + 0 + + + + + + + + + 10 + 0 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + @@ -3518,6 +3592,19 @@ + + + + Qt::Horizontal + + + + 40 + 20 + + + + @@ -3531,6 +3618,133 @@ + + + + Meter Scale + + + + + + + + 90 + 16777215 + + + + Color text format is #AARRGGBB, where AA is the "alpha" channel, and value "00" is totally transparent, and "ff" is totally opaque. + + + #AARRGGBB + + + + + + + + 10 + 0 + + + + + + + + Waterfall Back + + + + + + + Axis + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Plot Background + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Spectrum Line + + + + + + + Spectrum Fill + + + + + + + Underlay Line + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + @@ -3544,10 +3758,13 @@ - - - - Plot Background + + + + + 10 + 0 + @@ -3561,69 +3778,6 @@ - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - Spectrum Line - - - - - - - - 10 - 0 - - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - Waterfall Back - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - @@ -3634,125 +3788,6 @@ - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - Spectrum Fill - - - - - - - Waterfall Grid - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - Underlay Line - - - - - - - - 10 - 0 - - - - - - - - Waterfall Text - - - - - - - - 90 - 16777215 - - - - Color text format is #AARRGGBB, where AA is the "alpha" channel, and value "00" is totally transparent, and "ff" is totally opaque. - - - #AARRGGBB - - - @@ -3763,64 +3798,15 @@ - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 10 - 0 - + + + + Underlay Fill - - - - - 10 - 0 - - - - - - - - - 10 - 0 - - - - - - + + 90 @@ -3832,15 +3818,8 @@ - - - - Meter Text - - - - - + + 10 @@ -3849,8 +3828,15 @@ - - + + + + Tuning Line + + + + + 90 @@ -3862,15 +3848,8 @@ - - - - Meter Scale - - - - - + + 10 @@ -3879,8 +3858,15 @@ - - + + + + Passband + + + + + 90 @@ -3892,22 +3878,25 @@ - - - - Meter High Scale + + + + + 10 + 0 + - - + + - Meter Peak Level + PBT Indicator - - + + 90 @@ -3919,8 +3908,8 @@ - - + + 10 @@ -3929,36 +3918,6 @@ - - - - - 10 - 0 - - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - Meter Average - - - @@ -3989,15 +3948,15 @@ - - + + - Passband + Meter Average - - + + 90 @@ -4009,8 +3968,8 @@ - - + + 10 @@ -4019,15 +3978,15 @@ - - + + - Tuning Line + Meter Peak Level - - + + 90 @@ -4039,8 +3998,8 @@ - - + + 10 @@ -4049,18 +4008,15 @@ - - - - - 10 - 0 - + + + + Meter High Scale - - + + 90 @@ -4072,10 +4028,63 @@ - - + + + + + 10 + 0 + + + + + + - Underlay Fill + Waterfall Grid + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + 10 + 0 + + + + + + + + Waterfall Axis + + + + + + + + 90 + 16777215 + + + + #AARRGGBB @@ -4089,8 +4098,28 @@ - - + + + + Waterfall Text + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + 10 @@ -5455,7 +5484,6 @@ - 50 false @@ -5475,7 +5503,7 @@ 0 0 1042 - 21 + 22 @@ -5502,8 +5530,8 @@ + -