feat(ui): fold board inputs and outputs into the telemetry page
The 12 board-level rows now live at the end of the 遥信量 page instead of a separate 开入开出 page: 8 opto inputs (DI_A..DI_H) and 4 relay outputs (KO6/TRIP/ERT/CLZ). 33 rows become 45, five pages become six. The standalone page, its menu entry, its golden references and both build registrations are removed. Folding the display is not folding the point table. The board rows render from dio_di_* / dio_do_* and stay out of yx_bits / yx_valid / yx_dp: any change to those carriers is provably absent from this diff. IEC 104 mapping and YX_VALID_MASK are untouched, so nothing new is reported to a master station. Input polarity was wrong and is fixed here. On this board a 24 V input drives the opto, which pulls the 74HC165 pin LOW, so the raw mask is inverted relative to "has signal". The bit assembly only reordered bits; nothing converted the level. The screen showed 分 on every channel no matter what the operator drove in. Polarity now converts once, in the driver, behind IOBOARD_DI_LEVEL_ACTIVE (0 = active low), so callers see 1 = has signal for both inputs and outputs. Verified on the board: page 5 shows YX33 followed immediately by DI_A, crossing the 33-point boundary with no drift; DI_C reads 合 because the operator's signal is on channel C, the other seven read 分; page 6 shows DI_H then all four outputs 释放. Page rows end at y=134, the footer starts at y=144. Input bit order is only partly verified: channel C was confirmed against a real signal, the other seven have not been exercised channel by channel. The board detects the presence of 24 V, not contact closure, and the output rows show the shadow register (our intent) rather than mechanical contact feedback. All three limits are recorded in the page header and in the IOBOARD README. Also adds a polarity guard to the host tests: the input polarity was flipped once already, and until now no assertion would have caught a silent re-flip, since only the DO side was pinned.
This commit is contained in:
@@ -282,7 +282,48 @@ static void counts_match_one_74hc165(void)
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* 三、通道去抖(ioboard_di.c)
|
||||
* 三、开入极性(ioboard.h 的 DI_LEVEL 宏契约)
|
||||
*
|
||||
* 与第二节开出极性同款范式:ioboard.h 同样没有"mask -> GPIO 电平"的转换函数,
|
||||
* 极性只由 IOBOARD_DI_LEVEL_ACTIVE 一个宏决定(ioboard.h:112),是唯一可改点,
|
||||
* 真实电平须上板验。主机侧能替台架钉住的只有宏契约本身。
|
||||
*
|
||||
* 为何单列一组:DI 极性 2026-11-16 刚被实测翻过一次(1U -> 0U),而当时**没有任何
|
||||
* 一条断言拦它**——翻错了屏上 8 路合/分全反相,其余门禁仍然全绿。DO 侧早有
|
||||
* do_active_level_matches_documented_high() 钉死,DI 侧此前是空白。
|
||||
* -------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* DI 极性两档必须互补且各为严格 1 bit:ACTIVE 与 IDLE 恰好一个是 1、一个是 0。
|
||||
* 为何值得测:IDLE 是由 ACTIVE 推导出来的宏,若有人把推导式抄错(比如写成
|
||||
* 同一个宏),"有信号/无信号"会退化成同一个电平,8 路永远同相。
|
||||
*/
|
||||
static void di_polarity_macros_are_complementary(void)
|
||||
{
|
||||
const unsigned active = (unsigned)(IOBOARD_DI_LEVEL_ACTIVE);
|
||||
const unsigned idle = (unsigned)(IOBOARD_DI_LEVEL_IDLE);
|
||||
|
||||
CHECK((active == 0U) || (active == 1U), "IOBOARD_DI_LEVEL_ACTIVE is a strict 1-bit level");
|
||||
CHECK(active != idle, "DI active and idle levels are complementary");
|
||||
CHECK((active + idle) == 1U, "DI active + idle == 1 (no third value can sneak in)");
|
||||
CHECK(idle == ((active != 0U) ? 0U : 1U),
|
||||
"IOBOARD_DI_LEVEL_IDLE is derived from IOBOARD_DI_LEVEL_ACTIVE");
|
||||
}
|
||||
|
||||
/*
|
||||
* 钉死当前实测极性:低电平有效。
|
||||
* 这是**硬件事实**(用户口径 2026-11-16 + C 通道实测:ACTIVE 取 1U 时屏上全灭、
|
||||
* 取 0U 时对应那一路亮),改它必须同时改 Drivers/BSP/IOBOARD/README.md 第 6 节第 7 条
|
||||
* 与本用例的注释,不能悄悄翻过来。本断言变红就是提醒走这条流程,不是要把它删掉。
|
||||
*/
|
||||
static void di_active_level_matches_documented_low(void)
|
||||
{
|
||||
CHECK(IOBOARD_DI_LEVEL_ACTIVE == 0U,
|
||||
"active-low DI polarity still in force (change IOBOARD README section 6 item 7 together)");
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* 四、通道去抖(ioboard_di.c)
|
||||
* -------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
@@ -476,7 +517,7 @@ static void deb_channels_are_independent(void)
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* 四、双区快照(ioboard_di.c)
|
||||
* 五、双区快照(ioboard_di.c)
|
||||
* -------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
@@ -733,7 +774,7 @@ static void snap_faults_accessor_matches_fields(void)
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* 五、注册式共享读口(ioboard_di.c 的 s_di_snap_registered)
|
||||
* 六、注册式共享读口(ioboard_di.c 的 s_di_snap_registered)
|
||||
*
|
||||
* 登记表是**进程级全局**且占用后不可注销(产品里整个固件只登记一次),所以本组
|
||||
* 用例共用同一张表、**按首次登记的先后顺序**执行:先测"空表 → NULL",再登记第一
|
||||
@@ -821,7 +862,11 @@ int main(void)
|
||||
do_semantic_bits_are_distinct_and_dense();
|
||||
counts_match_one_74hc165();
|
||||
|
||||
/* 三、通道去抖 */
|
||||
/* 三、开入极性(与第二节对称) */
|
||||
di_polarity_macros_are_complementary();
|
||||
di_active_level_matches_documented_low();
|
||||
|
||||
/* 四、通道去抖 */
|
||||
deb_first_sample_establishes_immediately();
|
||||
deb_flip_waits_full_window();
|
||||
deb_boundary_exactly_20ms_flips();
|
||||
@@ -832,7 +877,7 @@ int main(void)
|
||||
deb_wraparound_sweep_flips_once();
|
||||
deb_channels_are_independent();
|
||||
|
||||
/* 四、双区快照 */
|
||||
/* 五、双区快照 */
|
||||
snap_reset_is_invalid_and_empty();
|
||||
snap_first_publish_establishes_baseline();
|
||||
snap_same_mask_does_not_bump_change_seq();
|
||||
@@ -845,7 +890,7 @@ int main(void)
|
||||
di_null_inputs_are_safe();
|
||||
snap_faults_accessor_matches_fields();
|
||||
|
||||
/* 五、注册式共享读口(顺序有意义:空表态 → 首个写者锁定,见该节注释) */
|
||||
/* 六、注册式共享读口(顺序有意义:空表态 → 首个写者锁定,见该节注释) */
|
||||
reg_lookup_before_any_register_is_null();
|
||||
reg_first_register_stores_the_pointer_verbatim();
|
||||
reg_second_pointer_is_rejected_and_idempotent();
|
||||
|
||||
Reference in New Issue
Block a user