固件 0.1.3-c5:硬重启开机校验 + 重按(0.1.2)、status 上报上游电脑在不在(host)
- 0.1.2:power_cycle 按完电源键后看电流,没开就重按,最多 3 次;新事件 19 BOOT_CHECK - 0.1.3:UP_VBUS_DET(IO6)启动时配成输入,status 加 "host":true|false|null - rack:单板页显示「上游:已连电脑 / 未连电脑」 - HANDOFF:损耗两档的来历(Hub 工作 ≈1.1 W)、板 B 第 2 槽 PRSNT2# 卡低 Co-Authored-By: Claude Opus 5.5 <[email protected]>
这个提交包含在:
@@ -100,6 +100,30 @@ static bool act_pg_from_safety(void *ctx, int rail, bool *pg)
|
||||
return true;
|
||||
}
|
||||
|
||||
/* 喂给 t_actuator 开机校验的电流(0.1.2)。同上,读不到就是读不到。 */
|
||||
static bool act_ua_from_safety(void *ctx, int rail, int32_t *ua)
|
||||
{
|
||||
(void)ctx;
|
||||
if (rail < 1 || rail > PHONERAIL_RAIL_COUNT || !s_snap.rail_ok[rail - 1]) {
|
||||
return false;
|
||||
}
|
||||
*ua = s_snap.rail[rail - 1].current_ua;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* 开机校验的结论 → 事件(evlog.h `LOG_EV_BOOT_CHECK`)。一次就开的不记。 */
|
||||
static void act_boot_result(void *ctx, int rail, bool booted, uint8_t presses, int32_t ua)
|
||||
{
|
||||
(void)ctx;
|
||||
if (booted && presses <= 1) {
|
||||
return;
|
||||
}
|
||||
const uint8_t arg = (uint8_t)((presses & 0x0Fu) | (booted ? 0u : 0x80u));
|
||||
evlog_put((uint8_t)rail, LOG_EV_BOOT_CHECK, arg, s_snap.rail[rail - 1].bus_mv, ua);
|
||||
ESP_LOGW(TAG, "CH%d 开机校验:按了 %u 次,%s(%ld uA)", rail, (unsigned)presses,
|
||||
booted ? "开起来了" : "没开起来", (long)ua);
|
||||
}
|
||||
|
||||
/* A10 的事件出口,A11 把它接到了环形缓冲上(§10.7:`t_safety` 只入队、不落盘)。
|
||||
`evlog_put_safety()` 自己就是 `safety_ev_fn` 的形状,这里包一层只为了顺带
|
||||
打一行串口日志 —— 板子插着 USB 调试时,事件同时进日志流与 flash。
|
||||
@@ -420,6 +444,7 @@ void app_main(void)
|
||||
⚠️ 必须在 `spawn(TASK_SAFETY, ...)` 之前:判据要关路时会先 `t_actuator_abort()`,
|
||||
而没 init 的执行器只会直接返回,那时序列还在跑,电关掉几秒又会被抬回来。 */
|
||||
t_actuator_init(act_pg_from_safety, NULL);
|
||||
t_actuator_set_boot_check(act_ua_from_safety, act_boot_result, NULL);
|
||||
|
||||
/* 命令处理器(A12)。status 读巡检与热管理两份快照。
|
||||
`power` 命令的意图经 `want_save` 存 NVS(A15)。
|
||||
|
||||
在新工单中引用
屏蔽一个用户