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
+22 -1
View File
@@ -174,6 +174,11 @@ typedef struct {
float freq_hz;
uint8_t clock_ok; /* 0 = 时钟无效(RTC 异常) */
char clock[20]; /* "YYYY-MM-DD HH:MM:SS" 固定长度,无指针 */
/* v3 尾追加:板级开入开出(「开入开出」页),与上面三张点表位图互不引用 */
uint8_t dio_di_mask; /* 8 路开入:bit n = 通道 n 合 */
uint8_t dio_di_valid; /* 0 = 无数据源 / 本次读失败(mask 为上次已知值,不可当新数据) */
uint8_t dio_do_mask; /* 4 路开出影子寄存器:bit n = 吸合(**软件意图**,非机械反馈) */
uint8_t dio_do_valid; /* 0 = 本帧未取到影子寄存器 */
} ui_data_rt_t;
```
@@ -194,7 +199,7 @@ typedef struct {
```c
#define UI_DATA_SET_N 40u /* 定值项数(与 prot_set 枚举同序,见 §9.2 一致性测试) */
#define UI_DATA_VER 2u /* 契约版本;字段只尾追加、追加即升版(§4.3) */
#define UI_DATA_VER 3u /* 契约版本;字段只尾追加、追加即升版(§4.3) */
typedef struct {
uint32_t seq;
@@ -229,6 +234,22 @@ typedef struct {
> (帧长一变,那处注释就是唯一会撒谎的地方)。升 `UI_DATA_VER` 是必须的:版本号是
> 页面与写侧唯一的对齐凭据,追加字段不升版 = 老页面按新帧长 memcpy 时静默错位。
> 【v3 落地注(2026-11-16,「开入开出」页)】`ui_data_rt_t` 尾追加
> `dio_di_mask` / `dio_di_valid` / `dio_do_mask` / `dio_do_valid`(板级 8 路开入 +
> 4 路开出),`UI_DATA_VER` 2 → 3。四条口径:
> 1. **板级引脚 ≠ 104 点表**:这四字段与 `yx_bits` / `yx_valid` / `yx_dp` 互不引用。
> 板级开入 8 路与点表 33 点没有映射关系,把引脚状态塞进点表位图 = 篡改点表事实
> (点表 YX1~4 开关位置点在 V0.1 仍恒无效)。
> 2. **读失败语义**:开入经 `ioboard_di_snap_lookup()` → `ioboard_di_snap_read()`
> 取数。读不到(未登记 / 快照无效 / 读期被持续抢占)时 `dio_di_valid = 0`、mask
> 沿用**上一次成功读到的值**,绝不填 0——全 0 在现场等于"开入全部复归"。
> 开出只读驱动影子寄存器(`ioboard_do_get()`),零硬件访问。
> 3. **`dio_do_mask` 是软件意图**(上次成功写入的值),不是继电器机械吸合实测;
> 本平台无辅助触点回读通路,屏上文案不得让人以为读到了机械反馈。
> 4. **尺寸**:4 字段偏移 208..211 连续,但整帧 208 → **216 B**(尾部 `char[20]` 后
> 原有 4 B 对齐填充被顶满,再补 4 B 新填充)。组装缓冲 `s_scr` 以 rt 为最大者,
> 故 .bss 实涨 8 B。偏移与尺寸由 `test/host/ui_data` 的 TC-UIDATA-021g/i~j/o~r 钉住。
### 4.3 扩展规则
- **只允许尾部追加字段**,结构体开头保留 `seq/valid`。