解决上位机协议中crc校验错误依然执行命令的问题
赋码仪新检测赋码命令测试成功 解决找不到槽任务返回值的bug 从机返回数据按地址排序 解决从机无返回时报错异常通道与实际不符的bug
This commit is contained in:
@@ -221,19 +221,23 @@ int coder_slave_pack(myarray &d,int addr)
|
||||
myarray coder_slave_find_ret_data(myarray data,int task_index,int size)
|
||||
{
|
||||
myarray r;
|
||||
int task_len;
|
||||
// qDebug()<<"find data,task_index="<<task_index<<"src="<<data.toHex(' ');
|
||||
for(int i=0;i<data.size();)
|
||||
{
|
||||
task_len=data[i+1]*2;
|
||||
if(data[i]==task_index){
|
||||
r=data.mid(i+2,data[i+1]);
|
||||
r=data.mid(i+2,task_len);
|
||||
break;
|
||||
}
|
||||
i+=2+data[i+1];
|
||||
i+=2+task_len;
|
||||
}
|
||||
if(r.size()>=size){
|
||||
r=r.left(size);
|
||||
}else{
|
||||
int len=size-r.size();
|
||||
r.append(len,uint8_t(0));
|
||||
qWarning("can not find data,append by 0.");
|
||||
}
|
||||
return r;
|
||||
}
|
||||
@@ -512,7 +516,19 @@ myarray cmd_coder_code2::ret_slave_to_pc(QList<myarray> data)
|
||||
r.append(uint8_t((addrs>>8)&0xff));
|
||||
r.append(uint8_t((addrs>>16)&0xff));
|
||||
r.append(uint8_t(coder_chip_type()));
|
||||
r.append(uint8_t(!syscfg()->coder_return_mode));
|
||||
// coder_return_mode 1是完整模式,协议0是完整模式
|
||||
if(syscfg()->coder_return_mode){
|
||||
r.append(uint8_t(0));
|
||||
r.append(13);
|
||||
if(chip_mode==0){
|
||||
r.append(15);
|
||||
}else{
|
||||
r.append(16);
|
||||
}
|
||||
}else{
|
||||
r.append(uint8_t(1));
|
||||
}
|
||||
r.append(8);
|
||||
for (int i=0;i<data.size();i++)
|
||||
{
|
||||
myarray &sdata=data[i];
|
||||
@@ -525,8 +541,9 @@ myarray cmd_coder_code2::ret_slave_to_pc(QList<myarray> data)
|
||||
}else{
|
||||
err=uint8_t(0xd0);
|
||||
}
|
||||
sdata.remove(0,1);
|
||||
// 如果延时不对,则失败
|
||||
myarray sret=coder_slave_find_ret_data(sdata.mid(1),3,2);
|
||||
myarray sret=coder_slave_find_ret_data(sdata,3,2);
|
||||
uint16_t sdelay=sret[0]|(sret[1]<<8);
|
||||
if(sdelay!=delay){
|
||||
if(err==0){
|
||||
@@ -535,11 +552,12 @@ myarray cmd_coder_code2::ret_slave_to_pc(QList<myarray> data)
|
||||
}
|
||||
r.append(err);
|
||||
// 添加工厂信息
|
||||
sret=coder_slave_find_ret_data(sdata.mid(1),4,4);
|
||||
sret=coder_slave_find_ret_data(sdata,4,4);
|
||||
r.append(sret);
|
||||
// 完整模式
|
||||
if(syscfg()->coder_return_mode){
|
||||
r.append(uid_codes[i].shell,13);
|
||||
// r.append(13,i+'0');
|
||||
if(chip_mode==0){
|
||||
r.append(uid_codes[i].uid,15);
|
||||
}else{
|
||||
|
Reference in New Issue
Block a user