解决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

@@ -1021,8 +1021,9 @@ void EW_Test_ReadSN(void)
uint8_t uc_rtv=0;
uint8_t addr=9;
uint8_t len=4;
// 缓存开大一点防止数据越界
typedef union{
uint8_t arr[4];
uint8_t arr[6];
uint32_t data;
}temp_def;
temp_def temp={0};
@@ -1057,13 +1058,15 @@ void EW_Test_WriteSN(void)
uint8_t uc_rtv=0;
uint8_t addr=9;
uint8_t len=4;
// 缓存开大一点防止数据越界
typedef union{
uint8_t arr[4];
uint8_t arr[6];
uint32_t data;
}temp_def;
temp_def temp={0};
uint32_t sn;
delay_ms(50);
sn=checker_runcfg.params[0]|(checker_runcfg.params[1]<<16);
uc_rtv|=EW_ReadMTP(checker_runcfg.netid,addr,temp.arr,len);
if(uc_rtv){
uc_rtv=1;
@@ -1095,9 +1098,10 @@ void EW_Test_WriteDelay(void)
{
uint8_t uc_rtv=0;
uint8_t addr[2]={0x18/4,0xa8/4};
uint8_t len=2;
uint8_t len=3;
// 缓存开大一点防止数据越界
typedef union{
uint8_t arr[2];
uint8_t arr[6];
uint16_t data;
}temp_def;
temp_def temp={0};
@@ -1113,6 +1117,7 @@ void EW_Test_WriteDelay(void)
// }
delay_ms(50);
temp.data=delay;
temp.arr[2]=CheckCRC_8(temp.arr,2);
uc_rtv |= EW_WriteMTP(checker_runcfg.netid,addr[i],temp.arr,len);
if(uc_rtv){
uc_rtv=2+i;

View File

@@ -1233,8 +1233,9 @@ void JQ_Test_WriteSN(void)
uint8_t uc_ack;
uint8_t uc_otpAddr = 20;
uint8_t uc_writeCount = 4;
// 缓存开大一点防止数据越界
typedef union{
uint8_t arr[4];
uint8_t arr[6];
uint32_t data;
}temp_def;
temp_def temp={0};
@@ -1295,8 +1296,9 @@ void JQ_Test_ReadSN(void)
uint8_t uc_ack;
uint8_t uc_otpAddr = 20;
uint8_t uc_writeCount = 4;
// 缓存开大一点防止数据越界
typedef union{
uint8_t arr[4];
uint8_t arr[6];
uint32_t data;
}temp_def;
temp_def temp={0};
@@ -1347,8 +1349,9 @@ void JQ_Test_WriteDelay(void)
uint8_t uc_ack;
uint8_t uc_otpAddr = 15;
uint8_t uc_writeCount = 2;
// 缓存开大一点防止数据越界
typedef union{
uint8_t arr[2];
uint8_t arr[4];
uint16_t data;
}temp_def;
temp_def temp={0};