解决EW写流水号数组越界的bug
解决0x20指令只会解析第一个槽参数的bug ew写延时添加crc8
This commit is contained in:
@@ -639,16 +639,16 @@
|
|||||||
<MemoryWindow1>
|
<MemoryWindow1>
|
||||||
<Mm>
|
<Mm>
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<SubType>0</SubType>
|
<SubType>1</SubType>
|
||||||
<ItemText>0x20007958</ItemText>
|
<ItemText>0x20003b00</ItemText>
|
||||||
<AccSizeX>0</AccSizeX>
|
<AccSizeX>0</AccSizeX>
|
||||||
</Mm>
|
</Mm>
|
||||||
</MemoryWindow1>
|
</MemoryWindow1>
|
||||||
<MemoryWindow2>
|
<MemoryWindow2>
|
||||||
<Mm>
|
<Mm>
|
||||||
<WinNumber>2</WinNumber>
|
<WinNumber>2</WinNumber>
|
||||||
<SubType>0</SubType>
|
<SubType>1</SubType>
|
||||||
<ItemText>0x0803B000</ItemText>
|
<ItemText>0x200079a0</ItemText>
|
||||||
<AccSizeX>0</AccSizeX>
|
<AccSizeX>0</AccSizeX>
|
||||||
</Mm>
|
</Mm>
|
||||||
</MemoryWindow2>
|
</MemoryWindow2>
|
||||||
|
@@ -308,3 +308,7 @@
|
|||||||
V2.10 添加写入固定延时任务
|
V2.10 添加写入固定延时任务
|
||||||
EW发送数据前固定50ms延时
|
EW发送数据前固定50ms延时
|
||||||
can总线发送采用等待的方式
|
can总线发送采用等待的方式
|
||||||
|
2023.12.25
|
||||||
|
解决EW写流水号数组越界的bug
|
||||||
|
解决0x20指令只会解析第一个槽参数的bug
|
||||||
|
ew写延时添加crc8
|
||||||
|
@@ -1021,8 +1021,9 @@ void EW_Test_ReadSN(void)
|
|||||||
uint8_t uc_rtv=0;
|
uint8_t uc_rtv=0;
|
||||||
uint8_t addr=9;
|
uint8_t addr=9;
|
||||||
uint8_t len=4;
|
uint8_t len=4;
|
||||||
|
// 缓存开大一点防止数据越界
|
||||||
typedef union{
|
typedef union{
|
||||||
uint8_t arr[4];
|
uint8_t arr[6];
|
||||||
uint32_t data;
|
uint32_t data;
|
||||||
}temp_def;
|
}temp_def;
|
||||||
temp_def temp={0};
|
temp_def temp={0};
|
||||||
@@ -1057,13 +1058,15 @@ void EW_Test_WriteSN(void)
|
|||||||
uint8_t uc_rtv=0;
|
uint8_t uc_rtv=0;
|
||||||
uint8_t addr=9;
|
uint8_t addr=9;
|
||||||
uint8_t len=4;
|
uint8_t len=4;
|
||||||
|
// 缓存开大一点防止数据越界
|
||||||
typedef union{
|
typedef union{
|
||||||
uint8_t arr[4];
|
uint8_t arr[6];
|
||||||
uint32_t data;
|
uint32_t data;
|
||||||
}temp_def;
|
}temp_def;
|
||||||
temp_def temp={0};
|
temp_def temp={0};
|
||||||
uint32_t sn;
|
uint32_t sn;
|
||||||
delay_ms(50);
|
delay_ms(50);
|
||||||
|
sn=checker_runcfg.params[0]|(checker_runcfg.params[1]<<16);
|
||||||
uc_rtv|=EW_ReadMTP(checker_runcfg.netid,addr,temp.arr,len);
|
uc_rtv|=EW_ReadMTP(checker_runcfg.netid,addr,temp.arr,len);
|
||||||
if(uc_rtv){
|
if(uc_rtv){
|
||||||
uc_rtv=1;
|
uc_rtv=1;
|
||||||
@@ -1095,9 +1098,10 @@ void EW_Test_WriteDelay(void)
|
|||||||
{
|
{
|
||||||
uint8_t uc_rtv=0;
|
uint8_t uc_rtv=0;
|
||||||
uint8_t addr[2]={0x18/4,0xa8/4};
|
uint8_t addr[2]={0x18/4,0xa8/4};
|
||||||
uint8_t len=2;
|
uint8_t len=3;
|
||||||
|
// 缓存开大一点防止数据越界
|
||||||
typedef union{
|
typedef union{
|
||||||
uint8_t arr[2];
|
uint8_t arr[6];
|
||||||
uint16_t data;
|
uint16_t data;
|
||||||
}temp_def;
|
}temp_def;
|
||||||
temp_def temp={0};
|
temp_def temp={0};
|
||||||
@@ -1113,6 +1117,7 @@ void EW_Test_WriteDelay(void)
|
|||||||
// }
|
// }
|
||||||
delay_ms(50);
|
delay_ms(50);
|
||||||
temp.data=delay;
|
temp.data=delay;
|
||||||
|
temp.arr[2]=CheckCRC_8(temp.arr,2);
|
||||||
uc_rtv |= EW_WriteMTP(checker_runcfg.netid,addr[i],temp.arr,len);
|
uc_rtv |= EW_WriteMTP(checker_runcfg.netid,addr[i],temp.arr,len);
|
||||||
if(uc_rtv){
|
if(uc_rtv){
|
||||||
uc_rtv=2+i;
|
uc_rtv=2+i;
|
||||||
|
@@ -1233,8 +1233,9 @@ void JQ_Test_WriteSN(void)
|
|||||||
uint8_t uc_ack;
|
uint8_t uc_ack;
|
||||||
uint8_t uc_otpAddr = 20;
|
uint8_t uc_otpAddr = 20;
|
||||||
uint8_t uc_writeCount = 4;
|
uint8_t uc_writeCount = 4;
|
||||||
|
// 缓存开大一点防止数据越界
|
||||||
typedef union{
|
typedef union{
|
||||||
uint8_t arr[4];
|
uint8_t arr[6];
|
||||||
uint32_t data;
|
uint32_t data;
|
||||||
}temp_def;
|
}temp_def;
|
||||||
temp_def temp={0};
|
temp_def temp={0};
|
||||||
@@ -1295,8 +1296,9 @@ void JQ_Test_ReadSN(void)
|
|||||||
uint8_t uc_ack;
|
uint8_t uc_ack;
|
||||||
uint8_t uc_otpAddr = 20;
|
uint8_t uc_otpAddr = 20;
|
||||||
uint8_t uc_writeCount = 4;
|
uint8_t uc_writeCount = 4;
|
||||||
|
// 缓存开大一点防止数据越界
|
||||||
typedef union{
|
typedef union{
|
||||||
uint8_t arr[4];
|
uint8_t arr[6];
|
||||||
uint32_t data;
|
uint32_t data;
|
||||||
}temp_def;
|
}temp_def;
|
||||||
temp_def temp={0};
|
temp_def temp={0};
|
||||||
@@ -1347,8 +1349,9 @@ void JQ_Test_WriteDelay(void)
|
|||||||
uint8_t uc_ack;
|
uint8_t uc_ack;
|
||||||
uint8_t uc_otpAddr = 15;
|
uint8_t uc_otpAddr = 15;
|
||||||
uint8_t uc_writeCount = 2;
|
uint8_t uc_writeCount = 2;
|
||||||
|
// 缓存开大一点防止数据越界
|
||||||
typedef union{
|
typedef union{
|
||||||
uint8_t arr[2];
|
uint8_t arr[4];
|
||||||
uint16_t data;
|
uint16_t data;
|
||||||
}temp_def;
|
}temp_def;
|
||||||
temp_def temp={0};
|
temp_def temp={0};
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define BUILD_DATE "2023-12-22 18:12:46"
|
#define BUILD_DATE "2023-12-25 17:21:14"
|
||||||
#define SOFT_VERSION "2.10"
|
#define SOFT_VERSION "2.10"
|
||||||
|
|
||||||
|
|
||||||
|
@@ -113,14 +113,14 @@ static void slave_adds(self_def *s)
|
|||||||
task_slot_delete();
|
task_slot_delete();
|
||||||
slot=task_slot_init();
|
slot=task_slot_init();
|
||||||
while(off<len){
|
while(off<len){
|
||||||
t->slot_index=arr_get(s->data,0);
|
t->slot_index=arr_get(s->data,off);
|
||||||
t->task_id=arr_get(s->data,1);
|
t->task_id=arr_get(s->data,off+1);
|
||||||
t->par_count=arr_get(s->data,2);
|
t->par_count=arr_get(s->data,off+2);
|
||||||
t->ret_count=arr_get(s->data,3);
|
t->ret_count=arr_get(s->data,off+3);
|
||||||
t->errcode=arr_get(s->data,4);
|
t->errcode=arr_get(s->data,off+4);
|
||||||
t->exe_flag=0;
|
t->exe_flag=0;
|
||||||
t->task_index=arr_get(s->data,5);
|
t->task_index=arr_get(s->data,off+5);
|
||||||
memcpy(t->params,arr_data(s->data)+6,t->par_count*2);
|
memcpy(t->params,arr_data(s->data)+off+6,t->par_count*2);
|
||||||
task_slot_add_item(slot,t);
|
task_slot_add_item(slot,t);
|
||||||
off+=6+t->par_count*2;
|
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;
|
return (ucport_def *)u;
|
||||||
}
|
}
|
||||||
transmit_export(ym_slave,0x20,run_task)
|
transmit_export(ym_slave,0x20,run_task)
|
||||||
|
// 0x21 是上位机协议的命令字
|
||||||
|
transmit_export(ym_checker,0x21,run_task)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user