Files
STM32F4-Base/App
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
..

App/ — 应用层

自研代码(非 CubeMX 生成、非第三方库)。本目录是项目的应用层:任务编排、业务逻辑、 日志与配置引擎、工具函数。所有文件遵循 docs/代码规范/嵌入式C语言代码规范_V1.0.md。

职责

Src/main.c(CubeMX 初始化)→ app_main_init(本目录 app/app_main.c)→ osKernelStart → 6 个 FreeRTOS 任务(见 task/)。osKernelStart 之前全是内核启动前代码,禁止调用任何 FreeRTOS/CMSIS-RTOS API(本条与「就绪屏障位必须 osFlagsNoClear」的理由 → docs/子系统设计/控制台单写者日志设计.md §2.5 与 docs/架构设计/项目启动顺序管理.md)。

目录结构(按职责分层)

目录 内容 README
app/ 应用入口与全局:app_main.c/h(初始化入口)、app_cfg.h(裁剪决策占位说明,当前无宏)、sys_events.h(就绪事件) app/README.md
cfg/ 配置引擎:/config.ini 解析 + 原子持久化(旧二进制档已废弃,2026-10-10) cfg/README.md
sync/ 时间同步任务:time_sync.c/h sync/README.md
algo/ 采集与算法层:语义取数 + 有效性判定 + 采样环/相量/测频 + 定值模型 + 保护元件框架 algo/README.md(索引);设计 → docs/算法/采集与算法层设计说明.md
log/ 日志子系统:syslog(NAND)+ 控制台单写者日志 log/README.md
task/ FreeRTOS 任务实现(6 个任务) task/README.md
util/ 通用工具:CRC / 环形缓冲 / 墙钟时间 util/README.md
protocol/ 通信协议(预留,当前为空) protocol/README.md

关键约束

  • 配置引擎单任务收敛:cfg/ 为静态态、属主是 defaultTask;UI 保存请求经 SYS_EVT_CFG_SAVE 事件唤醒,netTask/uiTask 不得直接触碰配置引擎
  • syslog 唯一写者:/log/* 只由 defaultTask 写入
  • 新增任务/缓冲/栈前必须先核算 RAM 余量(docs/内存管理/)

相关文档

  • 架构全景:docs/架构设计/项目架构总览.md
  • 启动顺序:docs/架构设计/项目启动顺序管理.md
  • 配置引擎:docs/子系统设计/配置文件设计.md
  • 日志:docs/子系统设计/控制台单写者日志设计.md、docs/子系统设计/运行与自检记录设计.md