feat: 调整负载启动、掉电恢复及协议切换时序
详细修改: 1. 新增chrg_eload_get_sample_seq接口获取量测更新序号 2. 关闭LCD接收功能避免阻塞量测上报 3. 新增Sink北向事务状态枚举,区分完整重握手和软卸载流程 4. 调整北向调试开关配置,开启南向寄存器写命令调试 5. 重构Sink状态机,拆分INIT等待、掉电恢复、软卸载等阶段 6. 优化协议切换逻辑:仅电压变化使用软卸载,其余变更执行完整重握手 7. 增加电压稳定确认次数,避免瞬态电压误触发运行状态 8. 新增南向批量命令状态查询和优先量测请求功能 9. 调整继电器操作时序,副继电器回码后再执行后续初始化命令 10. 新增修改日志文档记录版本变更
This commit is contained in:
@@ -2336,8 +2336,8 @@ static void chrg_comm_get_param_diff(eIDX_ID role,
|
||||
static eMBException chrg_comm_apply_sink_effect(rt_uint8_t ch,
|
||||
struct chrg_switch_t *pReal, const struct chrg_switch_t *pShadow)
|
||||
{
|
||||
rt_bool_t protocol_or_cc_change;
|
||||
rt_bool_t protocol_param_change;
|
||||
rt_bool_t full_handshake_change;
|
||||
rt_bool_t protocol_voltage_only;
|
||||
rt_uint8_t curr_test;
|
||||
rt_uint8_t curr_test_old;
|
||||
rt_uint8_t old_cv_mode = pReal->CV_mode;
|
||||
@@ -2347,11 +2347,14 @@ static eMBException chrg_comm_apply_sink_effect(rt_uint8_t ch,
|
||||
chrg_param_diff_t diff_info;
|
||||
|
||||
chrg_comm_get_param_diff(ID_SINK, pReal, pShadow, &diff_info);
|
||||
/* 协议类型或CC线变化:需卸载后从CC开始重新配置北向协议链路 */
|
||||
protocol_or_cc_change = diff_info.protocol_changed || diff_info.cc_changed;
|
||||
/* 同协议下组号/协议电压/协议电流变化:卸载后重发协议,不重设CC */
|
||||
protocol_param_change = diff_info.group_changed ||
|
||||
diff_info.pro_voltage_changed || diff_info.pro_current_changed;
|
||||
/*
|
||||
* 协议类型、CC、协议组号或协议电流变化都按完整重握手处理。
|
||||
* 只有单独修改协议电压时才允许仅掉载而不切换南向继电器。
|
||||
*/
|
||||
full_handshake_change = diff_info.protocol_changed || diff_info.cc_changed ||
|
||||
diff_info.group_changed || diff_info.pro_current_changed;
|
||||
protocol_voltage_only = diff_info.pro_voltage_changed &&
|
||||
!full_handshake_change;
|
||||
rt_memcpy(pReal, pShadow, sizeof(struct chrg_switch_t));
|
||||
|
||||
if (sink_work == 0x01) {
|
||||
@@ -2369,18 +2372,21 @@ static eMBException chrg_comm_apply_sink_effect(rt_uint8_t ch,
|
||||
}
|
||||
pReal->sink.test.test_mode_old = curr_test;
|
||||
} else {
|
||||
pReal->sub = IDX_SET_SINK_CCLINE;
|
||||
pReal->sub = IDX_SET_SINK_PD;
|
||||
pReal->sink.work_mode = SINK_WORK_INIT;
|
||||
}
|
||||
} else if (pReal->sink.On_work == 0) {
|
||||
pReal->sink.On_work = 1;
|
||||
pReal->sub = IDX_SET_SINK_CCLINE;
|
||||
pReal->sink.work_mode = SINK_WORK_INIT;
|
||||
} else if (protocol_or_cc_change) {
|
||||
pReal->sub = IDX_SET_SINK_CCLINE;
|
||||
pReal->sink.work_mode = SINK_WORK_PROTOCOL_UNLOAD;
|
||||
} else if (protocol_param_change) {
|
||||
pReal->sub = IDX_SET_SINK_PD;
|
||||
pReal->sink.work_mode = SINK_WORK_INIT;
|
||||
} else if (full_handshake_change) {
|
||||
/* 协议类型或CC变化需要重发协议和CC;仅组号/协议电流变化只重发协议。 */
|
||||
pReal->sub = (diff_info.protocol_changed || diff_info.cc_changed) ?
|
||||
IDX_SET_SINK_PD : IDX_SET_SINK_PD_ONLY;
|
||||
pReal->sink.work_mode = SINK_WORK_HANDSHAKE_PREPARE;
|
||||
} else if (protocol_voltage_only) {
|
||||
/* 仅协议电压变化时保持主副继电器状态,只停止负载并清零电流。 */
|
||||
pReal->sub = IDX_SET_SINK_PD_ONLY;
|
||||
pReal->sink.work_mode = SINK_WORK_PROTOCOL_UNLOAD;
|
||||
} else if (chrg_sink_diff_send_reg((eIDX_SOU_CH)ch,
|
||||
&diff_info, pReal) != 0) {
|
||||
|
||||
Reference in New Issue
Block a user