V2.10 添加写入固定延时任务
EW发送数据前固定50ms延时 can总线发送采用等待的方式
This commit is contained in:
@@ -304,3 +304,7 @@
|
||||
2023.12.21
|
||||
新广播命令测试检测,注码正常,加宽了数据上报的时间片
|
||||
添加异常代码9,槽任务未执行
|
||||
2023.12.22
|
||||
V2.10 添加写入固定延时任务
|
||||
EW发送数据前固定50ms延时
|
||||
can总线发送采用等待的方式
|
||||
|
@@ -966,6 +966,7 @@ static void DMod_SendBytesSelf(uint8_t* buf, uint8_t len, uint16_t pre,uint8_t r
|
||||
|
||||
void DMod_SendBytes(uint8_t* buf, uint8_t len, uint16_t pre,uint8_t rw_flag)
|
||||
{
|
||||
delay_os_ms(50);
|
||||
DMod_SendBytesSelf(buf,len,pre,rw_flag,CheckCRC_8);
|
||||
}
|
||||
|
||||
|
@@ -340,7 +340,7 @@ int elec_err_classify(int err)
|
||||
// 找到异常代码序号
|
||||
int elec_report_err(elec_judge_def *e)
|
||||
{
|
||||
static const uint8_t pro_table[]={1,3,7,8,2,4,5,6,9,20,0};
|
||||
static const uint8_t pro_table[]={1,3,7,8,2,4,5,6,9,10,20,0};
|
||||
uint8_t index=0;
|
||||
for (int i=0;i<sizeof(pro_table);i++){
|
||||
for(int j=0;j<ERR_LIST_LEN;j++){
|
||||
|
@@ -219,6 +219,7 @@ void EW_Test_SetRunCfg()
|
||||
run_cfg.runcfg_st.pwd_len = checker_runcfg.params[5];
|
||||
run_cfg.runcfg_st.version = checker_runcfg.params[6];
|
||||
run_cfg.run_cfg_buf[3] = CheckCRC_8(run_cfg.run_cfg_buf,3);
|
||||
delay_ms(50);
|
||||
uc_rtv = EW_WriteRunCfg(checker_runcfg.netid,&run_cfg);
|
||||
Checker_MaskResult(uc_rtv,checker_runcfg.task_info.runindex);
|
||||
}
|
||||
@@ -1027,6 +1028,7 @@ void EW_Test_ReadSN(void)
|
||||
temp_def temp={0};
|
||||
uint32_t sn;
|
||||
sn=checker_runcfg.params[0]|(checker_runcfg.params[1]<<16);
|
||||
|
||||
if(sn>=134217728)
|
||||
{
|
||||
// 如果流水号超过了2^27 则失败
|
||||
@@ -1074,6 +1076,7 @@ void EW_Test_WriteSN(void)
|
||||
uc_rtv=2;
|
||||
goto end;
|
||||
}
|
||||
delay_ms(50);
|
||||
temp.data=(temp.data&0x1f)|(sn<<5);
|
||||
uc_rtv |= EW_WriteMTP(checker_runcfg.netid,addr,temp.arr,len);
|
||||
if(uc_rtv){
|
||||
@@ -1087,6 +1090,41 @@ void EW_Test_WriteSN(void)
|
||||
|
||||
|
||||
|
||||
// 写固定延时
|
||||
void EW_Test_WriteDelay(void)
|
||||
{
|
||||
uint8_t uc_rtv=0;
|
||||
uint8_t addr[2]={0x18/4,0xa8/4};
|
||||
uint8_t len=2;
|
||||
typedef union{
|
||||
uint8_t arr[2];
|
||||
uint16_t data;
|
||||
}temp_def;
|
||||
temp_def temp={0};
|
||||
uint16_t delay;
|
||||
delay=checker_runcfg.params[0];
|
||||
for(int i=0;i<2;i++)
|
||||
{
|
||||
// delay_ms(50);
|
||||
// uc_rtv|=EW_ReadMTP(checker_runcfg.netid,addr[i],temp.arr,len);
|
||||
// if(uc_rtv){
|
||||
// uc_rtv=1+i;
|
||||
// goto end;
|
||||
// }
|
||||
delay_ms(50);
|
||||
temp.data=delay;
|
||||
uc_rtv |= EW_WriteMTP(checker_runcfg.netid,addr[i],temp.arr,len);
|
||||
if(uc_rtv){
|
||||
uc_rtv=2+i;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
end:
|
||||
Checker_MaskResult(uc_rtv,checker_runcfg.task_info.runindex);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void EW_Empty(void)
|
||||
@@ -1151,6 +1189,7 @@ EW_Test_WriteMTP, //36 写入mtp
|
||||
CheckerExt_SetCbv, //37 设置电阻校准值
|
||||
EW_Test_ReadSN, //38 读取流水号
|
||||
EW_Test_WriteSN, //39 写入流水号
|
||||
EW_Test_WriteDelay, //40 写固定延时
|
||||
(void*)0 //数组结束
|
||||
};
|
||||
|
||||
|
@@ -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 //数组结束
|
||||
};
|
||||
|
||||
|
@@ -6,8 +6,8 @@
|
||||
|
||||
|
||||
|
||||
#define BUILD_DATE "2023-12-21 18:25:05"
|
||||
#define SOFT_VERSION "2.09"
|
||||
#define BUILD_DATE "2023-12-22 18:12:46"
|
||||
#define SOFT_VERSION "2.10"
|
||||
|
||||
|
||||
|
||||
|
@@ -7,7 +7,7 @@ import mycopy
|
||||
|
||||
|
||||
# 定义软件版本号
|
||||
SOFT_VERION = "2.09"
|
||||
SOFT_VERION = "2.10"
|
||||
|
||||
|
||||
|
||||
|
@@ -311,7 +311,9 @@ static void protu_send_ontime(protu_def *p,send_pkt_def *s)
|
||||
}
|
||||
if(p->silent!=0){
|
||||
// 广播命令在指定时间窗口发送
|
||||
later_execute(protu_send_later,s,delay);
|
||||
//later_execute(protu_send_later,s,delay);
|
||||
while(p->timer->read(p->timer)<(tick+delay));
|
||||
protu_send_later(s);
|
||||
}else{
|
||||
// 单播命令直接发送
|
||||
protu_send_later(s);
|
||||
|
Reference in New Issue
Block a user