From a4b905e806e84c6d9cfe46445eda2157303f8fb6 Mon Sep 17 00:00:00 2001 From: hm Date: Wed, 13 Jul 2022 19:29:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=B8=BB=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E7=9A=84=E7=A9=BA=E9=80=9F=E7=AE=A1=E5=8A=A0=E7=83=AD=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E6=98=BE=E7=A4=BA=E9=80=BB=E8=BE=91=EF=BC=8C=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E8=BF=9E=E7=BB=AD=E4=B8=89=E6=AC=A1=E5=87=BA=E7=8E=B0?= =?UTF-8?q?=E5=8F=98=E5=8C=96=E8=AF=B4=E6=98=8E=E5=9C=A8=E5=8A=A0=E7=83=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App/mainwindow.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/App/mainwindow.cpp b/App/mainwindow.cpp index 2045010..dfdb98d 100644 --- a/App/mainwindow.cpp +++ b/App/mainwindow.cpp @@ -1535,26 +1535,32 @@ void MainWindow::updateUI()//事件驱动式更新数据 //两秒检测一次,如果两秒内,数据变化,说明在加热 static qint64 echo_time = 0; static uint8_t echo_seq_old = 0; - if((QDateTime::currentMSecsSinceEpoch() - echo_time) >= 3000) + static uint8_t echo_count = 0; + if((QDateTime::currentMSecsSinceEpoch() - echo_time) >= 2000) { + //qDebug() << "echo" <servosystem->setCheckState(4,1);//空速管加热 - healthui->setState(7,HealthUI::state::success);//AIR - - echo_seq_old = vehicle.ccmstate.echo_seq; - + echo_count++; + if(echo_count >= 3) + { + echo_count = 3; + toolsui->servosystem->setCheckState(4,1);//空速管加热 + healthui->setState(7,HealthUI::state::success);//AIR + } + echo_seq_old = vehicle.ccmstate.echo_seq; } else { toolsui->servosystem->setCheckState(4,0);//空速管不加热 healthui->setState(7,HealthUI::state::inital);//AIR - + echo_count = 0; } - + echo_time = QDateTime::currentMSecsSinceEpoch(); } - echo_time = QDateTime::currentMSecsSinceEpoch(); +