From 7d8cc5807025eb069b118c9f387abf6091236728 Mon Sep 17 00:00:00 2001 From: Arash Aletayeb Date: Wed, 6 Dec 2023 13:39:09 +0330 Subject: [PATCH] Bug fixing --- developHw.pro.user | 2 +- mainwindow.cpp | 175 ++++++++++----------------------------------- mainwindow.h | 2 +- 3 files changed, 38 insertions(+), 141 deletions(-) diff --git a/developHw.pro.user b/developHw.pro.user index 7b2133d..5923cef 100644 --- a/developHw.pro.user +++ b/developHw.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/mainwindow.cpp b/mainwindow.cpp index 5957c50..902b12c 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -758,9 +758,9 @@ void MainWindow::getPrbChange() QtConcurrent::run(this, &MainWindow::getProbeColor, Qt::red, 0); } } - catch(const char* exception) + catch(SonoException& e) { - qDebug() << exception; + qDebug() << e.what(); } try @@ -796,9 +796,9 @@ void MainWindow::getPrbChange() QtConcurrent::run(this, &MainWindow::getProbeColor, Qt::red, 1); } } - catch(const char* exception) + catch(SonoException& e) { - qDebug() << exception; + qDebug() << e.what(); } try @@ -834,9 +834,9 @@ void MainWindow::getPrbChange() QtConcurrent::run(this, &MainWindow::getProbeColor, Qt::red, 2); } } - catch(const char* exception) + catch(SonoException& e) { - qDebug() << exception; + qDebug() << e.what(); } try @@ -872,9 +872,9 @@ void MainWindow::getPrbChange() QtConcurrent::run(this, &MainWindow::getProbeColor, Qt::red, 3); } } - catch(const char* exception) + catch(SonoException& e) { - qDebug() << exception; + qDebug() << e.what(); } } @@ -1418,6 +1418,11 @@ void MainWindow::on_cb_selectedProbe_currentIndexChanged(int index) { on_btn_scenStart_clicked(); } + else if(ui->chk_powerAo->isChecked()) + { + on_chk_powerAo_clicked(false); + ui->chk_powerAo->setChecked(false); + } if(indx == 0) { @@ -1573,7 +1578,7 @@ void MainWindow::on_chk_continuousShowing_clicked() } /*************************************************************************************************/ -bool MainWindow::scenarioStartPermission() +bool MainWindow::hvPermission() { bool permission(false); @@ -1582,7 +1587,6 @@ bool MainWindow::scenarioStartPermission() _trx.supervisorRbValue(_supRbValue); auto hvapValue = _supRbValue->hvap; - qDebug() << hvapValue; if(hvapValue >= 3.0f) { @@ -1665,7 +1669,7 @@ void MainWindow::on_btn_scenStart_clicked() { _trx.powerAo(true); delay(100); - if(scenarioStartPermission()) + if(hvPermission()) { _trx.preSubBatch = -1; _trx.preBatch = 0; @@ -2368,6 +2372,19 @@ void MainWindow::on_btn_setAo_clicked() try { _trx.mpsSetAo(hvaValue, hvbValue); + + if(!hvPermission()) + { + if(_trx.isScenarioStart()) + { + on_btn_scenStart_clicked(); + } + else + { + on_chk_powerAo_clicked(false); + ui->chk_powerAo->setChecked(false); + } + } } catch(SonoException& e) { @@ -3128,10 +3145,6 @@ void MainWindow::on_btn_trxRomId_clicked() ui->tb_trxRomId->setText(idStr); } } - catch(const char* exception) - { - qDebug() << exception; - } catch(SonoException& e) { qDebug() << e.what(); @@ -3165,10 +3178,6 @@ void MainWindow::on_btn_trxRomPid_clicked() ui->tb_trxRomPid->setText(pidStr); } } - catch(const char* exception) - { - qDebug() << exception; - } catch(SonoException& e) { qDebug() << e.what(); @@ -3202,10 +3211,6 @@ void MainWindow::on_btn_trxRomPcbVersion_clicked() ui->tb_trxRomPcbVersion->setText(pcbVersionStr); } } - catch(const char* exception) - { - qDebug() << exception; - } catch(SonoException& e) { qDebug() << e.what(); @@ -3239,10 +3244,6 @@ void MainWindow::on_btn_trxRomSerialNumber_clicked() ui->tb_trxRomSerialNumber->setText(serialNoStr); } } - catch(const char* exception) - { - qDebug() << exception; - } catch(SonoException& e) { qDebug() << e.what(); @@ -3276,10 +3277,6 @@ void MainWindow::on_btn_trxRomMasterCodeVersion_clicked() ui->tb_trxRomMasterCodeVersion->setText(firstMbedStr); } } - catch(const char* exception) - { - qDebug() << exception; - } catch(SonoException& e) { qDebug() << e.what(); @@ -3313,10 +3310,6 @@ void MainWindow::on_btn_trxRomSlaveCodeVersion_clicked() ui->tb_trxRomSlaveCodeVersion->setText(secondMbedStr); } } - catch(const char* exception) - { - qDebug() << exception; - } catch(SonoException& e) { qDebug() << e.what(); @@ -3401,10 +3394,6 @@ void MainWindow::on_btn_mpsRomId_clicked() ui->tb_mpsRomId->setText(idStr); } } - catch(const char* exception) - { - qDebug() << exception; - } catch(SonoException& e) { qDebug() << e.what(); @@ -3438,10 +3427,6 @@ void MainWindow::on_btn_mpsRomPid_clicked() ui->tb_mpsRomPid->setText(pidStr); } } - catch(const char* exception) - { - qDebug() << exception; - } catch(SonoException& e) { qDebug() << e.what(); @@ -3475,10 +3460,6 @@ void MainWindow::on_btn_mpsRomPcbVersion_clicked() ui->tb_mpsRomPcbVersion->setText(pcbVersionStr); } } - catch(const char* exception) - { - qDebug() << exception; - } catch(SonoException& e) { qDebug() << e.what(); @@ -3512,10 +3493,6 @@ void MainWindow::on_btn_mpsRomSerialNumber_clicked() ui->tb_mpsRomSerialNumber->setText(serialNoStr); } } - catch(const char* exception) - { - qDebug() << exception; - } catch(SonoException& e) { qDebug() << e.what(); @@ -3549,10 +3526,6 @@ void MainWindow::on_btn_mpsRomUcCodeVersion_clicked() ui->tb_mpsRomUcCodeVersion->setText(firstMbedStr); } } - catch(const char* exception) - { - qDebug() << exception; - } catch(SonoException& e) { qDebug() << e.what(); @@ -3586,10 +3559,6 @@ void MainWindow::on_btn_mpsRomSupCodeVersion_clicked() ui->tb_mpsRomSupCodeVersion->setText(secondMbedStr); } } - catch(const char* exception) - { - qDebug() << exception; - } catch(SonoException& e) { qDebug() << e.what(); @@ -3674,10 +3643,6 @@ void MainWindow::on_btn_prbCtrlRomId_clicked() ui->tb_prbCtrlRomId->setText(idStr); } } - catch(const char* exception) - { - qDebug() << exception; - } catch(SonoException& e) { qDebug() << e.what(); @@ -3710,10 +3675,6 @@ void MainWindow::on_btn_prbCntlRomPid_clicked() ui->tb_prbCtrlRomPid->setText(pidStr); } } - catch(const char* exception) - { - qDebug() << exception; - } catch(SonoException& e) { qDebug() << e.what(); @@ -3747,10 +3708,6 @@ void MainWindow::on_btn_prbCntlRomPcbVersion_clicked() ui->tb_prbCtrlRomPcbVersion->setText(pcbVersionStr); } } - catch(const char* exception) - { - qDebug() << exception; - } catch(SonoException& e) { qDebug() << e.what(); @@ -3784,10 +3741,6 @@ void MainWindow::on_btn_prbCntlRomSerialNumber_clicked() ui->tb_prbCtrlRomSerialNumber->setText(serialNoStr); } } - catch(const char* exception) - { - qDebug() << exception; - } catch(SonoException& e) { qDebug() << e.what(); @@ -3871,10 +3824,6 @@ void MainWindow::on_btn_prbRomIdRead_clicked() MESSAGE_BOX("Probe A is disconnected."); } } - catch(const char* exception) - { - qDebug() << exception; - } catch(SonoException& e) { qDebug() << e.what(); @@ -3898,10 +3847,6 @@ void MainWindow::on_btn_prbRomIdRead_clicked() MESSAGE_BOX("Probe B is disconnected."); } } - catch(const char* exception) - { - qDebug() << exception; - } catch(SonoException& e) { qDebug() << e.what(); @@ -3925,10 +3870,6 @@ void MainWindow::on_btn_prbRomIdRead_clicked() MESSAGE_BOX("Probe C is disconnected."); } } - catch(const char* exception) - { - qDebug() << exception; - } catch(SonoException& e) { qDebug() << e.what(); @@ -3952,10 +3893,6 @@ void MainWindow::on_btn_prbRomIdRead_clicked() MESSAGE_BOX("Probe D is disconnected."); } } - catch(const char* exception) - { - qDebug() << exception; - } catch(SonoException& e) { qDebug() << e.what(); @@ -3997,10 +3934,6 @@ void MainWindow::on_btn_prbRomImpulseRead_clicked() MESSAGE_BOX("Probe A is disconnected."); } } - catch(const char* exception) - { - qDebug() << exception; - } catch(SonoException& e) { qDebug() << e.what(); @@ -4026,10 +3959,6 @@ void MainWindow::on_btn_prbRomImpulseRead_clicked() MESSAGE_BOX("Probe B is disconnected."); } } - catch(const char* exception) - { - qDebug() << exception; - } catch(SonoException& e) { qDebug() << e.what(); @@ -4055,10 +3984,6 @@ void MainWindow::on_btn_prbRomImpulseRead_clicked() MESSAGE_BOX("Probe C is disconnected."); } } - catch(const char* exception) - { - qDebug() << exception; - } catch(SonoException& e) { qDebug() << e.what(); @@ -4084,10 +4009,6 @@ void MainWindow::on_btn_prbRomImpulseRead_clicked() MESSAGE_BOX("Probe D is disconnected."); } } - catch(const char* exception) - { - qDebug() << exception; - } catch(SonoException& e) { qDebug() << e.what(); @@ -4273,10 +4194,6 @@ void MainWindow::on_btn_prbRomWriteAll_clicked() MESSAGE_BOX("Probe A is disconnected."); } } - catch(const char* exception) - { - qDebug() << exception; - } catch(SonoException& e) { qDebug() << e.what(); @@ -4301,10 +4218,6 @@ void MainWindow::on_btn_prbRomWriteAll_clicked() MESSAGE_BOX("Probe B is disconnected."); } } - catch(const char* exception) - { - qDebug() << exception; - } catch(SonoException& e) { qDebug() << e.what(); @@ -4329,10 +4242,6 @@ void MainWindow::on_btn_prbRomWriteAll_clicked() MESSAGE_BOX("Probe C is disconnected."); } } - catch(const char* exception) - { - qDebug() << exception; - } catch(SonoException& e) { qDebug() << e.what(); @@ -4357,10 +4266,6 @@ void MainWindow::on_btn_prbRomWriteAll_clicked() MESSAGE_BOX("Probe D is disconnected."); } } - catch(const char* exception) - { - qDebug() << exception; - } catch(SonoException& e) { qDebug() << e.what(); @@ -4402,10 +4307,6 @@ void MainWindow::on_btn_prbRomReadAll_clicked() MESSAGE_BOX("Probe A is disconnected."); } } - catch(const char* exception) - { - qDebug() << exception; - } catch(SonoException& e) { qDebug() << e.what(); @@ -4430,10 +4331,6 @@ void MainWindow::on_btn_prbRomReadAll_clicked() MESSAGE_BOX("Probe B is disconnected."); } } - catch(const char* exception) - { - qDebug() << exception; - } catch(SonoException& e) { qDebug() << e.what(); @@ -4458,10 +4355,6 @@ void MainWindow::on_btn_prbRomReadAll_clicked() MESSAGE_BOX("Probe C is disconnected."); } } - catch(const char* exception) - { - qDebug() << exception; - } catch(SonoException& e) { qDebug() << e.what(); @@ -4486,10 +4379,6 @@ void MainWindow::on_btn_prbRomReadAll_clicked() MESSAGE_BOX("Probe D is disconnected."); } } - catch(const char* exception) - { - qDebug() << exception; - } catch(SonoException& e) { qDebug() << e.what(); @@ -5490,6 +5379,14 @@ void MainWindow::exitApp() void MainWindow::on_chk_powerAo_clicked(bool checked) { _trx.powerAo(checked); + if(checked) + { + delay(100); + if(!hvPermission()) + { + _trx.powerAo(false); + } + } } /*************************************************************************************************/ diff --git a/mainwindow.h b/mainwindow.h index e9c4238..03d9d54 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -232,7 +232,7 @@ private: void logButtonsEnable (bool Enable); - bool scenarioStartPermission(); + bool hvPermission(); QString _fpgaProgramFolder = "/home/hasis/Desktop/hardware/hwCode"; QString _mcsProgramFolder = "/home/hasis/Desktop/hardware/hwCode";