diff --git a/apps/chrg/applications/thread/chrg_roll_sou.c b/apps/chrg/applications/thread/chrg_roll_sou.c index 4c91f93..3612cd7 100644 --- a/apps/chrg/applications/thread/chrg_roll_sou.c +++ b/apps/chrg/applications/thread/chrg_roll_sou.c @@ -16,6 +16,7 @@ #include "chrg_thread.h" #include "chrg_roll_sou.h" #include "chrg_north.h" +#include "chrg_sink.h" #include "chrg_eload.h" #include "chrg_utils.h" @@ -782,6 +783,7 @@ void chrg_roll_sou_thread_entry (void *data) struct chrg_thread_t *pTS = &chrgthr[IDX_THR_SOUTH]; struct mb_msg_t *pMB_R = RT_NULL; while (1) { + chrg_sink_short_keepalive_process(); rt_mutex_take(pTHR->mutex, RT_WAITING_FOREVER); run = pROLL->run; single_ch = pROLL->ch; diff --git a/apps/chrg/applications/utils/chrg_sink.c b/apps/chrg/applications/utils/chrg_sink.c index f8ddb60..9ee9355 100644 --- a/apps/chrg/applications/utils/chrg_sink.c +++ b/apps/chrg/applications/utils/chrg_sink.c @@ -23,6 +23,7 @@ #define SINK_UNLOAD_QUERY_INTERVAL_MS 20U // 卸载期间两次优先量测请求的最小间隔 #define SINK_UNLOAD_CURRENT_MAX_MA 200U // 判定负载已安全卸载的最大实际电流 #define SINK_UNLOAD_CONFIRM_COUNT 2U // 连续满足低电流条件的量测帧数 +#define SINK_SHORT_KEEPALIVE_MS 30U // 短路测试WORK_START保活下发周期 /* 主继电器闭合跟踪:1=已提交ALL_REL_ON(主继电器应已闭合) 0=未闭合/已断开。 * 用于0V硬保护区分"首次开载/握手恢复"(主继电器未闭合,Now_voltage=0属正常) @@ -958,6 +959,23 @@ int chrg_sink_volt_judge(eIDX_SOU_CH idx, struct chrg_switch_t *pSW) return chrg_sink_work(idx, pSW); } +void chrg_sink_short_keepalive_process(void) +{ + eIDX_SOU_CH idx; + struct chrg_switch_t *pSW; + + for (idx = IDX_SOU_CH1; idx < TOTAL_SOU_CHS; idx++) { + pSW = &chrgnorth.sw[idx]; + if ((pSW->id != ID_SINK) || + (pSW->sink.work_mode != SINK_WORK_ON_TEST_SHORT) || + (pSW->sink.test.test_mode != SINK_TEST_SHORT)) { + g_sink_short_start_tick[idx] = 0U; + continue; + } + (void)chrg_sink_TEST_SHORT_KEEPALIVE(idx); + } +} + /***************************************************************** 函数名称: chrg_sink_TEST_OCP_ON 函数描述: 配置并启动负载OCP过流保护测试 @@ -1021,6 +1039,9 @@ int chrg_sink_work(eIDX_SOU_CH idx, struct chrg_switch_t *pSW) (work_mode != SINK_WORK_UNLOAD_WAIT) && (work_mode != SINK_WORK_LOW_AUX_WAIT) && (work_mode != SINK_WORK_HANDSHAKE_WAIT)) { + if (work_mode == SINK_WORK_ON_TEST_SHORT) { + return chrg_sink_TEST_SHORT_KEEPALIVE(idx); + } return 0; } switch(work_mode){ diff --git a/apps/chrg/applications/utils/chrg_sink.h b/apps/chrg/applications/utils/chrg_sink.h index 504ce31..92a185a 100644 --- a/apps/chrg/applications/utils/chrg_sink.h +++ b/apps/chrg/applications/utils/chrg_sink.h @@ -418,6 +418,7 @@ extern void chrg_nor_sink_test_run(rt_uint8_t ch, struct chrg_switch_t *pSW); extern rt_bool_t chrg_sink_load_should_start(const struct chrg_switch_t *pSW); extern int chrg_sink_work(eIDX_SOU_CH idx, struct chrg_switch_t *pSW); extern int chrg_sink_volt_judge(eIDX_SOU_CH idx, struct chrg_switch_t *pSW); +extern void chrg_sink_short_keepalive_process(void); #endif