Files
STM32F4-Base/Drivers/BSP/UI/ui_page_registry.c
T
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

103 lines
4.4 KiB
C

/*
* 模块名称:UI 页面注册表(自动生成)
* 模块功能:叶子节点 → 内容页描述符映射表 + 2 个查询 API(导航逻辑层消费)
* 适用平台:STM32F407ZGTx / PC 模拟器(共用源码)
* 作者:王建锋
* 创建日期:2026-10-15
* 自动生成:本文件由 tools/menu_gen/gen_menu.py 从 ui_menu_tree.txt 的 #page= 注记生成,请勿手改。
* 新增一页:菜单树给叶子加 " #page=<模块名>" + 写 ui_page_<模块名>.c,重跑生成器
*/
#include "ui_page_registry.h"
#include "ui_page_ac.h"
#include "ui_page_accident.h"
#include "ui_page_alarm.h"
#include "ui_page_calib.h"
#include "ui_page_clear.h"
#include "ui_page_clock.h"
#include "ui_page_comm.h"
#include "ui_page_dc.h"
#include "ui_page_deadband.h"
#include "ui_page_device_info.h"
#include "ui_page_di_do.h"
#include "ui_page_net_cfg.h"
#include "ui_page_oper.h"
#include "ui_page_password.h"
#include "ui_page_reset.h"
#include "ui_page_runlog.h"
#include "ui_page_runreport.h"
#include "ui_page_selftest.h"
#include "ui_page_sntp.h"
#include "ui_page_soe.h"
#include "ui_page_start.h"
#include "ui_page_view_param.h"
#include "ui_page_view_plate.h"
#include "ui_page_view_set.h"
#include "ui_page_view_word.h"
#include "ui_page_wave_manual.h"
#include "ui_page_wave_play.h"
#include "ui_page_yk.h"
#include "ui_page_yx.h"
const ui_page_entry_t g_ui_page_map[UI_PAGE_MAP_COUNT] = {
{ 1u, &ui_page_device_info_desc }, /* node 1 装置信息 */
{ 3u, &ui_page_ac_desc }, /* node 3 交流量 */
{ 4u, &ui_page_dc_desc }, /* node 4 直流量 */
{ 5u, &ui_page_yx_desc }, /* node 5 遥信量 */
{ 6u, &ui_page_di_do_desc }, /* node 6 开入开出 */
{ 9u, &ui_page_view_param_desc }, /* node 9 参数 */
{ 10u, &ui_page_view_set_desc }, /* node 10 定值 */
{ 11u, &ui_page_view_word_desc }, /* node 11 控制字 */
{ 12u, &ui_page_view_plate_desc }, /* node 12 软压板 */
{ 14u, &ui_page_view_param_desc }, /* node 14 参数 */
{ 15u, &ui_page_view_set_desc }, /* node 15 定值 */
{ 16u, &ui_page_view_word_desc }, /* node 16 控制字 */
{ 17u, &ui_page_view_plate_desc }, /* node 17 软压板 */
{ 19u, &ui_page_deadband_desc }, /* node 19 遥测死区 */
{ 20u, &ui_page_calib_desc }, /* node 20 遥测系数 */
{ 25u, &ui_page_clock_desc }, /* node 25 时钟设置 */
{ 26u, &ui_page_reset_desc }, /* node 26 强制复归 */
{ 27u, &ui_page_wave_manual_desc }, /* node 27 手动录波 */
{ 28u, &ui_page_clear_desc }, /* node 28 清除记录 */
{ 30u, &ui_page_comm_desc }, /* node 30 通讯设置 */
{ 31u, &ui_page_net_cfg_desc }, /* node 31 网口设置 */
{ 32u, &ui_page_sntp_desc }, /* node 32 SNTP设置 */
{ 34u, &ui_page_soe_desc }, /* node 34 SOE记录 */
{ 35u, &ui_page_accident_desc }, /* node 35 事故记录 */
{ 36u, &ui_page_oper_desc }, /* node 36 操作记录 */
{ 37u, &ui_page_alarm_desc }, /* node 37 保护告警 */
{ 38u, &ui_page_start_desc }, /* node 38 保护启动 */
{ 39u, &ui_page_yk_desc }, /* node 39 遥控记录 */
{ 40u, &ui_page_selftest_desc }, /* node 40 自检记录 */
{ 41u, &ui_page_runlog_desc }, /* node 41 运行记录 */
{ 42u, &ui_page_runreport_desc }, /* node 42 运行报告 */
{ 43u, &ui_page_wave_play_desc }, /* node 43 录波回放 */
};
/*
* 函数功能:查叶子节点绑定的内容页描述符
* 入口参数:node - 菜单叶子节点下标 uint8_t
* 返回值:页面描述符;未绑定返回 NULL const content_page_def_t *
* 限定条件:无(越界 node 不会命中任何条目,直接 NULL)
* 函数说明:线性扫描绑定表(条目 = 有内容页的叶子,个位数量级)
*/
const content_page_def_t *ui_page_registry_for(uint8_t node) {
for (uint8_t i = 0u; i < UI_PAGE_MAP_COUNT; i++) {
if (g_ui_page_map[i].node == node) {
return g_ui_page_map[i].desc;
}
}
return NULL;
}
/*
* 函数功能:取密码页描述符(需密码叶子统一进这一页,非节点绑定)
* 入口参数:无
* 返回值:密码页描述符 const content_page_def_t *
* 限定条件:无
* 函数说明:取值来自 ui_menu_tree.txt 的 @password 指令(生成期解析,运行期零开销)
*/
const content_page_def_t *ui_page_registry_password(void) {
return &ui_page_password_desc;
}