Files
STM32F4-Base/App
wandering1 6e0755f971 feat(ioboard): make KO_24V an auto relay supply enable (9 channels)
KO_24V (PF4, bit6) is not an externally controllable output: it feeds
the other KO channels, so the driver now asserts it automatically
whenever any relay-class channel (bit0/1/2/3/7/8) is attracted, and
never for the three LED channels (bit4/5/9). Externally controllable
outputs become 9; physical bit map, DO_COUNT=10, DO_MASK_ALL=0x03FF,
k_do_pin[] binding, per-port BSRR segments and the uint16_t path are
unchanged.

- ioboard_do_write: clear the caller's bit6, synthesize it from
  IOBOARD_DO_RELAY_MASK (0x18F), then one shadow store + one apply,
  so bit6 changes in the same BSRR write as its GPIOF neighbours.
- ioboard_do_get: bit6 now reports the actual 24V supply state, not
  an echo of the caller's write. Power-on release keeps PF4 low.
- board test Phase 3 derives expectations from RELAY_MASK (no second
  truth table); the KO_24V row exercises "write ignored" and a new
  auto-24V check verifies set-on-relay / drop-on-release.
- host contract test pins RELAY_MASK membership (excludes bit6 and
  LED bits, union fills 0x3FF); 131/131 passed.
- docs: sync note v1.4 + BSP README unify the semantics (9
  controllable + auto supply enable); stale "10 controllable" and
  "24V interlock not implemented" wording removed; netlist-unknown
  routing, PC15 backup-domain 3 mA limit and the missing auxiliary
  contact remain documented as open facts.

Verified: Keil rebuild 0 error 0 warning (sizes identical to parent
wave), host unit tests 131/131, check_bsp_err / check_doc_links /
git diff --check clean. Board Phase 3 still needs a bench run.
2026-11-18 19:34:47 +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