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

57 lines
2.3 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
* 模块名称:UI 页面注册表头文件(自动生成)
* 模块功能:叶子节点 → 内容页描述符的映射表与查询 API;密码页非节点绑定,单独出口
* 适用平台:STM32F407ZGTx / PC 模拟器(共用源码)
* 作者:王建锋
* 创建日期:2026-10-15
* 自动生成:本文件由 tools/menu_gen/gen_menu.py 从 ui_menu_tree.txt 的 #page= 注记生成,请勿手改。
* 新增一页:菜单树给叶子加 " #page=<模块名>" + 写 ui_page_<模块名>.c,重跑生成器
* (双端注册 uvprojx/CMakeLists 亦由生成器自动写入)
*/
#ifndef UI_PAGE_REGISTRY_H
#define UI_PAGE_REGISTRY_H
#include <stdint.h>
#include "ui_content_page.h"
#ifdef __cplusplus
extern "C" {
#endif
/* 注册表条目:一个绑定了内容页的菜单叶子(表序 = 节点下标升序) */
typedef struct {
uint8_t node; /* 菜单叶子节点下标(g_menu_tab 下标) */
const content_page_def_t *desc; /* 页面描述符(Flash const) */
} ui_page_entry_t;
#define UI_PAGE_MAP_COUNT 32u /* 绑定了内容页的叶子数 */
extern const ui_page_entry_t g_ui_page_map[UI_PAGE_MAP_COUNT];
/*
* 函数功能:查叶子节点绑定的内容页描述符
* 入口参数:node - 菜单叶子节点下标 uint8_t
* 返回值:页面描述符;该叶子未绑定内容页返回 NULL const content_page_def_t *
* 限定条件:node < UI_MENU_TAB_COUNT
* 函数说明:取代旧 ui_menu.c 手写 case 分发——映射的唯一真源是 ui_menu_tree.txt,
* 表序变化不会造成"下标硬编码错位"(线性扫描:绑定页是个位数量级)
*/
const content_page_def_t *ui_page_registry_for(uint8_t node);
/*
* 函数功能:取密码页描述符(需密码叶子统一进这一页)
* 入口参数:无
* 返回值:密码页描述符;菜单树未声明 @password 指令时返回 NULL const content_page_def_t *
* 限定条件:无
* 函数说明:密码页**不是**节点绑定的(任何 #P 叶子都进同一页),故不进 node→desc 映射,
* 由本接口单独出口;取值来自 ui_menu_tree.txt 的 `# @password=<模块名>` 指令
*/
const content_page_def_t *ui_page_registry_password(void);
#ifdef __cplusplus
}
#endif
#endif /* UI_PAGE_REGISTRY_H */