解决上位机协议中crc校验错误依然执行命令的问题
赋码仪新检测赋码命令测试成功 解决找不到槽任务返回值的bug 从机返回数据按地址排序 解决从机无返回时报错异常通道与实际不符的bug
This commit is contained in:
@@ -871,20 +871,47 @@ void selfdev_runtask::timeout()
|
||||
busy=0;
|
||||
}
|
||||
|
||||
// 排序,再接收了从机数据之后
|
||||
void selfdev_runtask::slave_sort(){
|
||||
myarray temp;
|
||||
int slave_num=slave_acked.size();
|
||||
if(slave_num==0) return;
|
||||
for(int i=0;i<slave_num;i++){
|
||||
temp=slave_acked[i];
|
||||
for(int j=i+1;j<slave_num;j++){
|
||||
if(slave_acked[i][0]>slave_acked[j][0]){
|
||||
slave_acked[i]=slave_acked[j];
|
||||
slave_acked[j]=temp;
|
||||
temp=slave_acked[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void selfdev_runtask::slave_end_slot(int addr,int ack, slave_data data)
|
||||
{
|
||||
qDebug("selfdev runtask end.");
|
||||
for(int i=0;i<data.size();i++){
|
||||
qDebug("index=%d",i);
|
||||
slave_ret slave=data.at(i);
|
||||
qDebug("index=%d end",i);
|
||||
// for(int i=0;i<data.size();i++){
|
||||
// //qDebug("index=%d",i);
|
||||
// slave_ret slave=data.at(i);
|
||||
// //qDebug("index=%d end",i);
|
||||
// // 数据的第一位是来源的地址
|
||||
// slave.data.insert(0,slave.addr);
|
||||
// slave_acked.replace(i,slave.data);
|
||||
// // qDebug("index=%d end 2",i);
|
||||
// slave_acked_num++;
|
||||
// }
|
||||
for(int i=0;i<addrs.size();i++){
|
||||
int addr=addrs[i];
|
||||
myarray sdata=data[addr-1];
|
||||
// 数据的第一位是来源的地址
|
||||
slave.data.insert(0,slave.addr);
|
||||
slave_acked.replace(i,slave.data);
|
||||
// qDebug("index=%d end 2",i);
|
||||
sdata.insert(0,addr);
|
||||
slave_acked.replace(addr-1,sdata);
|
||||
slave_acked_num++;
|
||||
}
|
||||
if(cmd_pc_ret()!=0){
|
||||
slave_sort();
|
||||
emit send_data_signal(cmd_pc_ret(),ret_slave_to_pc(slave_acked));
|
||||
}
|
||||
busy=0;
|
||||
|
Reference in New Issue
Block a user