diff --git a/checher_slave.uvoptx b/checher_slave.uvoptx index dd38578..9ece02a 100644 --- a/checher_slave.uvoptx +++ b/checher_slave.uvoptx @@ -377,7 +377,24 @@ - + + + 0 + 0 + 100 + 1 +
134265794
+ 0 + 0 + 0 + 0 + 0 + 1 + D:\work\SVN\鍐夊窛\mcu_program\checker_slave\source\elec_det\interface\JQChecker.c + + \\checker_slave_app\source/elec_det/interface/JQChecker.c\100 +
+
0 @@ -388,8 +405,8 @@ 1 - 8 - file + 0 + 0x0803b800 0 diff --git a/source/ReadMe.txt b/source/ReadMe.txt index f73065d..a897874 100644 --- a/source/ReadMe.txt +++ b/source/ReadMe.txt @@ -304,3 +304,7 @@ 2023.12.21 新广播命令测试检测,注码正常,加宽了数据上报的时间片 添加异常代码9,槽任务未执行 +2023.12.22 + V2.10 添加写入固定延时任务 + EW发送数据前固定50ms延时 + can总线发送采用等待的方式 diff --git a/source/elec_det/driver/EWDriver.c b/source/elec_det/driver/EWDriver.c index bab941c..e1c9001 100644 --- a/source/elec_det/driver/EWDriver.c +++ b/source/elec_det/driver/EWDriver.c @@ -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); } diff --git a/source/elec_det/elec_judge.c b/source/elec_det/elec_judge.c index b9de1cf..b4eed89 100644 --- a/source/elec_det/elec_judge.c +++ b/source/elec_det/elec_judge.c @@ -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=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 //数组结束 }; diff --git a/source/elec_det/interface/JQChecker.c b/source/elec_det/interface/JQChecker.c index 646a29d..49eb147 100644 --- a/source/elec_det/interface/JQChecker.c +++ b/source/elec_det/interface/JQChecker.c @@ -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 //数组结束 }; diff --git a/source/main/compiler_info.h b/source/main/compiler_info.h index 6aa1e74..d867b0d 100644 --- a/source/main/compiler_info.h +++ b/source/main/compiler_info.h @@ -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" diff --git a/source/prebuild.py b/source/prebuild.py index ec3fc4b..6827ad5 100644 --- a/source/prebuild.py +++ b/source/prebuild.py @@ -7,7 +7,7 @@ import mycopy # 定义软件版本号 -SOFT_VERION = "2.09" +SOFT_VERION = "2.10" diff --git a/source/task/prot_uc.c b/source/task/prot_uc.c index 3365cb6..f7c35b1 100644 --- a/source/task/prot_uc.c +++ b/source/task/prot_uc.c @@ -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);