From ff4514a196e126fbc68800f0ff39095cf65d1b91 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sun, 16 May 2021 21:34:46 +0100 Subject: [PATCH 1/5] Move manual serial port so linux/mac only --- wfmain.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wfmain.cpp b/wfmain.cpp index 8893c7f..0d615b3 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -175,11 +175,11 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, QWidget *parent portList.append(serialPortInfo.portName()); #if defined(Q_OS_LINUX) || defined(Q_OS_MAC) ui->serialDeviceListCombo->addItem(QString("/dev/")+serialPortInfo.portName(), i++); + ui->serialDeviceListCombo->addItem("Manual...", 256); #else ui->serialDeviceListCombo->addItem(serialPortInfo.portName(), i++); #endif } - ui->serialDeviceListCombo->addItem("Manual...", 256); ui->serialDeviceListCombo->blockSignals(false); ui->vspCombo->blockSignals(true); @@ -374,6 +374,8 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, QWidget *parent qRegisterMetaType(); qRegisterMetaType(); qRegisterMetaType(); + qRegisterMetaType(); + connect(this, SIGNAL(sendPowerOn()), rig, SLOT(powerOn())); connect(this, SIGNAL(sendPowerOff()), rig, SLOT(powerOff())); From e4edda9576100d3eb67e6d2f2f2ce608e0d67bae Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sun, 16 May 2021 21:35:22 +0100 Subject: [PATCH 2/5] register audio metatype in wfmain with all of the others --- udphandler.cpp | 1 - udphandler.h | 1 - wfmain.h | 2 ++ 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/udphandler.cpp b/udphandler.cpp index 0db339a..fb763a6 100644 --- a/udphandler.cpp +++ b/udphandler.cpp @@ -716,7 +716,6 @@ udpAudio::udpAudio(QHostAddress local, QHostAddress ip, quint16 audioPort, quint connect(this, SIGNAL(setupRxAudio(quint8, quint8, quint16, quint16, bool, bool, QString, quint8)), rxaudio, SLOT(init(quint8, quint8, quint16, quint16, bool, bool,QString, quint8))); - qRegisterMetaType(); connect(this, SIGNAL(haveAudioData(audioPacket)), rxaudio, SLOT(incomingAudio(audioPacket))); connect(this, SIGNAL(haveChangeLatency(quint16)), rxaudio, SLOT(changeLatency(quint16))); connect(this, SIGNAL(haveSetVolume(unsigned char)), rxaudio, SLOT(setVolume(unsigned char))); diff --git a/udphandler.h b/udphandler.h index dc4bc48..d06dde9 100644 --- a/udphandler.h +++ b/udphandler.h @@ -308,6 +308,5 @@ private: }; -Q_DECLARE_METATYPE(struct audioPacket) #endif diff --git a/wfmain.h b/wfmain.h index d9f3449..aa89b55 100644 --- a/wfmain.h +++ b/wfmain.h @@ -709,5 +709,7 @@ Q_DECLARE_METATYPE(struct rigStateStruct) Q_DECLARE_METATYPE(enum rigInput) Q_DECLARE_METATYPE(enum meterKind) Q_DECLARE_METATYPE(enum spectrumMode) +Q_DECLARE_METATYPE(struct audioPacket) + #endif // WFMAIN_H From 851c8a6e62486a28937838772aa5595a72405787 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Sun, 16 May 2021 19:45:26 -0700 Subject: [PATCH 3/5] Fixed attenuator on IC-7000 --- rigcommander.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rigcommander.cpp b/rigcommander.cpp index 15f061c..9d51cb7 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -2753,7 +2753,7 @@ void rigCommander::determineRigCaps() rigCaps.hasATU = true; rigCaps.hasCTCSS = true; rigCaps.hasDTCS = true; - rigCaps.attenuators.push_back('\x20'); + rigCaps.attenuators.push_back('\x12'); rigCaps.preamps.push_back('\x01'); rigCaps.bands = standardHF; rigCaps.bands.insert(rigCaps.bands.end(), standardVU.begin(), standardVU.end()); From 7857680845fced15f926f4621645d992d2e308b4 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Tue, 18 May 2021 00:29:06 -0700 Subject: [PATCH 4/5] Changed UI a little, and added manual CI-V options. Seems to work well. --- rigcommander.cpp | 1 + wfmain.cpp | 38 ++++++++++++++++++++-- wfmain.h | 4 +++ wfmain.ui | 82 ++++++++++++++++++++++++++++++++++++++++++------ 4 files changed, 113 insertions(+), 12 deletions(-) diff --git a/rigcommander.cpp b/rigcommander.cpp index 9d51cb7..cf113cb 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -959,6 +959,7 @@ void rigCommander::setCIVAddr(unsigned char civAddr) { // Note: This is the radio's CIV address // the computer's CIV address is defined in the header file. + // TODO: this function *could* be written to re-write the CIV preamble. this->civAddr = civAddr; } diff --git a/wfmain.cpp b/wfmain.cpp index 0d615b3..e1e79a7 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -786,7 +786,7 @@ void wfmain::receiveCommReady() { // tell rigCommander to broadcast a request for all rig IDs. // qInfo(logSystem()) << "Beginning search from wfview for rigCIV (auto-detection broadcast)"; - ui->statusBar->showMessage(QString("Searching CIV bus for connected radios."), 1000); + ui->statusBar->showMessage(QString("Searching CI-V bus for connected radios."), 1000); emit getRigCIV(); cmdOutQue.append(cmdGetRigCIV); delayedCommand->start(); @@ -794,10 +794,10 @@ void wfmain::receiveCommReady() // don't bother, they told us the CIV they want, stick with it. // We still query the rigID to find the model, but at least we know the CIV. qInfo(logSystem()) << "Skipping automatic CIV, using user-supplied value of " << prefs.radioCIVAddr; + showStatusBarText(QString("Using user-supplied radio CI-V address of 0x%1").arg(prefs.radioCIVAddr, 2, 16)); emit getRigID(); getInitialRigState(); } - } @@ -2144,6 +2144,9 @@ void wfmain::receiveRigID(rigCapabilities rigCaps) { return; } else { + + showStatusBarText(QString("Found radio at address 0x%1 of name %2 and model ID %3.").arg(rigCaps.civ,2,16).arg(rigCaps.modelName).arg(rigCaps.modelID)); + qDebug(logSystem()) << "Rig name: " << rigCaps.modelName; qDebug(logSystem()) << "Has LAN capabilities: " << rigCaps.hasLan; qDebug(logSystem()) << "Rig ID received into wfmain: spectLenMax: " << rigCaps.spectLenMax; @@ -4207,6 +4210,37 @@ void wfmain::setBandButtons() } } +void wfmain::on_rigCIVManualAddrChk_clicked(bool checked) +{ + if(checked) + { + ui->rigCIVaddrHexLine->setEnabled(true); + ui->rigCIVaddrHexLine->setText(QString("%1").arg(prefs.radioCIVAddr, 2, 16)); + } else { + ui->rigCIVaddrHexLine->setText("auto"); + ui->rigCIVaddrHexLine->setEnabled(false); + prefs.radioCIVAddr = 0; // auto + showStatusBarText("Setting radio CI-V address to: 'auto'. Make sure CI-V Transceive is enabled on the radio."); + } +} + +void wfmain::on_rigCIVaddrHexLine_editingFinished() +{ + bool okconvert=false; + + unsigned char propCIVAddr = (unsigned char) ui->rigCIVaddrHexLine->text().toUInt(&okconvert, 16); + + if(okconvert && (propCIVAddr < 0x7F) && (propCIVAddr != 0)) + { + prefs.radioCIVAddr = propCIVAddr; + showStatusBarText(QString("Setting radio CI-V address to: 0x%1. Press Save Settings to retain.").arg(propCIVAddr, 2, 16)); + } else { + showStatusBarText(QString("Could not use provided CI-V address.")); + } + +} + + // --- DEBUG FUNCTION --- void wfmain::on_debugBtn_clicked() { diff --git a/wfmain.h b/wfmain.h index aa89b55..ddcf223 100644 --- a/wfmain.h +++ b/wfmain.h @@ -436,6 +436,10 @@ private slots: void on_bandWFMbtn_clicked(); + void on_rigCIVManualAddrChk_clicked(bool checked); + + void on_rigCIVaddrHexLine_editingFinished(); + private: Ui::wfmain *ui; void closeEvent(QCloseEvent *event); diff --git a/wfmain.ui b/wfmain.ui index 1f0cbe5..96f2cec 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -18,7 +18,7 @@ - 0 + 3 @@ -2026,6 +2026,9 @@ + + <html><head/><body><p>Click here to adjust the frequency reference on the IC-9700.</p></body></html> + Adjust Reference @@ -2144,8 +2147,11 @@ + + <html><head/><body><p>Select this option if the rig is pluged into the computer using a USB cable or a serial connection. </p></body></html> + - Enable USB (serial) + Connect over USB (serial) radioConnectionSerialNetworkGrp @@ -2169,6 +2175,57 @@ + + + + <html><head/><body><p>Press here to set up the built-in rig server. The built-in server is intended to allow access over the network to a serial or USB-connected radio. </p></body></html> + + + Server Setup + + + + + + + <html><head/><body><p>If you are using an older (year 2010) radio, you may need to enable this option to manually specify the CI-V address. This option is also useful for radios that do not have CI-V Transceive enabled and thus will not answer our broadcast query for connected rigs on the CI-V bus.</p><p>If you have a modern radio with CI-V Transceive enabled, you should not need to check this box. </p></body></html> + + + Manual Radio CI-V Address: + + + + + + + false + + + + 50 + 0 + + + + + 50 + 16777215 + + + + <html><head/><body><p>Enter the address in as hexidecimal, without any prefix, just as the radio presents the address in the menu. </p><p>Here are some common examples:</p> +IC-706: 58 +<br/>IC-756: 6E +<br/>IC-7000: 70 +<br/>IC-7100: 88 +<br/>IC-7200: 76 +<p>This setting is typically needed for older radios and for radios that do not have CI-V Transceive enabled. </p></body></html> + + + auto + + + @@ -2188,8 +2245,11 @@ + + <html><head/><body><p>Connection to the radio is via network. </p><p>This means you are connecting to a radio with native ethernet or wifi, such as the IC-705, IC-7610, IC-7850, IC-R8600, or IC-9700</p><p>You should also select this option if you are connecting to another instance of wfview over a network. </p></body></html> + - Enable LAN + Connect over LAN radioConnectionSerialNetworkGrp @@ -2198,18 +2258,14 @@ + + Press here to initiate the network connection to the rig. + Connect - - - - Server Setup - - - @@ -2232,6 +2288,9 @@ + + <html><head/><body><p>Use this to define a virtual serial port. </p><p><br/></p><p>On Windows, the virtual serial port can be used to connect to a serial port loopback device, through which other programs can connect to the radio. </p><p><br/></p><p>On Linux and macOS, the port defined here is a pseudo-terminal device, which may be connected to directly by any program designed for a serial connection. </p></body></html> + Virtual Serial Port Selector @@ -2463,6 +2522,9 @@ + + <html><head/><body><p>This button runs debug functions, and is provided as a convenience for programmers. The functions executed are under:</p><p><span style=" color:#ffff55;">void</span><span style=" color:#55ff55;">wfmain</span><span style=" color:#aaaaaa;">::</span><span style=" font-weight:600;">on_debugBtn_clicked</span><span style=" color:#aaaaaa;">()</span></p><p>in wfmain.cpp.</p></body></html> + Debug From b2bce0102842c182253fec306a1da2a6e8b7ee49 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Tue, 18 May 2021 00:35:47 -0700 Subject: [PATCH 5/5] Manual CIV is now read from the preferences and populates the UI accordingly. --- wfmain.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/wfmain.cpp b/wfmain.cpp index e1e79a7..611f919 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -930,6 +930,17 @@ void wfmain::loadSettings() // Radio and Comms: C-IV addr, port to use settings.beginGroup("Radio"); prefs.radioCIVAddr = (unsigned char) settings.value("RigCIVuInt", defPrefs.radioCIVAddr).toInt(); + if(prefs.radioCIVAddr!=0) + { + ui->rigCIVManualAddrChk->setChecked(true); + ui->rigCIVaddrHexLine->blockSignals(true); + ui->rigCIVaddrHexLine->setText(QString("%1").arg(prefs.radioCIVAddr, 2, 16)); + ui->rigCIVaddrHexLine->setEnabled(true); + ui->rigCIVaddrHexLine->blockSignals(false); + } else { + ui->rigCIVManualAddrChk->setChecked(false); + ui->rigCIVaddrHexLine->setEnabled(false); + } prefs.serialPortRadio = settings.value("SerialPortRadio", defPrefs.serialPortRadio).toString(); int serialIndex = ui->serialDeviceListCombo->findText(prefs.serialPortRadio); if (serialIndex != -1) {