检测错误码
This commit is contained in:
@@ -319,13 +319,19 @@ static void check_end(ucport_def *u,port_mcu *src,void *data,int ack,char *err_s
|
||||
uint32_t errcode=0;
|
||||
uint8_t *ack_d=&w->ack[(addr)*6];
|
||||
ack_d[0]=addr+slave_addr_off();
|
||||
ack_d[1]=ack;
|
||||
if(ack==-1) ack_d[1]=208; // 208表示通信超时
|
||||
else ack_d[1]=ack==0?0:209;// 209表示小板返回了命令失败
|
||||
// TODO: 还有4字节数据
|
||||
errcode=in_range_err(arr_data(data)+8+8,arr_data(data));
|
||||
ack_d[2]=errcode&0xff;
|
||||
ack_d[3]=(errcode>>8)&0xff;
|
||||
ack_d[4]=(errcode>>16)&0xff;
|
||||
ack_d[5]=(errcode>>24)&0xff;
|
||||
if(data)
|
||||
{
|
||||
errcode=in_range_err(arr_data(data)+8+8,arr_data(data));
|
||||
ack_d[2]=errcode&0xff;
|
||||
ack_d[3]=(errcode>>8)&0xff;
|
||||
ack_d[4]=(errcode>>16)&0xff;
|
||||
ack_d[5]=(errcode>>24)&0xff;
|
||||
if(ack_d[1]==0) ack_d[1]=ack_d[2];
|
||||
}else{
|
||||
}
|
||||
|
||||
w->ack_num++;
|
||||
if(w->ack_num>=10)
|
||||
|
@@ -371,6 +371,9 @@ static void when_scheme_done(ucport_def *u)
|
||||
DBG_WARN("can not fond variable \"tran\"");
|
||||
return;
|
||||
}
|
||||
DBG_LOG("memused:%d",mem_perused());
|
||||
rt_thread_mdelay(100);
|
||||
DBG_LOG("memused:%d",mem_perused());
|
||||
for(int i=0;i<PORT_NUM;i++)
|
||||
{
|
||||
// 只给在线设备升级方案
|
||||
|
Reference in New Issue
Block a user