V2.10 添加写入固定延时任务

EW发送数据前固定50ms延时
    can总线发送采用等待的方式
This commit is contained in:
ranchuan
2023-12-22 19:05:19 +08:00
parent 6cf5e9e720
commit 5c2648d33c
9 changed files with 131 additions and 8 deletions

View File

@@ -1336,6 +1336,65 @@ void JQ_Test_ReadSN(void)
/*rc{
写入固定延时
par0,延时信息
}*/
void JQ_Test_WriteDelay(void)
{
uint8_t uc_rtv = 0;
uint8_t uc_ack;
uint8_t uc_otpAddr = 15;
uint8_t uc_writeCount = 2;
typedef union{
uint8_t arr[2];
uint16_t data;
}temp_def;
temp_def temp={0};
uint16_t delay=0;
delay=checker_runcfg.params[0];
JQ_EnWOTP();
JQ_EnWOTP();
for(int i = 0; i < uc_writeCount;i++)
{
uc_ack = JQ_ReadOTP(CHECKER_NET_ID,uc_otpAddr+i,1,temp.arr+i);
if(uc_ack < 1)
{
uc_rtv = 1;
goto end;
}
}
// 流水号域如果有值且不为要设置的延时值则失败
if(temp.data!=0){
if(temp.data!=delay){
uc_rtv=2;
}
goto end;
}
temp.data=delay;
for(int i = 0; i < uc_writeCount;i++)
{
uc_ack = JQ_WriteOTP(uc_otpAddr+i,1,temp.arr+i);
if(uc_ack != 1)
{
uc_rtv = 3;
goto end;
}
}
end:
Checker_MaskResult(uc_rtv,checker_runcfg.task_info.runindex);
return;
}
CheckerTask jqtaskArray[CHECKER_MAXID_COUNT] ={
Checker_PowerPrapare, //0 电源准备
JQ_Test_PowerOn, //1 上电充能
@@ -1383,6 +1442,7 @@ CheckerExt_Slot ,//42 任务插槽
CheckerExt_SetCbv ,//43 设置电阻校准值
JQ_Test_WriteSN ,//44 写入流水号
JQ_Test_ReadSN ,//45 读取流水号
JQ_Test_WriteDelay ,//46 写固定延时
(void*)0 //数组结束
};