From d51cef720f654d6a8ccaed3903ec6484f2873051 Mon Sep 17 00:00:00 2001 From: ranchuan Date: Thu, 14 Dec 2023 18:57:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9exchecker=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/codec/codec.c | 14 ++++++++++++++ source/elec_det/elec_io.c | 7 +++++++ source/elec_det/interface/EWChecker.c | 22 +++++++++++++--------- 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/source/codec/codec.c b/source/codec/codec.c index a98b877..9c19df0 100644 --- a/source/codec/codec.c +++ b/source/codec/codec.c @@ -311,3 +311,17 @@ array_def *protm_encode(protu_def *p,array_def *data) protuc_codec_export(ym_slave,protm_decode,protm_encode); + + + +// 小板ew协议解码 +array_def *protew_decode(protu_def *p,array_def *data) +{ + +} +array_def *protew_encode(protu_def *p,array_def *data) +{ +} +protuc_codec_export(ew_slave,protm_decode,protm_encode); + + diff --git a/source/elec_det/elec_io.c b/source/elec_det/elec_io.c index cee0124..8df7647 100644 --- a/source/elec_det/elec_io.c +++ b/source/elec_det/elec_io.c @@ -63,3 +63,10 @@ void Ye_RunPlanCheckTest(void) + + + + + + + diff --git a/source/elec_det/interface/EWChecker.c b/source/elec_det/interface/EWChecker.c index 6f4308c..d7b916f 100644 --- a/source/elec_det/interface/EWChecker.c +++ b/source/elec_det/interface/EWChecker.c @@ -28,6 +28,7 @@ uint8_t EW_RunBuf[EW_CHECKER_RUN_BUF]; @param0 总线电压 @param1 超时时间 0.1ms @param2 充电结束时的AD值 +@rtv0 返回总线电压 @rtv1 返回总线电流低于设置AD值的时间 */ void EW_Test_PowerOn() @@ -73,8 +74,8 @@ void EW_Test_SetBusV(void) us_m_v = ((us_h_v/80)+2)*60; delay_ms(us_m_v); us_h_v = Power_GetBousV(); - Checker_SetRtv(&us_h_v,cfg->rtv_count); } + Checker_SetRtv(&us_h_v,cfg->rtv_count); Checker_MaskResult(uc_rtv,cfg->task_info.runindex); } @@ -106,6 +107,7 @@ void EW_Test_EnMTP(void) { uint8_t uc_ack = 0; uc_ack = EW_EnWriteMTP(checker_runcfg.netid,checker_runcfg.params[0]); + delay_ms(5); Checker_MaskResult(uc_ack,checker_runcfg.task_info.runindex); } @@ -244,29 +246,29 @@ void EW_Test_CheckRunCfg() } if(run_cfg.runcfg_st.vbus_rx_sg != checker_runcfg.params[1]) { - uc_rtv |= 0x01; + uc_rtv |= 0x02; } if(run_cfg.runcfg_st.vbus_mode != checker_runcfg.params[2]) { - uc_rtv |= 0x01; + uc_rtv |= 0x04; } if(run_cfg.runcfg_st.reset_run_step != checker_runcfg.params[3]) { - uc_rtv |= 0x01; + uc_rtv |= 0x08; } checker_runcfg.uid_len = checker_runcfg.params[4]; if((checker_runcfg.params[4] <7 ) || (run_cfg.runcfg_st.uid_len != (checker_runcfg.params[4])-7)) { - uc_rtv |= 0x01; + uc_rtv |= 0x10; } checker_runcfg.pwd_len = checker_runcfg.params[5]; if((checker_runcfg.params[5] < 4) ||(run_cfg.runcfg_st.pwd_len != (checker_runcfg.params[5] - 4))) { - uc_rtv |= 0x01; + uc_rtv |= 0x20; } if(run_cfg.runcfg_st.version != checker_runcfg.params[6]) { - uc_rtv |= 0x01; + uc_rtv |= 0x40; } memcpy(aus_temp,run_cfg.run_cfg_buf,4); Checker_MaskResult(uc_rtv,checker_runcfg.task_info.runindex); @@ -458,9 +460,10 @@ void EW_Test_CheckeState(void) if(uc_rtv > 0 || ((state.us_data[0] & checker_runcfg.params[0] )!= checker_runcfg.params[1])) { Checker_MaskResult(1,checker_runcfg.task_info.runindex); + Checker_SetRtv((uint16_t*)state.us_data,checker_runcfg.rtv_count); return; } - Checker_MaskResult(1,checker_runcfg.task_info.runindex); + Checker_MaskResult(0,checker_runcfg.task_info.runindex); Checker_SetRtv((uint16_t*)state.us_data,checker_runcfg.rtv_count); } @@ -605,7 +608,7 @@ void EW_Test_ClkAmend() uint8_t uc_rtv = 0; uint32_t ul_temp = 0; uc_rtv = EW_ClkAmend(checker_runcfg.netid,checker_runcfg.params[0],checker_runcfg.params[1]); - delay_os_ms(100); + delay_os_ms(1000); uc_rtv |= EW_ReadClkAmend(checker_runcfg.netid,&ul_temp); ul_temp >>= 2; Checker_SetRtv((uint16_t*)&ul_temp,checker_runcfg.rtv_count); @@ -627,6 +630,7 @@ void EW_Test_SetAddr(void) if(checker_runcfg.params[1] == 0) { Checker_MaskResult(uc_rtv,checker_runcfg.task_info.runindex); + Checker_SetRtv(&us_temp,checker_runcfg.rtv_count); return; } if(checker_runcfg.params[1] == 1)