From c2ea38175785d91b5a7ffd96595d8f4ae0c5e37d Mon Sep 17 00:00:00 2001 From: PianetaRadio <78976006+PianetaRadio@users.noreply.github.com> Date: Thu, 27 Apr 2023 20:11:48 +0200 Subject: [PATCH] Disconnect Add meters reset and PTT status check --- mainwindow.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 3122bc6..c275b8a 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -759,11 +759,23 @@ void MainWindow::on_pushButton_Connect_toggled(bool checked) } else if (rigCom.connected) //Button unchecked { - rigCom.connected = 0; - if(timer->isActive()) timer->stop(); - rig_close(my_rig); //Close the communication to the rig - connectMsg = "Disconnected"; - //rig_cleanup(my_rig); //Release rig handle and free associated memory + if (rigSet.ptt == RIG_PTT_OFF) //Disconnect only if PTT off + { + rigCom.connected = 0; + if(timer->isActive()) timer->stop(); + rig_close(my_rig); //Close the communication to the rig + connectMsg = "Disconnected"; + //rig_cleanup(my_rig); //Release rig handle and free associated memory + + //Reset meters + ui->progressBar_Smeter->setValue(-54); + setSubMeter(); + } + else + { + ui->pushButton_Connect->setChecked(false); //Uncheck the button + connectMsg = "Warning PTT on!"; + } } ui->statusbar->showMessage(connectMsg);