From: qibin <2534086736@qq.com> Date: Wed, 20 Sep 2023 02:27:28 +0000 (+0800) Subject: 调整英文键盘大小 X-Git-Url: http://kyz.pub/gitweb/?a=commitdiff_plain;h=590bd557db0cc5aa88c93c7a7d064b33c9c41f11;p=zd%2Fzd-mcu.git 调整英文键盘大小 修复了键盘在切换到主界面有时不会正常关闭的BUG 对新加的协议传输增加了一些延时等待 --- diff --git a/ZDBYQ/canshupeizhi.cpp b/ZDBYQ/canshupeizhi.cpp index 3c60343f..54cea757 100644 --- a/ZDBYQ/canshupeizhi.cpp +++ b/ZDBYQ/canshupeizhi.cpp @@ -11,6 +11,7 @@ #include mcu_arm1 *ARM3;//调用串口通信 + bool cspz_flag=false; void Delay_MSec1(unsigned int msec) @@ -913,7 +914,8 @@ void canshupeizhi::cspz_rxyset_page() label_cspz_3_31->setGeometry(360,406,20,30); label_cspz_3_31->setStyleSheet("background: rgb(145, 145, 145);font: 12pt 黑体 bold;color: rgb(255, 255, 255)"); label_cspz_3_31->setText("分"); - label_cspz_3_15->setGeometry(700,354,80,30); + //label_cspz_3_15->setGeometry(700,354,80,30); + label_cspz_3_15->setGeometry(310,270,80,30); label_cspz_3_15->setStyleSheet("background: rgb(145, 145, 145);font: 12pt 黑体 bold;color: rgb(255, 255, 255)"); label_cspz_3_18->setGeometry(450,231,100,30); @@ -2786,6 +2788,10 @@ void canshupeizhi::mimaButtonClicked() void canshupeizhi::callKeyBoard(QLineEdit *a) { + if(keyBoard_flag==true) + { + keyBoard1->close(); + } if(KeyBoard_Code==false) { keyBoard1 = new KeyBoard(0, a); @@ -2795,18 +2801,19 @@ void canshupeizhi::callKeyBoard(QLineEdit *a) } else { - if(keyBoard_flag==true) - { - keyBoard1->close(); - } keyBoard1 = new KeyBoard(0, a); keyBoard1->setGeometry(490, 200, 321, 182); keyBoard1->show(); } + keyBoard1->setAttribute(Qt::WA_DeleteOnClose); } void canshupeizhi::callKeyBoard_ABC_Can(QLineEdit *a) { + if(keyBoard_ABC_flag==true) + { + keyBoard_ABC1->close(); + } if(KeyBoard_ABC_Code==false) { keyBoard_ABC1 = new KeyBoard_ABC(0, a); @@ -2816,14 +2823,11 @@ void canshupeizhi::callKeyBoard_ABC_Can(QLineEdit *a) } else { - if(keyBoard_ABC_flag==true) - { - keyBoard_ABC1->close(); - } keyBoard_ABC1 = new KeyBoard_ABC(0, a); keyBoard_ABC1->setGeometry(5, 326, 790, 143); keyBoard_ABC1->show(); } + keyBoard_ABC1->setAttribute(Qt::WA_DeleteOnClose); } void canshupeizhi::button_cspz_1_1_Clicked() @@ -3100,6 +3104,7 @@ void canshupeizhi::button_cspz_rxy1_start_Clicked()//开启热像仪1 } ARM3->rxy_state(); //下发热像仪状态 23.8.30 + Delay_MSec1(500); } void canshupeizhi::button_cspz_rxy2_start_Clicked()//开启热像仪2 @@ -3129,16 +3134,19 @@ void canshupeizhi::button_cspz_rxy2_start_Clicked()//开启热像仪2 button_cspz_rxy2_start->setText("关闭热像仪2"); } ARM3->rxy_state(); //下发热像仪状态 23.8.30 + Delay_MSec1(500); } void canshupeizhi::button_cspz_5_1_Clicked()//开启风机 { ARM3->setFanState(1); + Delay_MSec1(500); } void canshupeizhi::button_cspz_5_2_Clicked()//关闭风机 { ARM3->setFanState(0); + Delay_MSec1(500); } bool fengji_flag=true; @@ -3202,7 +3210,7 @@ void canshupeizhi::button_cspz_5_3_Clicked() file_write2.close(); Delay_MSec1(50); ARM3->setoverheat(); - Delay_MSec1(10); + Delay_MSec1(500); if(label_cspz_5_19->text()=="风机定时运行已开启!") { ARM3->setFanTiming(0x01);//串口发送启动风机定时 @@ -3211,9 +3219,9 @@ void canshupeizhi::button_cspz_5_3_Clicked() { ARM3->setFanTiming(0x00);//串口发送关闭风机定时 } - Delay_MSec1(10); + Delay_MSec1(500); ARM3->setFanStartT(); - Delay_MSec1(10); + Delay_MSec1(500); label_cspz_5_18->setText("保存成功!"); Delay_MSec1(500); label_cspz_5_18->clear(); diff --git a/ZDBYQ/jiemian.pro.user b/ZDBYQ/jiemian.pro.user index fd3a7509..a805230e 100644 --- a/ZDBYQ/jiemian.pro.user +++ b/ZDBYQ/jiemian.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/ZDBYQ/keyboard_ABC.ui b/ZDBYQ/keyboard_ABC.ui index 024ce009..2acf8b05 100644 --- a/ZDBYQ/keyboard_ABC.ui +++ b/ZDBYQ/keyboard_ABC.ui @@ -9,8 +9,8 @@ 0 0 - 1039 - 190 + 919 + 242 @@ -27,8 +27,8 @@ 1 1 - 1021 - 161 + 791 + 141 @@ -43,8 +43,8 @@ 0 0 - 1013 - 161 + 791 + 141 diff --git a/ZDBYQ/mainpage_rxy.cpp b/ZDBYQ/mainpage_rxy.cpp index 0ad77806..e8a79325 100644 --- a/ZDBYQ/mainpage_rxy.cpp +++ b/ZDBYQ/mainpage_rxy.cpp @@ -133,7 +133,6 @@ void mainpage_Rxy::button9_1_clicked()//热像仪1按钮槽函数 Thermal_imager_Alarm_file_rxy1=in.readLine(); } file_read.close(); - label_9_1->clear(); button9_1->show(); button9_1->raise(); diff --git a/ZDBYQ/mainwindow.cpp b/ZDBYQ/mainwindow.cpp index aadb406e..732a190f 100644 --- a/ZDBYQ/mainwindow.cpp +++ b/ZDBYQ/mainwindow.cpp @@ -14,6 +14,10 @@ bool lowpower_mode_flag1=true; bool kaiji_flag_ok=false; +int rxy_state_flag = 0; +bool powerlost_flag = true; +int powerlost_times = 0; + wangluo *wangluo_thread=nullptr; canshupeizhi *canshupeizhi_thread=nullptr; xitongshezhi *xitongshezhi_thread=nullptr; @@ -27,6 +31,14 @@ QNetworkConfigurationManager mgr;//网络检测 int main_back_color; int where_page; + +void Delay_MSec3(unsigned int msec) +{ + QEventLoop eventloop; + QTimer::singleShot((int)msec, &eventloop, SLOT(quit())); + eventloop.exec(); +} + MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) @@ -1370,8 +1382,25 @@ void MainWindow::dispPopWindwows() Pop_alarm_rxy_disconnect->show(); Pop_alarm_rxy_disconnect->raise(); Pop_alarm_rxy_disconnect->setText("热像仪掉线"); - + int flag_rxy = 0; + if(file_alarm6_1.exists() == true && file_alarm6_2.exists() == false) + { + flag_rxy = 1; + } + else if(file_alarm6_2.exists() == true && file_alarm6_1.exists() == false) + { + flag_rxy = 2; + } + else + { + flag_rxy = 3; + } + if(rxy_state_flag != flag_rxy) + { + rxy_state_flag = flag_rxy; ARM_1->rxy_state(); //向下位机发送警报 23.8.16 + Delay_MSec3(100); + } } else @@ -1379,6 +1408,7 @@ void MainWindow::dispPopWindwows() DIG.alarm_rxy = 0; alarm_flag4=false; Pop_alarm_rxy_disconnect->hide(); + rxy_state_flag = 0; } } @@ -2421,12 +2451,6 @@ void MainWindow::timerTimeout3(void)//开机进度条 } } -void Delay_MSec3(unsigned int msec) -{ - QEventLoop eventloop; - QTimer::singleShot((int)msec, &eventloop, SLOT(quit())); - eventloop.exec(); -} void MainWindow::usb_file_selcet() { @@ -2723,6 +2747,7 @@ void MainWindow::onRtcUpdate(bool flag) }else { ARM_1->GetRtcTime(); } + Delay_MSec3(50); QDateTime date_time=QDateTime::currentDateTimeUtc(); long nowtime = date_time.toTime_t() + 28800; @@ -2883,7 +2908,18 @@ void MainWindow::onAlarmCheck(uint32_t data_alarm) //23.8.24 增加断电 if(data_alarm & BIT(4)) { + if(powerlost_flag || powerlost_times == 20) + { + powerlost_times = 0; + powerlost_flag = false; postDataMod->powerlost(); + Delay_MSec3(100); + } + powerlost_times++; + } + else + { + powerlost_flag = true; } } @@ -2896,6 +2932,7 @@ void MainWindow::onSelfTestCheck(uint32_t data_alarm) alarm_flag13 = (data_alarm & BIT(4)) ? false: true; alarm_flag12 = (data_alarm & BIT(3)) ? false: true; + } void MainWindow::onLanTuBiaoStateUpdate(bool state) diff --git a/ZDBYQ/mcu_arm1.cpp b/ZDBYQ/mcu_arm1.cpp index 65c1bb62..7fea8e2e 100644 --- a/ZDBYQ/mcu_arm1.cpp +++ b/ZDBYQ/mcu_arm1.cpp @@ -4,6 +4,7 @@ #include "net_thread.h" #include "QTime" #include +#include extern QSerialPort SerialPort1; UART1 *uart_mcu1; extern uint16_t CRC1; @@ -15,9 +16,10 @@ mcu_arm1::mcu_arm1():m_serialPort() void mcu_delay(unsigned int msec) { - QTime _Timer = QTime::currentTime().addMSecs(msec); - while( QTime::currentTime() < _Timer ) - QCoreApplication::processEvents(QEventLoop::AllEvents, 100); + QThread::msleep(msec); +// QTime _Timer = QTime::currentTime().addMSecs(msec); +// while( QTime::currentTime() < _Timer ) +// QCoreApplication::processEvents(QEventLoop::AllEvents, 100); } void mcu_arm1::GetRtcTime(){ diff --git a/ZDBYQ/mcu_arm1.h b/ZDBYQ/mcu_arm1.h index 78846ede..afcd1c18 100644 --- a/ZDBYQ/mcu_arm1.h +++ b/ZDBYQ/mcu_arm1.h @@ -23,10 +23,10 @@ public: void setFanTiming(uint8_t state); void setBuzzerState(uint8_t state); - void rxy_state(); // ÈÈÏñÒÇ״̬ 23.8.16 - void Realtime_temperature(int max,int min,int average); //ÈÈÏñÒÇ1ʵʱÎÂ¶È 23.8.16 - void Realtime_temperature1(int max,int min,int average); //ÈÈÏñÒÇ2ʵʱÎÂ¶È 23.8.16 - void Powerlost_datapost(bool isok); //¶ÏµçÊý¾ÝÉÏ´«³É¹¦ÐźŠ+ void rxy_state(); // 热像仪状态 23.8.16 + void Realtime_temperature(int max,int min,int average); //热像仪1实时温度 23.8.16 + void Realtime_temperature1(int max,int min,int average); //热像仪2实时温度 23.8.16 + void Powerlost_datapost(bool isok); //断电数据上传成功信号 private: QSerialPort *m_serialPort; diff --git a/ZDBYQ/wangluo.cpp b/ZDBYQ/wangluo.cpp index 1dff54b0..6b3e8aa7 100644 --- a/ZDBYQ/wangluo.cpp +++ b/ZDBYQ/wangluo.cpp @@ -861,6 +861,10 @@ void wangluo::mimaButtonClicked() void wangluo::callKeyBoard(QLineEdit *a) { + if(keyBoard_flag==true) + { + keyBoard->close(); + } if(KeyBoard_Code==false) { keyBoard = new KeyBoard(0, a); @@ -878,10 +882,15 @@ void wangluo::callKeyBoard(QLineEdit *a) keyBoard->setGeometry(490, 200, 321, 182); keyBoard->show(); } + keyBoard->setAttribute(Qt::WA_DeleteOnClose); } void wangluo::callKeyBoard_ABC(QLineEdit *a) { + if(keyBoard_ABC_flag==true) + { + keyBoard_ABC->close(); + } if(KeyBoard_ABC_Code==false) { keyBoard_ABC = new KeyBoard_ABC(0, a); @@ -899,6 +908,7 @@ void wangluo::callKeyBoard_ABC(QLineEdit *a) keyBoard_ABC->setGeometry(5, 326, 790, 143); keyBoard_ABC->show(); } + keyBoard_ABC->setAttribute(Qt::WA_DeleteOnClose); } void wangluo::button_wlxx_1_1_Clicked()//4G配置页面保存参数槽函数 diff --git a/ZDBYQ/xitongshezhi.cpp b/ZDBYQ/xitongshezhi.cpp index c5b821ee..bbac366d 100644 --- a/ZDBYQ/xitongshezhi.cpp +++ b/ZDBYQ/xitongshezhi.cpp @@ -43,6 +43,7 @@ xitongshezhi::xitongshezhi(QWidget *parent) : label_xtsz_0_3->setAlignment(Qt::AlignCenter); label_xtsz_0_3->setText("故障记录"); + xtsz_page(1); xtsz_shebei_page(); @@ -98,6 +99,7 @@ void xitongshezhi::label_xtsz_2_show(int a) void xitongshezhi::label_xtsz_3_show(int a) { + label_xtsz_0_3_1->show(); if(a==1) { label_xtsz_3_1->show(); @@ -289,12 +291,16 @@ void xitongshezhi::label_xtsz_3_show(int a) count=0; model_error->sort(0,Qt::DescendingOrder); tableView_error->show(); + label_xtsz_0_3_1->hide(); + } else { tableView_error->hide(); label_xtsz_3_1->hide(); + label_xtsz_0_3_1->hide(); } + } void xitongshezhi::xtsz_page(int a) @@ -410,10 +416,14 @@ void xitongshezhi::xtsz_xianshi_page() void xitongshezhi::xtsz_error_record_page() { label_xtsz_3_1=new QLabel(this); + label_xtsz_0_3_1=new QLabel(this); label_xtsz_3_1->setGeometry(240,190,400,30); label_xtsz_3_1->setStyleSheet("background: rgb(145, 145, 145);font: 12pt 黑体 bold;color: rgb(255, 255, 255)"); label_xtsz_3_1->setText("发生时间 故障类型"); + label_xtsz_0_3_1->setGeometry(650,190,120,39); + label_xtsz_0_3_1->setAlignment(Qt::AlignCenter); + label_xtsz_0_3_1->setText("记录读取中..."); tableView_error = new QTableView; /* 设置表格视图大小 */ diff --git a/ZDBYQ/xitongshezhi.h b/ZDBYQ/xitongshezhi.h index e3c76fdf..bdf1b445 100644 --- a/ZDBYQ/xitongshezhi.h +++ b/ZDBYQ/xitongshezhi.h @@ -18,7 +18,7 @@ extern bool lowpower_mode_flag1; extern bool cspz_flag,wlpz_flag; -static QString version="软件版本号:A20230831test"; +static QString version="软件版本号:A20230914test"; namespace Ui { class xitongshezhi; @@ -73,6 +73,7 @@ private: QLabel *label_xtsz_0_1;//左右滑动切换页面label(4G配置) QLabel *label_xtsz_0_2;//左右滑动切换页面label(LORA配置) QLabel *label_xtsz_0_3; + QLabel *label_xtsz_0_3_1; //读取进度 QLabel *label_xtsz_1_1; QLabel *label_xtsz_1_2;