固件 A15:启动顺序 + 降级矩阵(bringup.{h,c},已上板)
- 启动序列从 app_main.c 拆进 main/bringup.{h,c},宿主机可测:
bringup_devices()(§10.9 第 1~4 步)→ 起 t_safety → bringup_power_restore()(第 5~6 步)
- 六片 INA226 写 Config/Calibration(之前没做,电流恒 0);输入侧 0x43 登记对调接
- 按「意图」逐路上电、错开 100 ms、每路等 PG 500 ms,等不到关回去并记 LOG_EV_PG_TIMEOUT(17)
- 意图只由 power 命令改(cmd_env_t.intent → NVS phonerail/rail_want)
- §10.10 逐行降级:INA/DAC/PCA9555/mux/PRSNT#/CH224A;mux 失联时不碰主干
- BOOT 事件 arg = 复位原因;HUB_RST# 仍只在上电复位时脉冲
- rail_volt_init() 一片失败不再放弃另一片;CH224A 主干 / 通道 5 两处都找
- sim:sim_gpio_rise_us / sim_gpio_set_hook,sim_gpio_drive 可在配置前调
- test_bringup.c 24 例 + test_cmd 意图 1 例,共 425 例全绿;版本 0.1.0-a15
- rack:事件表加 17 PG_TIMEOUT(已部署)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
这个提交包含在:
+17
-1
@@ -199,6 +199,15 @@ cmd_err_t do_vbus(ctx_t *c)
|
||||
return from_hal(slot_vbus_enable(c->rail, on));
|
||||
}
|
||||
|
||||
/* A15:意图出口(cmd.h 的 `cmd_intent_fn`)。 */
|
||||
static void note_intent(int rail, bool on)
|
||||
{
|
||||
const cmd_env_t *env = cmd_env();
|
||||
if (env != NULL && env->intent != NULL) {
|
||||
env->intent(env->intent_ctx, rail, on);
|
||||
}
|
||||
}
|
||||
|
||||
cmd_err_t do_power(ctx_t *c)
|
||||
{
|
||||
cmd_err_t e = need_rail(c);
|
||||
@@ -213,13 +222,20 @@ cmd_err_t do_power(ctx_t *c)
|
||||
return CMD_ERR_BUSY; /* 硬重启走到一半再开关一次是自作主张(t_actuator_abort 同理) */
|
||||
}
|
||||
if (on) {
|
||||
return from_hal(rail_efuse_enable(c->rail, true));
|
||||
const hal_err_t ee = rail_efuse_enable(c->rail, true);
|
||||
if (ee == HAL_OK) {
|
||||
note_intent(c->rail, true);
|
||||
}
|
||||
return from_hal(ee);
|
||||
}
|
||||
/* 关:与 `rail_all_off()` 同序 —— **先断 VBUS 再关 eFuse**。
|
||||
VBUS 走 I²C 可能断不掉,eFuse 是 GPIO 永远关得掉:前者失败也照样关后者,
|
||||
回应报 io,上位机据此知道「直供断了,VBUS 可能还通着」。 */
|
||||
const hal_err_t ev = slot_vbus_enable(c->rail, false);
|
||||
const hal_err_t ee = rail_efuse_enable(c->rail, false);
|
||||
if (ee == HAL_OK) {
|
||||
note_intent(c->rail, false); /* 直供确实断了:下次开机也别开它 */
|
||||
}
|
||||
return from_hal(ee != HAL_OK ? ee : ev);
|
||||
}
|
||||
|
||||
|
||||
在新工单中引用
屏蔽一个用户