实现赋码仪命令

升级小板程序失败时停止
This commit is contained in:
ranchuan
2023-12-21 18:51:58 +08:00
parent af964ad733
commit d1e617afd3
22 changed files with 1291 additions and 43 deletions

View File

@@ -280,6 +280,16 @@ int boardcast_updata::start(myarray data)
int boardcast_updata::dolater(int cmd, myarray data)
{
for(int i=0;i<ret_data.size();i++){
if(ret_data[i][0]!=0){
timeout_stop();
timeout_stop_retry();
qDebug("slave updata failed.");
end(1,ret_data);
busy=0;
return -1;
}
}
timeout_start(5000);
if(step==0){
if(send_packet()==true){
@@ -483,7 +493,11 @@ int slave_cmd::start(myarray data)
end(0,ret_data);
return 0;
}
// timeout=check_plan()->get_check_time_out()*1000;
step=0;
// 执行模式不为3时使用方案中的超时时间
if(data[0]!=3){
timeout=check_plan()->get_check_time_out()*1000;
}
qDebug("addr %d start ,timeout=%d",addr,timeout);
this->data=data;
send_pack_num=0;
@@ -531,10 +545,17 @@ int slave_cmd::dolater(int cmd, myarray data)
timeout_stop_retry();
if(cmd==this->cmd){
if(send_next()==true){
qDebug("cmd end success.");
busy=0;
end(0,ret_data);
timeout_stop();
if(step==0){
qDebug("cmd send success.");
step=1;
addr_response=0;
ret_data.clear();
}else{
qDebug("cmd end success.");
busy=0;
end(0,ret_data);
timeout_stop();
}
}
}else{
qWarning("cmd:%02x err.",cmd);