diff --git a/checher_slave.uvoptx b/checher_slave.uvoptx index 4bc4463..41a04fe 100644 --- a/checher_slave.uvoptx +++ b/checher_slave.uvoptx @@ -491,7 +491,7 @@ core - 0 + 1 0 0 0 diff --git a/checher_slave.uvprojx b/checher_slave.uvprojx index 6be32e7..89cf810 100644 --- a/checher_slave.uvprojx +++ b/checher_slave.uvprojx @@ -10,7 +10,7 @@ app 0x4 ARM-ADS - 5060750::V5.06 update 6 (build 750)::ARMCC + 5060960::V5.06 update 7 (build 960)::.\ARMCC 0 @@ -185,6 +185,7 @@ 0 0 0 + 0 0 0 8 @@ -351,7 +352,7 @@ 0 0 0 - 0 + 4 @@ -1247,6 +1248,7 @@ 0 0 0 + 0 0 0 8 @@ -1413,7 +1415,7 @@ 0 0 0 - 0 + 4 @@ -1860,7 +1862,7 @@ 2 2 2 - 2 + 0 @@ -2924,7 +2926,7 @@ 2 2 2 - 2 + 0 @@ -3466,7 +3468,7 @@ 2 2 2 - 2 + 0 @@ -3570,7 +3572,7 @@ 2 2 2 - 2 + 0 @@ -3649,7 +3651,7 @@ 2 2 2 - 2 + 0 diff --git a/source/ReadMe.txt b/source/ReadMe.txt index 28bbcfc..da659ca 100644 --- a/source/ReadMe.txt +++ b/source/ReadMe.txt @@ -191,4 +191,6 @@ 2023.10.9 实现通过iic下载模块程序,期间自动开启和关闭总线 实现通过总线下载模块程序,crc32校验失败 - +2023.10.9 + 解决任务重试会导致返回数据长度增加的问题 + 修改jwt读取空闲判线算法以自适应返回电流挡位,未验证 diff --git a/source/elec_det/driver/EWDriver.c b/source/elec_det/driver/EWDriver.c index 6bf89bc..1bab9f1 100644 --- a/source/elec_det/driver/EWDriver.c +++ b/source/elec_det/driver/EWDriver.c @@ -17,7 +17,7 @@ static volatile CurrentSample_Range_eu buscurrent_range = Current_Max; #define SMod_Read_Idle_Filter 90 // 根据反码电流改变 -#define DMod_Read_Idle_Filter 300 +#define DMod_Read_Idle_Filter 50 volatile uint16_t* EW_Read_AD_V = FireBus_ADC_Buf; static volatile uint16_t SMod_Read_Idle_C; @@ -483,6 +483,7 @@ uint8_t DMod_FireBusReadDatasV2(uint8_t* buf, uint8_t len, uint32_t time_out) uint32_t us_dataT_Or;//数据周期 uint32_t us_temp1,us_temp2; uint16_t ad_max = 0,ad_max_temp = 0; + uint16_t ad_high_value=0; CurrentSample_Range_eu range = buscurrent_range;//档位保存 Power_SetSampleCurrentRange(R10_2mA_30mA_MC); ADC_CurChnnelSet(AN_MAL_CH,ADC_SPEED_HFAST); @@ -492,40 +493,45 @@ uint8_t DMod_FireBusReadDatasV2(uint8_t* buf, uint8_t len, uint32_t time_out) //延时等待电流稳定 delay_us(800); //COM_PH2_Out = 0; - PBout(I2IC_SCL_Pin_Nu) = 0; + PBout(I2IC_SCL_Pin_Nu) = 0; delay_us(200); //获取中电平电流 - PBout(I2IC_SCL_Pin_Nu) = 1 ; + PBout(I2IC_SCL_Pin_Nu) = 1 ; DMod_GetIdle2V(); - PBout(I2IC_SCL_Pin_Nu) = 0 ; + PBout(I2IC_SCL_Pin_Nu) = 0 ; //读取指定长度数据 - //读取单字节数据 - ul_data = 0; - //等待起始信号唤醒信号 - us_plus_H = 0; - us_plus_T = 0; - us_time_out = 2000 + time_out; - do{ - - ul_ad_sample = ADC_GetCurADCFast(); - if(ad_max < ul_ad_sample) - ad_max = ul_ad_sample; - if(ul_ad_sample > SMod_Read_Idle_C) - { - us_plus_H++; - }else{ - us_plus_H = 0; - } - delay_us(2); - us_time_out--; - } - while((us_plus_H < 4) && (us_time_out > 0)); - if(us_time_out < 1)//等待起始信号超时 - { - EW_DIFF_MOD_H; - Power_SetSampleCurrentRange(range); - return 1; - } + //读取单字节数据 + ul_data = 0; + //等待起始信号唤醒信号 + us_plus_H = 0; + us_plus_T = 0; + us_time_out = 2000 + time_out; + do{ + + ul_ad_sample = ADC_GetCurADCFast(); + if(ad_max < ul_ad_sample) + ad_max = ul_ad_sample; + if(ul_ad_sample > SMod_Read_Idle_C) + { + us_plus_H++; + ad_high_value=ad_high_value/2+ul_ad_sample/2; + }else{ + us_plus_H = 0; + ad_high_value=0; + } + delay_us(2); + us_time_out--; + } + while((us_plus_H < 4) && (us_time_out > 0)); + if(us_time_out < 1)//等待起始信号超时 + { + EW_DIFF_MOD_H; + Power_SetSampleCurrentRange(range); + return 1; + } + + // 空闲判线以最高电平为基准 + SMod_Read_Idle_C=ad_high_value-50; while(len > 0) { @@ -916,7 +922,7 @@ uint8_t EW_WriteMTP(uint16_t addr,uint8_t mtpaddr,uint8_t* buf,uint8_t len) len = 10; } EW_CommBuf[3] = len; - memcpy((void*)EW_CommBuf+4,buf,len); + memcpy((void*)(EW_CommBuf+4),buf,len); DMod_SendBytes((uint8_t*)EW_CommBuf,len+4,EW_DMOD_Peroid,uc_readflag); if(uc_readflag == 0) { @@ -956,7 +962,7 @@ uint8_t EW_ReadMTP(uint16_t addr,uint8_t mtpaddr,uint8_t* buf,uint8_t len) len = 10; } EW_CommBuf[3] = len; - memcpy((void*)EW_CommBuf+4,buf,len); + memcpy((void*)(EW_CommBuf+4),buf,len); DMod_SendBytes((uint8_t*)EW_CommBuf,len+4,EW_DMOD_Peroid,uc_readflag); if(uc_readflag == 0) { @@ -987,7 +993,7 @@ uint8_t EW_RunBootLoader(uint16_t addr,uint8_t reboot) { ul_bootflag = 0x9966AA55; } - memcpy((void*)EW_CommBuf+2,&ul_bootflag,4); + memcpy((void*)(EW_CommBuf+2),&ul_bootflag,4); DMod_SendBytes((uint8_t*)EW_CommBuf,6,EW_DMOD_Peroid,0); return 0; } @@ -1009,7 +1015,7 @@ uint8_t EW_WriteRunCfg(uint16_t addr,RunCfg_un* runcfg) addr = (addr & 0xFFC0) | 20; EW_CommBuf[0] = addr&0xFF; EW_CommBuf[1] = (addr >> 8)&0xFF; - memcpy((void*)EW_CommBuf+2,&runcfg,3); + memcpy((void*)(EW_CommBuf+2),&runcfg,3); DMod_SendBytes((uint8_t*)EW_CommBuf,6,EW_DMOD_Peroid,uc_readflag); if(uc_readflag == 0) { @@ -1045,7 +1051,7 @@ uint8_t EW_SetAddrByUID(uint16_t addr,uint8_t* uid,uint8_t uid_len,uint8_t* ack_ addr = (addr & 0xFFC0) | 21; EW_CommBuf[0] = addr&0xFF; EW_CommBuf[1] = (addr >> 8)&0xFF; - memcpy((void*)EW_CommBuf+2,uid,uid_len); + memcpy((void*)(EW_CommBuf+2),uid,uid_len); DMod_SendBytes((uint8_t*)EW_CommBuf,uid_len+2,EW_DMOD_Peroid,uc_readflag); if(uc_readflag == 0) { @@ -1084,7 +1090,7 @@ uint8_t EW_FastSetByUID(uint16_t addr,uint16_t delay, uint8_t pwd_flag,uint8_t* EW_CommBuf[0] = addr&0xFF; EW_CommBuf[1] = (addr >> 8)&0xFF; EW_CommBuf[2] = pwd_flag; - memcpy(((void*)(EW_CommBuf)+3),&delay,2); + memcpy((void*)(EW_CommBuf+3),&delay,2); memcpy((void*)(EW_CommBuf+5),uid,uid_len); uid_len +=5; DMod_SendBytes(((uint8_t*)(EW_CommBuf)),uid_len,EW_DMOD_Peroid,uc_readflag); @@ -1115,7 +1121,7 @@ uint8_t EW_SetDelay(uint16_t addr,uint16_t delay) addr = (addr & 0xFFC0) | 23; EW_CommBuf[0] = addr&0xFF; EW_CommBuf[1] = (addr >> 8)&0xFF; - memcpy((void*)EW_CommBuf+2,&delay,2); + memcpy((void*)(EW_CommBuf+2),&delay,2); DMod_SendBytes((uint8_t*)EW_CommBuf,4,EW_DMOD_Peroid,0); uc_ack = DMod_FireBusReadDatasV2((uint8_t*)EW_CommBuf+2,2,EW_DMOD_READ_Timeout); if(EW_CommBuf[0] != EW_CommBuf[2] || EW_CommBuf[1] != EW_CommBuf[3]) @@ -1139,7 +1145,7 @@ uint8_t EW_VerfyPWD(uint16_t addr,uint8_t* pwd,uint8_t pwd_len) addr = (addr & 0xFFC0) | 24; EW_CommBuf[0] = addr&0xFF; EW_CommBuf[1] = (addr >> 8)&0xFF; - memcpy((void*)EW_CommBuf+2,pwd,pwd_len); + memcpy((void*)(EW_CommBuf+2),pwd,pwd_len); pwd_len += 2; DMod_SendBytes((uint8_t*)EW_CommBuf,pwd_len,EW_DMOD_Peroid,0); return 0; @@ -1417,7 +1423,7 @@ uint8_t EW_UpdateCommAddr(uint8_t addr,uint16_t new_addr) addr = (addr & 0xFFC0) | 36; EW_CommBuf[0] = addr&0xFF; EW_CommBuf[1] = (addr >> 8)&0xFF; - memcpy((void*)EW_CommBuf+2,&new_addr,2); + memcpy((void*)(EW_CommBuf+2),&new_addr,2); DMod_SendBytes((uint8_t*)EW_CommBuf,4,EW_DMOD_Peroid,uc_readflag); if(uc_readflag == 0) { diff --git a/source/elec_det/elec_det.c b/source/elec_det/elec_det.c index 1c2e62e..d062442 100644 --- a/source/elec_det/elec_det.c +++ b/source/elec_det/elec_det.c @@ -196,7 +196,7 @@ static void elec_load_scheme(void) array_def *elec_check_with_scheme(array_def *uid_psw) { self_def *s=&g_self; - const uint8_t* ptaskindex = (uint8_t*)(APP_TEST_PLAN_ADDR+4); + const uint8_t* taskid_table = (uint8_t*)(APP_TEST_PLAN_ADDR+4); CheckerTask *tasks_fun_table[]={jqtaskArray,xttaskArray,ewtaskArray}; CheckerTask_Info_st *task_par=0; uint8_t chip_type=0; @@ -219,9 +219,9 @@ array_def *elec_check_with_scheme(array_def *uid_psw) int task_index=0; int err_flag=0; LED1_Out_Off; - while((ptaskindex[task_index]!=0xff)&&(task_index