From 81f9ddec86424e09273b61c534ff09410f827151 Mon Sep 17 00:00:00 2001 From: PianetaRadio <78976006+PianetaRadio@users.noreply.github.com> Date: Fri, 18 Nov 2022 21:09:44 +0100 Subject: [PATCH] Update GUI when band change --- mainwindow.cpp | 3 +-- rigdaemon.cpp | 39 +++++++++++++++++++++++++++++---------- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index da02a06..558a126 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -337,7 +337,7 @@ void MainWindow::guiUpdate() ui->comboBox_Mode->setCurrentText(rig_strrmode(rigGet.mode)); ui->comboBox_ModeSub->setCurrentText(rig_strrmode(rigGet.modeSub)); - if (guiCmd.tabList) + if (guiCmd.tabList) //Select appropriate mode function tab { if (rigGet.mode == RIG_MODE_SSB || rigGet.mode == RIG_MODE_USB || rigGet.mode == RIG_MODE_LSB) ui->tabWidget->setCurrentIndex(0); //Clarifier tab if (rigGet.mode == RIG_MODE_CW || rigGet.mode == RIG_MODE_CWR || rigGet.mode == RIG_MODE_CWN) ui->tabWidget->setCurrentIndex(1); //CW tab @@ -1096,7 +1096,6 @@ void MainWindow::on_vfoDisplaySubValueChanged(int value) void MainWindow::on_comboBox_Mode_activated(int index) { rigSet.mode = rig_parse_mode(ui->comboBox_Mode->itemText(index).toLatin1()); - guiCmd.tabList = 1; //update tab rigCmd.mode = 1; } diff --git a/rigdaemon.cpp b/rigdaemon.cpp index 5d249e0..81fc6f3 100644 --- a/rigdaemon.cpp +++ b/rigdaemon.cpp @@ -170,7 +170,8 @@ void RigDaemon::rigUpdate() retcode = rig_set_mode(my_rig, RIG_VFO_CURR, rigSet.mode, RIG_PASSBAND_NOCHANGE); if (retcode == RIG_OK) { - guiCmd.bwidthList = 1; //Update BWidth list + guiCmd.bwidthList = 1; //Command update of BW list + guiCmd.tabList = 1; //Command selection of appropriate mode function tab commandPriority = 0; //rig_get_mode(my_rig, RIG_VFO_CURR, &rigGet.mode, &rigGet.bwidth); //Get BW } @@ -280,8 +281,11 @@ void RigDaemon::rigUpdate() retcode = rig_vfo_op(my_rig, RIG_VFO_CURR, RIG_OP_BAND_UP); if (retcode == RIG_OK) { - commandPriority = 0; - guiCmd.bwidthList = 1; + freq_t retfreq; + retcode = rig_get_freq(my_rig, RIG_VFO_CURR, &retfreq); //get VFO Main + if (retcode == RIG_OK) rigGet.freqMain = retfreq; + + commandPriority = 1; } } rigCmd.bandUp = 0; @@ -295,8 +299,11 @@ void RigDaemon::rigUpdate() retcode = rig_vfo_op(my_rig, RIG_VFO_CURR, RIG_OP_BAND_DOWN); if (retcode == RIG_OK) { - commandPriority = 0; - guiCmd.bwidthList = 1; + freq_t retfreq; + retcode = rig_get_freq(my_rig, RIG_VFO_CURR, &retfreq); //get VFO Main + if (retcode == RIG_OK) rigGet.freqMain = retfreq; + + commandPriority = 1; } } rigCmd.bandDown = 0; @@ -309,13 +316,18 @@ void RigDaemon::rigUpdate() { retvalue.i = rigSet.band; retcode = rig_set_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_BAND_SELECT, retvalue); - if (retcode == RIG_OK) rigGet.band = rigSet.band; - qDebug() << retcode << rigCap.bandChange << rigSet.band; - } + if (retcode == RIG_OK) + { + rigGet.band = rigSet.band; + freq_t retfreq; + retcode = rig_get_freq(my_rig, RIG_VFO_CURR, &retfreq); //get VFO Main + if (retcode == RIG_OK) rigGet.freqMain = retfreq; + + commandPriority = 1; + } + } rigCmd.bandChange = 0; - commandPriority = 0; - //guiCmd.bwidthList = 1; } //* Tune @@ -620,9 +632,16 @@ void RigDaemon::rigUpdate() if ((commandPriority == 1 && !rigGet.ptt && rigCom.fullPoll) || commandPriority == 0) { rig_get_mode(my_rig, RIG_VFO_CURR, &rigGet.mode, &rigGet.bwidth); + if (rigGet.bwidth == rig_passband_narrow(my_rig, rigGet.mode)) rigGet.bwNarrow = 1; else rigGet.bwNarrow = 0; + if (rigGet.mode != rigSet.mode) + { + guiCmd.bwidthList = 1; //Command update of BW list + guiCmd.tabList = 1; //Command selection of appropriate mode function tab + } + if (rigCap.modeSub) rig_get_mode(my_rig, rigGet.vfoSub, &rigGet.modeSub, &rigGet.bwidthSub); }