From bd5a233563b6bf1c1e5ac8d84274774f5a13662c Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Sat, 6 Nov 2021 13:10:41 +0100 Subject: [PATCH 01/13] deleted a lingering swapfile from one of my vim sessions --- .swp | Bin 12288 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .swp diff --git a/.swp b/.swp deleted file mode 100644 index fbeaaba9ab9981e852f4edbefe8c4d1a01072e9f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI&%}T>S5C`y7PhM2&3yg|iAff8T2k@YR$JX<-JKav3?v^CBkc&^?gZLaim*Awf z7oiA3!NNa~oy=}_Gx*jlVYbHq^CF9_hT`OY|;%vgHhAC(I z`{^s!!2kpxuug%U_RaOx{82wXI;4YUdz}}<+7N&M1Rwwb2tWV=5P-lx6DTK*ag{ks?3<0uX=z1Rwwb2tWV=5P$##Ah3Y~Y~SlYca!8~&x*J2|I7FPGs{nH zpZ9OzeW7FsKmY;|fB*y_009U<00Izzz#jyjRVXm$Boe5{{f~Ew{drOjgiFb3rr9Np zqm Date: Thu, 18 Nov 2021 14:09:09 +0000 Subject: [PATCH 02/13] Fix silly bug in retransmit code --- udphandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udphandler.cpp b/udphandler.cpp index 161ce92..bcc7a2e 100644 --- a/udphandler.cpp +++ b/udphandler.cpp @@ -1130,7 +1130,7 @@ void udpBase::dataReceived(QByteArray r) if (match == txSeqBuf.end()) { qDebug(logUdp()) << this->metaObject()->className() << ": Requested packet " << hex << seq << " not found"; // Just send idle packet. - sendControl(false, 0, match->seqNum); + sendControl(false, 0, seq); } else { // Found matching entry? From 62771f6b590e5aa46e4a4891d51c662d01978ec4 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Thu, 18 Nov 2021 14:09:09 +0000 Subject: [PATCH 03/13] Fix silly bug in retransmit code --- udphandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udphandler.cpp b/udphandler.cpp index 6ae6333..7e88181 100644 --- a/udphandler.cpp +++ b/udphandler.cpp @@ -1138,7 +1138,7 @@ void udpBase::dataReceived(QByteArray r) if (match == txSeqBuf.end()) { qDebug(logUdp()) << this->metaObject()->className() << ": Requested packet " << hex << seq << " not found"; // Just send idle packet. - sendControl(false, 0, match->seqNum); + sendControl(false, 0, seq); } else { // Found matching entry? From 1a03214f59e574be0006c7860a2c325cf94a59c9 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Thu, 18 Nov 2021 13:12:12 -0800 Subject: [PATCH 04/13] Added size rules for audio source combo boxes. --- wfmain.ui | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/wfmain.ui b/wfmain.ui index f392fd8..b796682 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -6,8 +6,8 @@ 0 0 - 934 - 582 + 941 + 554 @@ -18,7 +18,7 @@ - 3 + 0 @@ -2658,6 +2658,12 @@ + + + 300 + 16777215 + + Audio Output Selector @@ -2672,11 +2678,30 @@ + + + 300 + 16777215 + + Audio Input Selector + + + + Qt::Horizontal + + + + 40 + 20 + + + + @@ -2814,8 +2839,8 @@ 0 0 - 934 - 21 + 941 + 22 From 13af5c0b1ba797a31f86e095da92e8309e837844 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Thu, 18 Nov 2021 13:13:54 -0800 Subject: [PATCH 05/13] A little less green in our gray. --- qdarkstyle/style.qss | 138 +++++++++++++++++++++---------------------- 1 file changed, 69 insertions(+), 69 deletions(-) diff --git a/qdarkstyle/style.qss b/qdarkstyle/style.qss index 399c38d..ee8cc79 100644 --- a/qdarkstyle/style.qss +++ b/qdarkstyle/style.qss @@ -1,5 +1,5 @@ QToolTip { - border: 1px solid #76797C; + border: 1px solid #767676; background-color: #5A7566; color: white; padding: 0px; /*remove padding, for fix combobox tooltip.*/ @@ -8,7 +8,7 @@ QToolTip { QWidget { color: #eff0f1; - background-color: #31363b; + background-color: #313131; selection-background-color: #3daee9; selection-color: #eff0f1; background-clip: border; @@ -34,7 +34,7 @@ QCheckBox { } QCheckBox:disabled { - color: #76797C; + color: #767676; } QCheckBox::indicator, @@ -105,7 +105,7 @@ QRadioButton { } QRadioButton:disabled { - color: #76797C; + color: #767676; } QRadioButton::indicator { @@ -149,7 +149,7 @@ QRadioButton::indicator:unchecked:disabled { } QMenuBar { - background-color: #31363b; + background-color: #313131; color: #eff0f1; } @@ -159,11 +159,11 @@ QMenuBar::item { QMenuBar::item:selected { background: transparent; - border: 1px solid #76797C; + border: 1px solid #767676; } QMenuBar::item:pressed { - border: 1px solid #76797C; + border: 1px solid #767676; background-color: #3daee9; color: #eff0f1; margin-bottom: -1px; @@ -171,7 +171,7 @@ QMenuBar::item:pressed { } QMenu { - border: 1px solid #76797C; + border: 1px solid #767676; color: #eff0f1; margin: 2px; } @@ -248,11 +248,11 @@ QMenu::right-arrow { QWidget:disabled { color: #454545; - background-color: #31363b; + background-color: #313131; } QAbstractItemView { - alternate-background-color: #31363b; + alternate-background-color: #313131; color: #eff0f1; border: 1px solid #3A3939; border-radius: 2px; @@ -274,7 +274,7 @@ QLineEdit { background-color: #232629; padding: 5px; border-style: solid; - border: 1px solid #76797C; + border: 1px solid #767676; border-radius: 2px; color: #eff0f1; } @@ -284,7 +284,7 @@ QAbstractItemView QLineEdit { } QGroupBox { - border: 1px solid #76797C; + border: 1px solid #767676; border-radius: 2px; margin-top: 20px; } @@ -299,7 +299,7 @@ QGroupBox::title { QAbstractScrollArea { border-radius: 2px; - border: 1px solid #76797C; + border: 1px solid #767676; background-color: transparent; } @@ -426,7 +426,7 @@ QScrollBar::sub-page:vertical { QTextEdit { background-color: #232629; color: #eff0f1; - border: 1px solid #76797C; + border: 1px solid #767676; } QPlainTextEdit { @@ -434,14 +434,14 @@ QPlainTextEdit { ; color: #eff0f1; border-radius: 2px; - border: 1px solid #76797C; + border: 1px solid #767676; } QHeaderView::section { - background-color: #76797C; + background-color: #767676; color: #eff0f1; padding: 5px; - border: 1px solid #76797C; + border: 1px solid #767676; } QSizeGrip { @@ -451,24 +451,24 @@ QSizeGrip { } QMainWindow::separator { - background-color: #31363b; + background-color: #313131; color: white; padding-left: 4px; spacing: 2px; - border: 1px dashed #76797C; + border: 1px dashed #767676; } QMainWindow::separator:hover { background-color: #787876; color: white; padding-left: 4px; - border: 1px solid #76797C; + border: 1px solid #767676; spacing: 2px; } QMenu::separator { height: 1px; - background-color: #76797C; + background-color: #767676; color: white; padding-left: 4px; margin-left: 10px; @@ -477,12 +477,12 @@ QMenu::separator { QFrame { border-radius: 2px; - border: 1px solid #76797C; + border: 1px solid #767676; } QFrame[frameShape="0"] { border-radius: 2px; - border: 1px transparent #76797C; + border: 1px transparent #767676; } QStackedWidget { @@ -491,7 +491,7 @@ QStackedWidget { QToolBar { border: 1px transparent #393838; - background: 1px solid #31363b; + background: 1px solid #313131; font-weight: bold; } @@ -512,14 +512,14 @@ QToolBar::separator:vertical { } QToolButton#qt_toolbar_ext_button { - background: #58595a + background: #585858 } QPushButton { color: #eff0f1; - background-color: #31363b; + background-color: #313131; border-width: 1px; - border-color: #76797C; + border-color: #767676; border-style: solid; padding: 5px; border-radius: 2px; @@ -527,7 +527,7 @@ QPushButton { } QPushButton:disabled { - background-color: #31363b; + background-color: #313131; border-width: 1px; border-color: #454545; border-style: solid; @@ -553,14 +553,14 @@ QPushButton:pressed { QComboBox { selection-background-color: #3daee9; border-style: solid; - border: 1px solid #76797C; + border: 1px solid #767676; border-radius: 2px; padding: 5px; min-width: 75px; } QPushButton:checked { - background-color: #76797C; + background-color: #767676; border-color: #6A6969; } @@ -585,7 +585,7 @@ QComboBox:on { QComboBox QAbstractItemView { background-color: #232629; border-radius: 2px; - border: 1px solid #76797C; + border: 1px solid #767676; selection-background-color: #18465d; } @@ -612,7 +612,7 @@ QComboBox::down-arrow:focus { QAbstractSpinBox { padding: 5px; - border: 1px solid #76797C; + border: 1px solid #767676; background-color: #232629; color: #eff0f1; border-radius: 2px; @@ -664,7 +664,7 @@ QTabWidget { } QTabWidget::pane { - border: 1px solid #76797C; + border: 1px solid #767676; padding: 5px; margin: 0px; } @@ -702,9 +702,9 @@ QTabBar::close-button:pressed { QTabBar::tab:top { color: #eff0f1; - border: 1px solid #76797C; + border: 1px solid #767676; border-bottom: 1px transparent black; - background-color: #31363b; + background-color: #313131; padding: 5px; min-width: 50px; border-top-left-radius: 2px; @@ -714,7 +714,7 @@ QTabBar::tab:top { QTabBar::tab:top:selected { color: #eff0f1; background-color: #54575B; - border: 1px solid #76797C; + border: 1px solid #767676; border-bottom: 2px solid #3daee9; border-top-left-radius: 2px; border-top-right-radius: 2px; @@ -729,9 +729,9 @@ QTabBar::tab:top:!selected:hover { QTabBar::tab:bottom { color: #eff0f1; - border: 1px solid #76797C; + border: 1px solid #767676; border-top: 1px transparent black; - background-color: #31363b; + background-color: #313131; padding: 5px; border-bottom-left-radius: 2px; border-bottom-right-radius: 2px; @@ -741,7 +741,7 @@ QTabBar::tab:bottom { QTabBar::tab:bottom:selected { color: #eff0f1; background-color: #54575B; - border: 1px solid #76797C; + border: 1px solid #767676; border-top: 2px solid #3daee9; border-bottom-left-radius: 2px; border-bottom-right-radius: 2px; @@ -756,9 +756,9 @@ QTabBar::tab:bottom:!selected:hover { QTabBar::tab:left { color: #eff0f1; - border: 1px solid #76797C; + border: 1px solid #767676; border-left: 1px transparent black; - background-color: #31363b; + background-color: #313131; padding: 5px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; @@ -768,7 +768,7 @@ QTabBar::tab:left { QTabBar::tab:left:selected { color: #eff0f1; background-color: #54575B; - border: 1px solid #76797C; + border: 1px solid #767676; border-left: 2px solid #3daee9; border-top-right-radius: 2px; border-bottom-right-radius: 2px; @@ -783,9 +783,9 @@ QTabBar::tab:left:!selected:hover { QTabBar::tab:right { color: #eff0f1; - border: 1px solid #76797C; + border: 1px solid #767676; border-right: 1px transparent black; - background-color: #31363b; + background-color: #313131; padding: 5px; border-top-left-radius: 2px; border-bottom-left-radius: 2px; @@ -795,7 +795,7 @@ QTabBar::tab:right { QTabBar::tab:right:selected { color: #eff0f1; background-color: #54575B; - border: 1px solid #76797C; + border: 1px solid #767676; border-right: 2px solid #3daee9; border-top-left-radius: 2px; border-bottom-left-radius: 2px; @@ -822,7 +822,7 @@ QTabBar QToolButton::left-arrow:disabled { } QDockWidget { - background: #31363b; + background: #313131; border: 1px solid #403F3F; titlebar-close-icon: url(:/qss_icons/rc/close.png); titlebar-normal-icon: url(:/qss_icons/rc/undock.png); @@ -848,7 +848,7 @@ QDockWidget::float-button:pressed { QTreeView, QListView { - border: 1px solid #76797C; + border: 1px solid #767676; background-color: #232629; } @@ -980,7 +980,7 @@ QSlider::handle:vertical { QToolButton { background-color: transparent; - border: 1px transparent #76797C; + border: 1px transparent #767676; border-radius: 2px; margin: 3px; padding: 5px; @@ -990,7 +990,7 @@ QToolButton[popupMode="1"] { /* only for MenuButtonPopup */ padding-right: 20px; /* make way for the popup button */ - border: 1px #76797C; + border: 1px #767676; border-radius: 5px; } @@ -998,7 +998,7 @@ QToolButton[popupMode="2"] { /* only for InstantPopup */ padding-right: 10px; /* make way for the popup button */ - border: 1px #76797C; + border: 1px #767676; } QToolButton:hover, @@ -1030,7 +1030,7 @@ QToolButton::menu-indicator { /* the subcontrols below are used only in the MenuButtonPopup mode */ QToolButton::menu-button { - border: 1px transparent #76797C; + border: 1px transparent #767676; border-top-right-radius: 6px; border-bottom-right-radius: 6px; /* 16px width + 4px for border = 20px allocated above */ @@ -1043,7 +1043,7 @@ QToolButton::menu-arrow { } QToolButton::menu-arrow:open { - border: 1px solid #76797C; + border: 1px solid #767676; } QPushButton::menu-indicator { @@ -1053,8 +1053,8 @@ QPushButton::menu-indicator { } QTableView { - border: 1px solid #76797C; - gridline-color: #31363b; + border: 1px solid #767676; + gridline-color: #313131; background-color: #232629; } @@ -1078,7 +1078,7 @@ QListView::item:selected:active { } QHeaderView { - background-color: #31363b; + background-color: #313131; border: 1px transparent; border-radius: 0px; margin: 0px; @@ -1086,17 +1086,17 @@ QHeaderView { } QHeaderView::section { - background-color: #31363b; + background-color: #313131; color: #eff0f1; padding: 5px; - border: 1px solid #76797C; + border: 1px solid #767676; border-radius: 0px; text-align: center; } QHeaderView::section::vertical::first, QHeaderView::section::vertical::only-one { - border-top: 1px solid #76797C; + border-top: 1px solid #767676; } QHeaderView::section::vertical { @@ -1105,7 +1105,7 @@ QHeaderView::section::vertical { QHeaderView::section::horizontal::first, QHeaderView::section::horizontal::only-one { - border-left: 1px solid #76797C; + border-left: 1px solid #767676; } QHeaderView::section::horizontal { @@ -1129,8 +1129,8 @@ QHeaderView::up-arrow { } QTableCornerButton::section { - background-color: #31363b; - border: 1px transparent #76797C; + background-color: #313131; + border: 1px transparent #767676; border-radius: 0px; } @@ -1141,9 +1141,9 @@ QToolBox { QToolBox::tab { color: #eff0f1; - background-color: #31363b; - border: 1px solid #76797C; - border-bottom: 1px transparent #31363b; + background-color: #313131; + border: 1px solid #767676; + border-bottom: 1px transparent #313131; border-top-left-radius: 5px; border-top-right-radius: 5px; } @@ -1151,7 +1151,7 @@ QToolBox::tab { QToolBox::tab:selected { /* italicize selected tabs */ font: italic; - background-color: #31363b; + background-color: #313131; border-color: #3daee9; } @@ -1161,16 +1161,16 @@ QStatusBar::item { QFrame[height="3"], QFrame[width="3"] { - background-color: #76797C; + background-color: #767676; } QSplitter::handle { - border: 1px dashed #76797C; + border: 1px dashed #767676; } QSplitter::handle:hover { background-color: #787876; - border: 1px solid #76797C; + border: 1px solid #767676; } QSplitter::handle:horizontal { @@ -1182,7 +1182,7 @@ QSplitter::handle:vertical { } QProgressBar { - border: 1px solid #76797C; + border: 1px solid #767676; border-radius: 5px; text-align: center; } From 39f07414eecd6a2a20ea92416a78df23b574e325 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Fri, 19 Nov 2021 17:52:18 +0000 Subject: [PATCH 06/13] Add --version command line argument and WFVIEW_VERSION #define --- aboutbox.cpp | 2 +- main.cpp | 13 +++++++++++-- wfview.pro | 2 ++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/aboutbox.cpp b/aboutbox.cpp index a9222b0..dadd943 100644 --- a/aboutbox.cpp +++ b/aboutbox.cpp @@ -12,7 +12,7 @@ aboutbox::aboutbox(QWidget *parent) : ui->logoBtn->setIcon(QIcon(":resources/wfview.png")); ui->logoBtn->setStyleSheet("Text-align:left"); - ui->topText->setText("wfview version 1.2d"); + ui->topText->setText("wfview version " + QString(WFVIEW_VERSION)); QString head = QString(""); QString copyright = QString("Copyright 2017-2021 Elliott H. Liggett, W6EL. All rights reserved. wfview source code is licensed under the GNU GPLv3."); diff --git a/main.cpp b/main.cpp index f98d414..63ffde4 100644 --- a/main.cpp +++ b/main.cpp @@ -37,7 +37,7 @@ int main(int argc, char *argv[]) QString currentArg; - const QString helpText = QString("\nUsage: -p --port /dev/port, -h --host remotehostname, -c --civ 0xAddr, -l --logfile filename.log, -s --settings filename.ini, -d --debug\n"); // TODO... + const QString helpText = QString("\nUsage: -p --port /dev/port, -h --host remotehostname, -c --civ 0xAddr, -l --logfile filename.log, -s --settings filename.ini, -d --debug, -v --version\n"); // TODO... for(int c=1; c Date: Fri, 19 Nov 2021 18:26:45 +0000 Subject: [PATCH 07/13] Fix WFVIEW_VERSION in mac/linux --- main.cpp | 2 +- wfview.pro | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index 63ffde4..ba6229b 100644 --- a/main.cpp +++ b/main.cpp @@ -102,7 +102,7 @@ int main(int argc, char *argv[]) #ifdef Q_OS_WIN QMessageBox::information(0, "wfview version", QString(WFVIEW_VERSION)); #else - std::cout << "wfview version: " << QString(WFVIEW_VERSION).toStdString(); + std::cout << "wfview version: " << QString(WFVIEW_VERSION).toStdString() << "\n"; #endif return 0; } else { diff --git a/wfview.pro b/wfview.pro index f1d18df..95862aa 100644 --- a/wfview.pro +++ b/wfview.pro @@ -11,7 +11,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport TARGET = wfview TEMPLATE = app -DEFINES += WFVIEW_VERSION=\"1.2d\" +DEFINES += WFVIEW_VERSION=\\\"1.2d\\\" CONFIG(debug, release|debug) { # For Debug builds only: From b0ffc94ff977d74b9c774dad00ed2a8d2183b825 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Fri, 19 Nov 2021 18:48:15 +0000 Subject: [PATCH 08/13] Add more version info --- main.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/main.cpp b/main.cpp index ba6229b..bae6e35 100644 --- a/main.cpp +++ b/main.cpp @@ -38,6 +38,11 @@ int main(int argc, char *argv[]) const QString helpText = QString("\nUsage: -p --port /dev/port, -h --host remotehostname, -c --civ 0xAddr, -l --logfile filename.log, -s --settings filename.ini, -d --debug, -v --version\n"); // TODO... + const QString version = QString("wfview version: %1 (Git:%2 on %3 at %4 by %5@%6)\nOperating System: %7 (%8)\nBuild Qt Version %9. Current Qt Version: %10\n") + .arg(QString(WFVIEW_VERSION)) + .arg(GITSHORT).arg(__DATE__).arg(__TIME__).arg(UNAME).arg(HOST) + .arg(QSysInfo::prettyProductName()).arg(QSysInfo::buildCpuArchitecture()) + .arg(QT_VERSION_STR).arg(qVersion()); for(int c=1; c Date: Fri, 19 Nov 2021 20:50:53 +0100 Subject: [PATCH 09/13] changed debug command --- wfmain.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index ff1011f..c579b50 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -5500,8 +5500,8 @@ void wfmain::on_debugBtn_clicked() { qInfo(logSystem()) << "Debug button pressed."; // issueDelayedCommand(cmdGetRigID); - emit getRigCIV(); - //trxadj->show(); + //emit getRigCIV(); + trxadj->show(); //setRadioTimeDatePrep(); //wf->setInteraction(QCP::iRangeZoom, true); //wf->setInteraction(QCP::iRangeDrag, true); From ee6889d163ceba36264aff757704134c2c14e4cf Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Mon, 22 Nov 2021 10:37:21 +0000 Subject: [PATCH 10/13] Add mutex within rigState to protect access --- rigcommander.cpp | 71 +++++++++++++++++++++++++++++++++++++++++++++++- rigcommander.h | 3 ++ rigctld.cpp | 2 ++ 3 files changed, 75 insertions(+), 1 deletion(-) diff --git a/rigcommander.cpp b/rigcommander.cpp index 1c3ecd6..ed75bf9 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -22,6 +22,8 @@ rigCommander::rigCommander() { + rigState.mutex = new QMutex(); + QMutexLocker locker(rigState.mutex); rigState.filter = 0; rigState.mode = 0; rigState.ptt = 0; @@ -33,6 +35,7 @@ rigCommander::rigCommander() rigCommander::~rigCommander() { closeComm(); + delete rigState.mutex; } @@ -569,12 +572,16 @@ void rigCommander::setFrequency(unsigned char vfo, freqt freq) cmdPayload.append(freqPayload); if (vfo == 0) { + rigState.mutex->lock(); rigState.vfoAFreq = freq; + rigState.mutex->unlock(); cmdPayload.prepend('\x00'); } else { + rigState.mutex->lock(); rigState.vfoBFreq = freq; + rigState.mutex->unlock(); cmdPayload.prepend(vfo); cmdPayload.prepend('\x25'); } @@ -702,6 +709,8 @@ void rigCommander::setMode(mode_info m) payload.append(m.filter); prepDataAndSend(payload); + + QMutexLocker locker(rigState.mutex); rigState.mode = m.reg; rigState.filter = m.filter; } @@ -733,6 +742,7 @@ void rigCommander::setMode(unsigned char mode, unsigned char modeFilter) } prepDataAndSend(payload); + QMutexLocker locker(rigState.mutex); rigState.mode = mode; rigState.filter = modeFilter; @@ -753,6 +763,7 @@ void rigCommander::setDataMode(bool dataOn, unsigned char filter) payload.append("\x00\x00", 2); // data mode off, bandwidth not defined per ICD. } prepDataAndSend(payload); + QMutexLocker locker(rigState.mutex); rigState.datamode = dataOn; } @@ -1020,6 +1031,7 @@ void rigCommander::setPTT(bool pttOn) QByteArray payload("\x1C\x00", 2); payload.append((char)pttOn); prepDataAndSend(payload); + QMutexLocker locker(rigState.mutex); rigState.ptt = pttOn; } } @@ -1241,16 +1253,22 @@ void rigCommander::parseCommand() break; case '\x0F': emit haveDuplexMode((duplexMode)(unsigned char)payloadIn[1]); + rigState.mutex->lock(); rigState.duplex = (duplexMode)(unsigned char)payloadIn[1]; + rigState.mutex->unlock(); break; case '\x11': emit haveAttenuator((unsigned char)payloadIn.at(1)); + rigState.mutex->lock(); rigState.attenuator = (unsigned char)payloadIn.at(1); + rigState.mutex->unlock(); break; case '\x12': emit haveAntenna((unsigned char)payloadIn.at(1), (bool)payloadIn.at(2)); + rigState.mutex->lock(); rigState.antenna = (unsigned char)payloadIn.at(1); rigState.rxAntenna = (bool)payloadIn.at(2); + rigState.mutex->unlock(); break; case '\x14': // read levels @@ -1346,7 +1364,6 @@ void rigCommander::parseLevels() // "INDEX: 00 01 02 03 04 " // "DATA: 14 02 00 78 fd " - if(payloadIn[0] == '\x14') { switch(payloadIn[1]) @@ -1355,18 +1372,24 @@ void rigCommander::parseLevels() // AF level - ignore if LAN connection. if (udp == Q_NULLPTR) { emit haveAfGain(level); + rigState.mutex->lock(); rigState.afGain = level; + rigState.mutex->unlock(); } break; case '\x02': // RX RF Gain emit haveRfGain(level); + rigState.mutex->lock(); rigState.rfGain = level; + rigState.mutex->unlock(); break; case '\x03': // Squelch level emit haveSql(level); + rigState.mutex->lock(); rigState.squelch = level; + rigState.mutex->unlock(); break; case '\x07': // Twin BPF Inner, or, IF-Shift level @@ -1385,12 +1408,16 @@ void rigCommander::parseLevels() case '\x0A': // TX RF level emit haveTxPower(level); + rigState.mutex->lock(); rigState.txPower = level; + rigState.mutex->unlock(); break; case '\x0B': // Mic Gain emit haveMicGain(level); + rigState.mutex->lock(); rigState.micGain = level; + rigState.mutex->unlock(); break; case '\x0C': // CW Keying Speed - ignore for now @@ -1401,7 +1428,9 @@ void rigCommander::parseLevels() case '\x0E': // compressor level emit haveCompLevel(level); + rigState.mutex->lock(); rigState.compLevel = level; + rigState.mutex->unlock(); break; case '\x12': // NB level - ignore for now @@ -1409,17 +1438,23 @@ void rigCommander::parseLevels() case '\x15': // monitor level emit haveMonitorLevel(level); + rigState.mutex->lock(); rigState.monitorLevel = level; + rigState.mutex->unlock(); break; case '\x16': // VOX gain emit haveVoxGain(level); + rigState.mutex->lock(); rigState.voxGain = level; + rigState.mutex->unlock(); break; case '\x17': // anti-VOX gain emit haveAntiVoxGain(level); + rigState.mutex->lock(); rigState.antiVoxGain = level; + rigState.mutex->unlock(); break; default: @@ -1437,42 +1472,58 @@ void rigCommander::parseLevels() case '\x02': // S-Meter emit haveMeter(meterS, level); + rigState.mutex->lock(); rigState.sMeter = level; + rigState.mutex->unlock(); break; case '\x04': // Center (IC-R8600) emit haveMeter(meterCenter, level); + rigState.mutex->lock(); rigState.sMeter = level; + rigState.mutex->unlock(); break; case '\x11': // RF-Power meter emit haveMeter(meterPower, level); + rigState.mutex->lock(); rigState.powerMeter = level; + rigState.mutex->unlock(); break; case '\x12': // SWR emit haveMeter(meterSWR, level); + rigState.mutex->lock(); rigState.swrMeter = level; + rigState.mutex->unlock(); break; case '\x13': // ALC emit haveMeter(meterALC, level); + rigState.mutex->lock(); rigState.alcMeter = level; + rigState.mutex->unlock(); break; case '\x14': // COMP dB reduction emit haveMeter(meterComp, level); + rigState.mutex->lock(); rigState.compMeter = level; + rigState.mutex->unlock(); break; case '\x15': // VD (12V) emit haveMeter(meterVoltage, level); + rigState.mutex->lock(); rigState.voltageMeter = level; + rigState.mutex->unlock(); break; case '\x16': // ID emit haveMeter(meterCurrent, level); + rigState.mutex->lock(); rigState.currentMeter = level; + rigState.mutex->unlock(); break; default: @@ -2379,6 +2430,7 @@ void rigCommander::parsePTT() // PTT on emit havePTTStatus(true); } + QMutexLocker locker(rigState.mutex); rigState.ptt = (bool)payloadIn[2]; } @@ -2398,6 +2450,7 @@ void rigCommander::parseRegisters1A() // "INDEX: 00 01 02 03 04 " // "DATA: 1a 06 01 03 fd " (data mode enabled, filter width 3 selected) + QMutexLocker locker(rigState.mutex); switch(payloadIn[01]) { @@ -2440,24 +2493,32 @@ void rigCommander::parseRegister1B() // "Repeater tone" tone = decodeTone(payloadIn); emit haveTone(tone); + rigState.mutex->lock(); rigState.ctcss = tone; + rigState.mutex->unlock(); break; case '\x01': // "TSQL tone" tone = decodeTone(payloadIn); emit haveTSQL(tone); + rigState.mutex->lock(); rigState.tsql = tone; + rigState.mutex->unlock(); break; case '\x02': // DTCS (DCS) tone = decodeTone(payloadIn, tinv, rinv); emit haveDTCS(tone, tinv, rinv); + rigState.mutex->lock(); rigState.dtcs = tone; + rigState.mutex->unlock(); break; case '\x07': // "CSQL code (DV mode)" tone = decodeTone(payloadIn); + rigState.mutex->lock(); rigState.csql = tone; + rigState.mutex->unlock(); break; default: break; @@ -2469,6 +2530,7 @@ void rigCommander::parseRegister16() //"INDEX: 00 01 02 03 " //"DATA: 16 5d 00 fd " // ^-- mode info here + switch(payloadIn.at(1)) { case '\x5d': @@ -2477,7 +2539,9 @@ void rigCommander::parseRegister16() case '\x02': // Preamp emit havePreamp((unsigned char)payloadIn.at(2)); + rigState.mutex->lock(); rigState.preamp = (unsigned char)payloadIn.at(2); + rigState.mutex->unlock(); break; default: break; @@ -3790,7 +3854,10 @@ void rigCommander::parseFrequency() freq.MHzDouble = frequencyMhz; + rigState.mutex->lock(); rigState.vfoAFreq = freq; + rigState.mutex->unlock(); + emit haveFrequency(freq); } @@ -3868,8 +3935,10 @@ void rigCommander::parseMode() } else { filter = 0; } + rigState.mutex->lock(); rigState.mode = (unsigned char)payloadIn[01]; rigState.filter = filter; + rigState.mutex->unlock(); emit haveMode((unsigned char)payloadIn[01], filter); } diff --git a/rigcommander.h b/rigcommander.h index 2b18c36..90550e0 100644 --- a/rigcommander.h +++ b/rigcommander.h @@ -2,6 +2,8 @@ #define RIGCOMMANDER_H #include +#include +#include #include #include "commhandler.h" @@ -60,6 +62,7 @@ struct timekind { }; struct rigStateStruct { + QMutex *mutex; freqt vfoAFreq; freqt vfoBFreq; unsigned char currentVfo; diff --git a/rigctld.cpp b/rigctld.cpp index c7a8595..c456cbd 100644 --- a/rigctld.cpp +++ b/rigctld.cpp @@ -175,6 +175,8 @@ void rigCtlClient::socketReadyRead() QStringList command = commandBuffer.mid(num).split(" "); + QMutexLocker locker(rigState->mutex); + if (command[0] == 0xf0 || command[0] == "chk_vfo") { QString resp; From 104b3955452767f75172c7750a7ce3f6f27c1b2e Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Fri, 26 Nov 2021 18:05:32 +0100 Subject: [PATCH 11/13] missing space --- transceiveradjustments.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transceiveradjustments.cpp b/transceiveradjustments.cpp index 309cd43..8298bb8 100644 --- a/transceiveradjustments.cpp +++ b/transceiveradjustments.cpp @@ -47,7 +47,7 @@ void transceiverAdjustments::on_IFShiftSlider_valueChanged(int value) unsigned char outer = ui->TPBFOuterSlider->value(); int shift = value - previousIFShift; inner = qMax( 0, qMin(255,int (inner + shift)) ); - outer =qMax( 0, qMin(255,int (outer + shift)) ); + outer = qMax( 0, qMin(255,int (outer + shift)) ); ui->TPBFInnerSlider->setValue(inner); ui->TPBFOuterSlider->setValue(outer); From f67bed583226c01feb67ca77041865cec87f11f5 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Wed, 1 Dec 2021 10:13:21 +0000 Subject: [PATCH 12/13] Disable certain TX commands for RX only rigs --- wfmain.cpp | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index c579b50..664a4b8 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -2232,13 +2232,21 @@ void wfmain:: getInitialRigState() issueDelayedCommand(cmdGetMode); // From left to right in the UI: - issueDelayedCommand(cmdGetDataMode); - issueDelayedCommand(cmdGetModInput); - issueDelayedCommand(cmdGetModDataInput); + if (rigCaps.hasTransmit) + { + issueDelayedCommand(cmdGetDataMode); + issueDelayedCommand(cmdGetModInput); + issueDelayedCommand(cmdGetModDataInput); + } issueDelayedCommand(cmdGetRxGain); issueDelayedCommand(cmdGetAfGain); issueDelayedCommand(cmdGetSql); - issueDelayedCommand(cmdGetTxPower); + + if (rigCaps.hasTransmit) + { + issueDelayedCommand(cmdGetTxPower); + } + issueDelayedCommand(cmdGetCurrentModLevel); // level for currently selected mod sources issueDelayedCommand(cmdGetSpectrumRefLevel); issueDelayedCommand(cmdGetDuplexMode); @@ -2248,8 +2256,12 @@ void wfmain:: getInitialRigState() issueDelayedCommand(cmdDispEnable); issueDelayedCommand(cmdSpecOn); } - issueDelayedCommand(cmdGetModInput); - issueDelayedCommand(cmdGetModDataInput); + + if (rigCaps.hasTransmit) + { + issueDelayedCommand(cmdGetModInput); + issueDelayedCommand(cmdGetModDataInput); + } if(rigCaps.hasCTCSS) { @@ -3522,8 +3534,10 @@ void wfmain::receiveMode(unsigned char mode, unsigned char filter) // Note: we need to know if the DATA mode is active to reach mode-D // some kind of queued query: - if(rigCaps.hasDataModes) + if (rigCaps.hasDataModes && rigCaps.hasTransmit) + { issueDelayedCommand(cmdGetDataMode); + } } void wfmain::receiveDataModeStatus(bool dataEnabled) From b1ef680dbf71edefbbef63125acc754df46dc499 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Wed, 1 Dec 2021 10:21:40 +0000 Subject: [PATCH 13/13] Another "minor" update for RX only rigs --- wfmain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wfmain.cpp b/wfmain.cpp index 664a4b8..4e24eac 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -2245,9 +2245,9 @@ void wfmain:: getInitialRigState() if (rigCaps.hasTransmit) { issueDelayedCommand(cmdGetTxPower); + issueDelayedCommand(cmdGetCurrentModLevel); // level for currently selected mod sources } - issueDelayedCommand(cmdGetCurrentModLevel); // level for currently selected mod sources issueDelayedCommand(cmdGetSpectrumRefLevel); issueDelayedCommand(cmdGetDuplexMode);