From 73d99023d77e894eb55470c8a2c69787046d0b78 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Thu, 4 Feb 2021 10:27:30 +0000 Subject: [PATCH] Fix for ic7610 wf length and partial sound device selection --- rigcommander.cpp | 6 +++--- wfmain.cpp | 19 ++++++++++++++++++- wfmain.h | 4 +++- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/rigcommander.cpp b/rigcommander.cpp index 53eed07..9d827fc 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -149,6 +149,7 @@ void rigCommander::findRigs() QByteArray data; QByteArray data2; + //data.setRawData("\xFE\xFE\xa2", 3); data.setRawData("\xFE\xFE\x00", 3); data.append(compCivAddr); // wfview's address, 0xE1 data2.setRawData("\x19\x00", 2); // get rig ID @@ -635,9 +636,7 @@ void rigCommander::parseCommand() case '\x19': // qDebug() << "Have rig ID: " << (unsigned int)payloadIn[2]; // printHex(payloadIn, false, true); - model = determineRadioModel(payloadIn[2]); // verify this is the model not the CIV - //model = determineRadioModel(0xa2); //testing by forcing model to 9700. determineRigCaps(); qDebug() << "Have rig ID: decimal: " << (unsigned int)model; @@ -1136,7 +1135,8 @@ void rigCommander::parseSpectrum() if (payloadIn.length() > 400) // Must be a LAN packet. { payloadIn.chop(1); - spectrumLine.append(payloadIn.mid(17,475)); // write over the FD, last one doesn't, oh well. + //spectrumLine.append(payloadIn.mid(17,475)); // write over the FD, last one doesn't, oh well. + spectrumLine.append(payloadIn.right(payloadIn.length()-17)); // write over the FD, last one doesn't, oh well. emit haveSpectrumData(spectrumLine, spectrumStartFreq, spectrumEndFreq); } } else if ((sequence > 1) && (sequence < rigCaps.spectSeqMax)) diff --git a/wfmain.cpp b/wfmain.cpp index 931ee89..068b39a 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -146,7 +146,11 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, QWidget *parent keyM->setKey(Qt::Key_M); connect(keyM, SIGNAL(activated()), this, SLOT(shortcutM())); - + // Enumerate audio devices, need to do before settings are loaded. + const auto deviceInfos = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput); + for (const QAudioDeviceInfo& deviceInfo : deviceInfos) { + ui->audioOutputCombo->addItem(deviceInfo.deviceName()); + } setDefaultColors(); // set of UI colors with defaults populated setDefPrefs(); // other default options loadSettings(); // Look for saved preferences @@ -571,6 +575,13 @@ void wfmain::loadSettings() prefs.password = settings.value("Password", defPrefs.password).toString(); ui->passwordTxt->setEnabled(ui->lanEnableChk->isChecked()); ui->passwordTxt->setText(QString("%1").arg(prefs.password)); + + prefs.audioOutput = settings.value("AudioOutput", defPrefs.audioOutput).toString(); + ui->audioOutputCombo->setEnabled(ui->lanEnableChk->isChecked()); + int audioIndex = ui->audioOutputCombo->findText("prefs.audioOutput"); + if (audioIndex -1) + ui->audioOutputCombo->setCurrentIndex(audioIndex); + settings.endGroup(); // Memory channels @@ -646,6 +657,7 @@ void wfmain::saveSettings() settings.setValue("AudioLANPort", prefs.audioLANPort); settings.setValue("Username", prefs.username); settings.setValue("Password", prefs.password); + settings.setValue("AudioOutput", prefs.audioOutput); settings.endGroup(); // Memory channels @@ -2144,6 +2156,11 @@ void wfmain::on_passwordTxt_textChanged(QString text) prefs.password = text; } +void wfmain::on_audioOutputCombo_currentIndexChanged(QString text) +{ + prefs.audioOutput = text; +} + // --- DEBUG FUNCTION --- void wfmain::on_debugBtn_clicked() { diff --git a/wfmain.h b/wfmain.h index f8fed5c..db8afa7 100644 --- a/wfmain.h +++ b/wfmain.h @@ -251,6 +251,8 @@ private slots: void on_passwordTxt_textChanged(QString text); + void on_audioOutputCombo_currentIndexChanged(QString text); + private: Ui::wfmain *ui; QSettings settings; @@ -385,7 +387,7 @@ private: quint32 audioLANPort; QString username; QString password; - + QString audioOutput; } prefs; preferences defPrefs;