解决EW写流水号数组越界的bug

解决0x20指令只会解析第一个槽参数的bug
    ew写延时添加crc8
This commit is contained in:
ranchuan
2023-12-25 18:46:51 +08:00
parent 5c2648d33c
commit a6ba0a1818
6 changed files with 33 additions and 19 deletions

View File

@@ -113,14 +113,14 @@ static void slave_adds(self_def *s)
task_slot_delete();
slot=task_slot_init();
while(off<len){
t->slot_index=arr_get(s->data,0);
t->task_id=arr_get(s->data,1);
t->par_count=arr_get(s->data,2);
t->ret_count=arr_get(s->data,3);
t->errcode=arr_get(s->data,4);
t->slot_index=arr_get(s->data,off);
t->task_id=arr_get(s->data,off+1);
t->par_count=arr_get(s->data,off+2);
t->ret_count=arr_get(s->data,off+3);
t->errcode=arr_get(s->data,off+4);
t->exe_flag=0;
t->task_index=arr_get(s->data,5);
memcpy(t->params,arr_data(s->data)+6,t->par_count*2);
t->task_index=arr_get(s->data,off+5);
memcpy(t->params,arr_data(s->data)+off+6,t->par_count*2);
task_slot_add_item(slot,t);
off+=6+t->par_count*2;
}
@@ -233,6 +233,8 @@ static ucport_def *run_task(tran_def *t, uint8_t cmd,array_def *data)
return (ucport_def *)u;
}
transmit_export(ym_slave,0x20,run_task)
// 0x21 是上位机协议的命令字
transmit_export(ym_checker,0x21,run_task)