Commit Graph

2 Commits

Author SHA1 Message Date
wandering1 2b466b85f0 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.
2026-11-16 21:45:08 +08:00
wandering1 fd767d1dcd feat(ioboard): 开入开出板驱动、去抖快照与主机侧单测接入
74HC165 开入 + 光耦继电器开出的完整硬件抽象层,接进 defaultTask
的 50ms 节拍。开入 8 路(第二块 165 数据线板上未接,故只有 8 位),
开出 4 路(高电平吸合)。

驱动 BSP drivers:
- IOBOARD/ioboard.c 装载与移位时序,每步注明数据手册依据;
  SH/LD 拉高前先拉低 CLK,否则装载瞬间多移一位;
  单次读取上界 26us(延时按最慢列 VCC 2V 全温区取值)。
- IOBOARD/ioboard_bits.c 位序组装纯函数,只依赖 stdint.h,
  主机侧可直接 include 做单测:读 8 次为 H,G,F,E,D,C,B,A,
  A 放 bit0(bit(7-i) = reads[i])。
- 极性集中在 IOBOARD_DO_LEVEL_ACTIVE 一处,接口语义统一为
  mask 的 1 = 吸合。

业务接线:
- App/util/ioboard_di.c 通道去抖与双区快照,纯逻辑;
  刻意不 include ioboard.h(其引脚宏会牵入 main.h),
  两处路数常量由测试的编译期静态断言钉住。
- default_task.c 的 default_task_di_poll():读失败不喂去抖、
  不写发布值,只把上一有效值加 valid=0 发布出去,
  避免"全 0"被现场读成开入全部复归。
- 去抖实际粒度 50ms(每个轮询周期喂一拍),最坏上报约 100ms;
  想要真 20ms 需另建定时器,本次不做。
- Src/main.c 在 app_main_init 之前调 ioboard_init(),
  上电即把 4 路出口钉在全释放并确认 165 静止态。

测试:
- test/host/ioboard/ 100 条断言。位序主判据为单比特两端
  (只有 A 得 0x01、只有 H 得 0x80)加八点双射穷举;
  混合图样降级为辅助,因该图样曾先后被算成 0xA5、0x5A、0xAA。
- 去抖覆盖 20ms 边界、抖动不翻、跨 49.7 天回绕。
- 失败语义覆盖"失败保留上次有效值"与"失败窗口内的真实变位不丢"。

文档:
- 新增 docs/硬件平台/开入开出实施说明.md。
- 硬件规格与能力边界 §5 的能力边界现状改写:出口继电器与
  开入回路已具备、业务层未接入;4 路开出只可台架验证,
  不得用于真实跳闸。
- 修正 docs/文档规范.md §3.1:原文要求所有互链用仓库根相对,
  与 check_doc_links.py 的实际解析基准矛盾(markdown 链接按
  当前文档目录解析,反引号路径才按仓库根)。改为区分两类,
  并补 §3.1b 写明对应校验器。
- 清理 docs/任务规划/登记簿.md 改名为硬件改版登记.md 后
  遗留的 9 处旧名引用。

门禁: keil-build 0 Error 0 Warning;主机侧单测 ioboard 100/100、
sb_proto 45/45;pre-commit 48 根钩子全通过。
2026-11-16 18:30:31 +08:00