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:
+31
-1
@@ -153,6 +153,31 @@ static ioboard_di_ch_t s_di_ch[IOBOARD_DI_CH_NUM];
|
||||
static ioboard_di_snapshot_t s_di_snap;
|
||||
static uint8_t s_di_pub_mask;
|
||||
static uint32_t s_di_fail_edges_seen;
|
||||
|
||||
/*
|
||||
* 函数功能:把 s_di_snap 登记到开入快照的共享读口(写者侧一次登记)
|
||||
* 入口参数:无
|
||||
* 返回值:无(失败只留一条自检记录)
|
||||
* 限定条件:defaultTask 初始化段调用一次;仅存在于 !TEST_SUITE_STORAGE 构建
|
||||
* 函数说明:
|
||||
* 读者经 ioboard_di_snap_lookup() 取指针后走 ioboard_di_snap_read()。
|
||||
* 为什么在声明处而不是 poll 体内:ioboard_di_snap_register 是幂等的(同一指针重复
|
||||
* 登记返回 0),放在这里每轮任务启动只跑一次,且**先于**第一次 default_task_di_poll
|
||||
* 发布,读者不会看到"未登记"之外的任何中间态。注册表本身零初始化,不依赖启动顺序
|
||||
* (可在 app_main_init 阶段就被调用),这里不新增任何内核前调用的风险面。
|
||||
* 必须在 !TEST_SUITE_STORAGE 区内:STORAGE 套件构建把 s_di_snap 整段挖掉,
|
||||
* 登记语句留在外面就是编译错误。
|
||||
*/
|
||||
static void default_task_di_publish_register(void) {
|
||||
if (ioboard_di_snap_register(&s_di_snap) != 0) {
|
||||
/* 只可能是"已被另一个指针占用"——本仓只有本处登记 s_di_snap,走到这里说明
|
||||
* 有人加了第二个写者:不静默接受,留一条痕迹。此刻控制台写者尚未注册,
|
||||
* syslog_post 按内核状态分流到 s_preboot 静态数组(App/log/sys_log_mcu.c)。
|
||||
* 栈代价:该调用点内联约 216 B 日志行缓冲,只在这条不可达分支上——不计入
|
||||
* defaultTask 的静态最坏链(正常路径不经过),但改本函数结构时别把它搬进热路径。 */
|
||||
syslog_post(SYSLOG_SELFTEST, "di snapshot register rejected");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -223,7 +248,12 @@ void default_task_func(void *argument) {
|
||||
|
||||
/* 开入第一次读取放在 bring-up 之后:此刻 MX_GPIO_Init 早已配好引脚(模块初始化期),
|
||||
* 且看门狗尚未启动,几十微秒的移位读不会影响任何节拍。
|
||||
* 发布开关 DEFAULT_TASK_DI_PUBLISH_EN 在文件作用域统一定义,此处**不得重复定义**。 */
|
||||
* 发布开关 DEFAULT_TASK_DI_PUBLISH_EN 在文件作用域统一定义,此处**不得重复定义**。
|
||||
* 发布前先把快照登记到共享读口(读者 = ui_data_feed,见 ioboard_di.h):
|
||||
* 登记本身零硬件访问,但 s_di_snap 声明在 !TEST_SUITE_STORAGE 区内,登记也须同区。 */
|
||||
#if !defined(TEST_SUITE_STORAGE)
|
||||
default_task_di_publish_register();
|
||||
#endif
|
||||
(void)default_task_di_poll();
|
||||
|
||||
/* 注册控制台写者:本任务此后是串口唯一发送者(其余任务只写环形缓冲)。
|
||||
|
||||
Reference in New Issue
Block a user