广播命令可以接收各个从机的返回数据

This commit is contained in:
ranchuan
2023-12-09 10:37:48 +08:00
parent dc6487c309
commit fe11c52253
10 changed files with 156 additions and 21 deletions

View File

@@ -52,6 +52,54 @@ int slave_check::dolater(int cmd, myarray data)
int slave_check2::start(myarray data)
{
mycfg *cfg_=syscfg();
check_cfg *ccfg_=check_plan();
int timeout=ccfg_->get_check_time_out()*1000;
busy=1;
cmd=0x0c;
qDebug("addr %d start check,timeout=%d",addr,timeout);
send_data(cmd,myarray(),3);
timeout_start(timeout);
return 0;
}
void slave_check2::timeout()
{
timeout_stop();
qWarning("addr %d check timeout.",addr);
end(1,ret_data);
busy=0;
}
int slave_check2::dolater(int cmd, myarray data)
{
timeout_stop_retry();
if(cmd==0x0c){
if(data.size()<=16){
qDebug("addr %d recv first ack.",addr);
}else{
qDebug("addr %d recv secend ack.",addr);
send_data(0x14,myarray(),5);
end(0,ret_data);
timeout_stop();
}
}else if(cmd==0x14){
// 所有从机都 停止上报时取消忙状态
busy=0;
}
return 0;
}
void slave_result::timeout()
{
timeout_stop();
@@ -212,7 +260,7 @@ void boardcast_updata::timeout()
{
timeout_stop();
qWarning("slave updata timeout.");
end(1,myarray());
end(1,ret_data);
busy=0;
}
@@ -259,7 +307,7 @@ int boardcast_updata::dolater(int cmd, myarray data)
timeout_stop();
timeout_stop_retry();
qDebug("slave updata end.");
end(0,data);
end(0,ret_data);
busy=0;
}
return 0;
@@ -301,7 +349,7 @@ void boardcast_updata_scheme::timeout()
{
timeout_stop();
qWarning("slave updata timeout.");
end(1,myarray());
end(1,ret_data);
busy=0;
}
@@ -333,7 +381,7 @@ int boardcast_updata_scheme::dolater(int cmd, myarray data)
timeout_stop();
timeout_stop_retry();
qDebug("slave updata scheme end.");
end(0,data);
end(0,ret_data);
busy=0;
}
return 0;