From b76c04d07270769a76c070d0888a5c98351b8010 Mon Sep 17 00:00:00 2001 From: ranchuan Date: Sat, 6 Jan 2024 09:59:58 +0800 Subject: [PATCH] =?UTF-8?q?=20=20=E5=BC=82=E5=B8=B8=E5=88=A4=E5=AE=9A?= =?UTF-8?q?=E5=9C=A8=E5=87=BA=E9=94=99=E6=97=B6=E6=89=8D=E6=89=93=E5=8D=B0?= =?UTF-8?q?=EF=BC=8C=E6=A3=80=E6=B5=8B=E6=97=B6=E9=80=9A=E4=BF=A1=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E8=9C=82=E9=B8=A3=E5=99=A8=E5=93=8D=E4=B8=80=E5=A3=B0?= =?UTF-8?q?=20=20=20=E5=8F=96=E6=B6=88=E4=B8=80=E4=BA=9B=E9=80=9A=E4=BF=A1?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ReadMe.txt | 3 +++ complier_info.h | 2 +- elec/elec_judge.cpp | 10 +++++++++- info.json | 2 +- interface/if_can.cpp | 6 +++--- interface/if_uart.cpp | 2 +- prot/prot_m4.cpp | 2 +- prot/prot_pc.cpp | 2 +- prot/prot_slave.h | 10 +++++----- prot_cmd/cmd_cmdline.cpp | 4 ++-- prot_cmd/cmd_slave.cpp | 2 ++ 11 files changed, 29 insertions(+), 16 deletions(-) diff --git a/ReadMe.txt b/ReadMe.txt index 6c59d0c..818d812 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -52,4 +52,7 @@ 2024.01.04 添加自动测试命令 auto_test V2.03 批检仪检测指令使用小板的错误码 +2024.1.5 + 异常判定在出错时才打印,检测时通信异常蜂鸣器响一声 + 取消一些通信日志打印 diff --git a/complier_info.h b/complier_info.h index 2ca9b5f..0e08788 100644 --- a/complier_info.h +++ b/complier_info.h @@ -6,7 +6,7 @@ -#define BUILD_DATE "2024-01-04 14:43:54" +#define BUILD_DATE "2024-01-05 17:19:53" diff --git a/elec/elec_judge.cpp b/elec/elec_judge.cpp index 8b33657..a9bd05f 100644 --- a/elec/elec_judge.cpp +++ b/elec/elec_judge.cpp @@ -120,15 +120,21 @@ static void elec_task_judge(elec_judge_def *e,int index,uint8_t *data) TASK_FLAG_CHECK(index); const scheme_task_def *task=&e->scheme->task[index]; uint16_t temp; - qDebug("task index=%d.",index); + int print_index=0; if(EXE_ACK_CHECK(index)){ elec_add_errcode(e,task->err); + qDebug("task index=%d.",index); + print_index=1; qDebug("task execute err:%d.",task->err); } for(int i=0;iitem_num;i++){ temp=data[i*2]|(data[i*2+1]<<8); if(temprange[i].min||temp>task->range[i].max){ elec_add_errcode(e,task->range[i].err); + if(print_index==0){ + qDebug("task index=%d.",index); + print_index=1; + } qDebug("task ret_index:%d vaule=%d,err:%d",i,temp,task->range[i].err); } } @@ -144,7 +150,9 @@ static void elec_current(elec_judge_def *e,int index,uint8_t *data) uint16_t temp,temp2; uint16_t short_c=e->short_circuited; uint16_t open_c=e->open_circuited; + int print_index=0; qDebug("task index=%d.",index); + print_index=1; if(EXE_ACK_CHECK(index)){ elec_add_errcode(e,task->err); qDebug("task execute err:%d.",task->err); diff --git a/info.json b/info.json index 5910036..45c54b9 100644 --- a/info.json +++ b/info.json @@ -1,5 +1,5 @@ { - "build_date": "2024-01-04 14:43:54", + "build_date": "2024-01-05 17:19:53", "hard_version": "MHPZ2_V1.00", "private": [ "info.json", diff --git a/interface/if_can.cpp b/interface/if_can.cpp index e4ded2f..fd88252 100644 --- a/interface/if_can.cpp +++ b/interface/if_can.cpp @@ -182,7 +182,7 @@ void can_host::recv_data_cb() // 不分段 slave.clear(); slave.append(payload); - qDebug()<<"can recv from:"<write(data); if ((!serial_->flush()) || (wb != data.size())) diff --git a/prot/prot_m4.cpp b/prot/prot_m4.cpp index b9ff1f0..e4d9e1c 100644 --- a/prot/prot_m4.cpp +++ b/prot/prot_m4.cpp @@ -36,7 +36,7 @@ void prot_m4::send_data_slot(myarray data) send_list.append(send); if(wait==0){ wait+=2; - qDebug("send m4:%s",data.data()); + // qDebug("send m4:%s",data.data()); if_->write(send_list.takeFirst()); } } diff --git a/prot/prot_pc.cpp b/prot/prot_pc.cpp index 440e3d3..73fe0ec 100644 --- a/prot/prot_pc.cpp +++ b/prot/prot_pc.cpp @@ -41,7 +41,7 @@ void ProtPc::init() int pack_len=0; while(pack_len=codec_->packCheck(recv_data),pack_len>0){ int cmd,src,dst; - qDebug("host recv:%s",recv_data.toHex(' ').data()); + // qDebug("host recv:%s",recv_data.toHex(' ').data()); myarray data=codec_->decode(src,dst,cmd,recv_data); recv_data.remove(0,pack_len); // qDebug("host recv removed:%s",recv_data.toHex(' ').data()); diff --git a/prot/prot_slave.h b/prot/prot_slave.h index ede86ba..a56ddbc 100644 --- a/prot/prot_slave.h +++ b/prot/prot_slave.h @@ -254,31 +254,31 @@ protected: timeout_start_cb(ms); } void timeout_start_cb(int ms){ - qDebug("handle_board:start timeout"); + // qDebug("handle_board:start timeout"); timer_->setInterval(ms); timer_->start(); } void timeout_start_retry_cb(int ms){ - qDebug("handle_board:start retry"); + // qDebug("handle_board:start retry"); timer_retry_->setInterval(ms); timer_retry_->start(); } // 停止超时计时器,此方法同时停止重发计时器 void timeout_stop(){ - qDebug("handle_board:stop timeout"); + // qDebug("handle_board:stop timeout"); emit timeout_stop_signal(); timeout_stop_retry(); } // 停止数据回复超时重试计时器 void timeout_stop_retry(){ - qDebug("handle_board:stop retry"); + // qDebug("handle_board:stop retry"); emit timeout_stop_retry_signal(); times_retry=0; } private: // 重试回调 void timeout_retry(){ - qDebug("in retry."); + // qDebug("in retry."); if(times_retry>0){ times_retry--; myarray s; diff --git a/prot_cmd/cmd_cmdline.cpp b/prot_cmd/cmd_cmdline.cpp index 8167766..1f86e73 100644 --- a/prot_cmd/cmd_cmdline.cpp +++ b/prot_cmd/cmd_cmdline.cpp @@ -39,7 +39,7 @@ void end_slot(int addr,int ack,slave_data data) // ack 0是成功,这里转化为1是成功 command *c=command_start(); mystring strs("ack:%1,%2"); - strs=strs.arg(!ack).arg("end"); + strs=strs.arg(ack).arg("end"); c->send(strs.data()); } @@ -171,7 +171,7 @@ static void mcu_cmdlines(QList args) qWarning("handle is busy."); }else{ b->set_cbfun([=](int addr,int ack,slave_data data){ - end_slot(addr,ack,data); + end_slot(addr,!ack,data); },[=](int rate,mystring str){ rate_slot(rate,str); }); diff --git a/prot_cmd/cmd_slave.cpp b/prot_cmd/cmd_slave.cpp index b44ead1..cd19a1c 100644 --- a/prot_cmd/cmd_slave.cpp +++ b/prot_cmd/cmd_slave.cpp @@ -3,6 +3,7 @@ #include "base/check_cfg.h" #include "QDebug" #include "base/crc.h" +#include "base/beep.h" @@ -547,6 +548,7 @@ void slave_cmd::timeout() timeout_stop(); int addr_timeout=addr^addr_response; qWarning("addr 0x%06X timeout",addr_timeout); + Beep()->set_beep(300,300,1); end(1,ret_data); busy=0; }