feat(ui): add DI/DO status page showing 8 inputs and 4 outputs

New read-only content page under 实时数据 → 开入开出 showing the board's
8 opto inputs (DI_A..DI_H, 合/分) and 4 relay outputs (KO6/TRIP/ERT/CLZ,
吸合/释放) as a 12-row list, 8 rows per page, 2 pages.

Data path reuses the existing de-bounced input poll instead of adding a
second hardware reader:

  defaultTask (50 ms) → ioboard_di_snap_publish() → de-bounced snapshot
    → ioboard_di_snap_lookup()  [new registration channel]
    → ui_data_feed_tick() (uiTask, 200 ms)
    → ui_data_rt_t.dio_di_* / dio_do_*

No new critical sections, no new hardware access on the UI path. Outputs
come from the volatile shadow register (a memory read, no lock).

Semantic honesty, recorded in ui_page_di_do.c and README §6:
  · Output state is the software shadow register (ODR mirror), NOT a
    mechanical contact feedback — this platform has no auxiliary contact
    readback path. ioboard_do_read_level() also reads ODR, so comparing
    the two is tautological.
  · IOBOARD_DO_LEVEL_ACTIVE polarity has not been checked against the
    schematic.
  · Input bit order has not been verified by manual shorting. The
    2026-11-16 run read 0x00 eight times because the operator had no time
    to short each channel — the data path itself was fine.
  · Board-level inputs are deliberately kept out of the 33-point telemetry
    bitmap (IEC 104 point-table semantics); the two have no mapping.

Invalid snapshots render "--", never 合/分 or 吸合/释放: painting "no data"
as "all inputs released" would tell the field the inputs are open when we
simply failed to read them.

Board-verified 2026-11-16: page 1 shows 分 on all 8 inputs, page 2 shows
释放 on all 4 outputs, page footer and paging correct. Input bit order
still pending manual shorting.

Also: regenerate ui_font_cn_12 for 吸/释, add golden references for both
pages, align check_menu_rows.py L2 geometry with the now-4-item submenu,
and register the new source file in both the Keil project and CMake.

Reviewed independently; zero blocking findings.
This commit is contained in:
2026-11-16 21:45:08 +08:00
parent bdc6f2f9b8
commit 2b466b85f0
24 changed files with 1012 additions and 300 deletions
+37 -10
View File
@@ -58,8 +58,9 @@
* 值区一字不动;解闭锁后重新提交可成功
* TC-UIDATA-020 apply 中途失败(预检与执行不一致的防御分支):如实 ERR_RANGE,
* 已生效的前几项不回滚(prot_set 无回滚接口,谎称整批未写更坏)
* TC-UIDATA-021 v2 帧扩展:UI_DATA_VER == 2、既有字段偏移逐字节见证(只允许尾
* 追加)、cal_block 两种态(未标定/已标定)整帧往返
* TC-UIDATA-021 v2/v3 帧扩展:UI_DATA_VER == 3、既有字段偏移逐字节见证(只允许尾
* 追加)、cal_block 两种态(未标定/已标定)整帧往返、rt 帧 v3
* 尾追加的板级开入开出四字段落在 208..211(既有字段不挪位)
* ── 以下 5 组 = 装置维护通道与时钟换算(道F task-3,
* docs/任务规划/UI补齐.md §2 第 3 行「装置维护 3 页」的地基)──
* TC-UIDATA-022 时钟换算与"无效值拒收":12 条锚点正向换算 + 反函数互逆 +
@@ -867,8 +868,9 @@ static void tc_param_frame_v2(void)
ui_data_par_t src;
ui_data_par_t got;
/* 版本号是页面与写侧唯一对齐凭据;v2 = 尾追加 cal_block */
CHECK(UI_DATA_VER == 2u, "TC-UIDATA-021a contract version is 2");
/* 版本号是页面与写侧唯一对齐凭据;v2 = par 尾追加 cal_block,
* v3 = rt 尾追加板级开入开出四字段(ui_data.h 文件头「追加即升此值」) */
CHECK(UI_DATA_VER == 3u, "TC-UIDATA-021a contract version is 3");
/* v1 布局逐字节见证:字段只允许尾追加,任何插入/重排都会让下面四条红
* (页面按名字取字段,错位是静默的——只有把偏移钉死才照得出来) */
CHECK(offsetof(ui_data_par_t, seq) == 0u, "TC-UIDATA-021b seq offset unchanged");
@@ -880,9 +882,34 @@ static void tc_param_frame_v2(void)
/* 写侧组装缓冲是 rt/par/info 三帧共用的 union(App/app/ui_data_feed.c 的 s_scr):
* rt 恒大于 par,所以给 par 追加字段**不会**连带抬升那块 .bss——加字段之前
* 先确认这条,否则每次尾追加都悄悄多啃一份 RAM(台账只记总量,看不出是谁长的) */
CHECK(sizeof(ui_data_rt_t) == 208u, "TC-UIDATA-021g rt frame is 208 B (union stays put)");
/* rt 帧尺寸(MSVC x64 / ARMCC 实测均 216 B):v3 只是尾追加 4 个 uint8(恰好
* 落在旧尾部填充里,字段偏移 208..211 连续),但**整 struct 由 208 涨到 216**——
* 尾部 char[20] 之后有 4 B 对齐填充,加 4 B 正好把它顶满、再补 4 B 新填充
* (24 B 数组区 → 需要 8 的倍数)。所以 s_scr union 的真实增量是 8 B 而不是 4 B,
* 写侧 .bss 台账按 216 算(这条断言就是"别猜、量出来"的落点) */
CHECK(sizeof(ui_data_rt_t) == 216u, "TC-UIDATA-021g rt frame is 216 B (v3 +8, union follows rt)");
CHECK(sizeof(ui_data_par_t) < sizeof(ui_data_rt_t),
"TC-UIDATA-021h par still smaller than rt (shared scratch unchanged)");
"TC-UIDATA-021h par still smaller than rt (shared scratch follows rt)");
/* v3 布局逐字节见证(rt 帧):只允许尾追加。offsetof 能照出 sizeof 照不出的
* "把字段插进 struct 中间、总长恰好不变"——那正是页面按名字取字段时会静默错位
* 的形态,所以尺寸与偏移两把尺子都要钉 */
CHECK(offsetof(ui_data_rt_t, yx_bits) == 152u,
"TC-UIDATA-021i rt yx_bits offset unchanged (104 point-table bitmaps not moved)");
/* 三张点表位图必须同时移动:只动其中一张 = 点表语义被局部重排(段内静默错位) */
CHECK(offsetof(ui_data_rt_t, yx_valid) == 160u,
"TC-UIDATA-021i2 rt yx_valid offset unchanged (bitmaps move together)");
CHECK(offsetof(ui_data_rt_t, yx_dp) == 168u,
"TC-UIDATA-021i3 rt yx_dp offset unchanged (bitmaps move together)");
CHECK(offsetof(ui_data_rt_t, clock) == 188u,
"TC-UIDATA-021j rt clock offset unchanged (v2 tail field not moved)");
CHECK(offsetof(ui_data_rt_t, dio_di_mask) == 208u,
"TC-UIDATA-021o rt dio_di_mask is the appended tail field (offset 208)");
CHECK(offsetof(ui_data_rt_t, dio_di_valid) == 209u,
"TC-UIDATA-021p rt dio_di_valid offset 209");
CHECK(offsetof(ui_data_rt_t, dio_do_mask) == 210u,
"TC-UIDATA-021q rt dio_do_mask offset 210");
CHECK(offsetof(ui_data_rt_t, dio_do_valid) == 211u,
"TC-UIDATA-021r rt dio_do_valid offset 211");
/* 闭锁态:1 = 未标定(写侧按 UA/UN/IA 三路 VALID 现算,本层只存真值) */
ui_data_init();
@@ -890,24 +917,24 @@ static void tc_param_frame_v2(void)
src.valid = 1u;
src.locked = 0u;
src.cal_block = 1u;
CHECK(ui_data_publish_par(&src) == 0, "TC-UIDATA-021g publish blocked frame");
CHECK(ui_data_publish_par(&src) == 0, "TC-UIDATA-021k publish blocked frame");
(void)memset(&got, 0, sizeof(got));
CHECK((ui_data_par(&got) == 0) && (got.cal_block == 1u) && (got.locked == 0u),
"TC-UIDATA-021h cal_block=1 roundtrip, distinct from locked");
"TC-UIDATA-021l cal_block=1 roundtrip, distinct from locked");
/* 解卡态:写侧填 0 后覆盖发布(同一份存储不会粘住旧值) */
src.cal_block = 0u;
(void)ui_data_publish_par(&src);
(void)memset(&got, 0xAA, sizeof(got));
CHECK((ui_data_par(&got) == 0) && (got.cal_block == 0u),
"TC-UIDATA-021i cal_block=0 roundtrip (no stale block flag)");
"TC-UIDATA-021m cal_block=0 roundtrip (no stale block flag)");
/* 写侧默认值纪律:调用方清零后不填本字段 = 0(未闭锁),首帧不会假报徽标 */
(void)memset(&src, 0, sizeof(src));
src.valid = 1u;
(void)ui_data_publish_par(&src);
(void)ui_data_par(&got);
CHECK(got.cal_block == 0u, "TC-UIDATA-021j zero-initialized frame means not blocked");
CHECK(got.cal_block == 0u, "TC-UIDATA-021n zero-initialized frame means not blocked");
}
/* ============ 装置维护写通道与时钟换算(道F task-3,UI 补齐 §2 第 3 行)============ */