修正主界面的空速管加热状态显示逻辑,改为连续三次出现变化说明在加热

This commit is contained in:
hm
2022-07-13 19:29:22 +08:00
parent 4982556499
commit a4b905e806
+15 -9
View File
@@ -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" <<vehicle.ccmstate.echo_seq << echo_seq_old;
if(vehicle.ccmstate.echo_seq != echo_seq_old)
{
toolsui->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();