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:
2026-11-16 23:30:35 +08:00
parent 2b466b85f0
commit 515db819ab
22 changed files with 309 additions and 366 deletions
+7 -1
View File
@@ -501,6 +501,7 @@ static bsp_err_t ioboard_di_shift(uint8_t bits[IOBOARD_DI_COUNT])
static bsp_err_t ioboard_di_read_impl(uint8_t *out_mask, uint8_t in_isr)
{
uint8_t bits[IOBOARD_DI_COUNT] = {0U};
uint8_t raw;
uint8_t using_isr = 0U;
uint32_t state;
bsp_err_t rc;
@@ -517,7 +518,12 @@ static bsp_err_t ioboard_di_read_impl(uint8_t *out_mask, uint8_t in_isr)
return rc;
}
*out_mask = ioboard_di_assemble(bits);
/* 位序组装(A 在 LSB)之后、返回给上层之前,把电平原样换成"有信号"语义:
* 板上是反相链路(外部 24V → 光耦导通 → 74HC165 引脚拉低),
* 所以 mask 的 1 要对应 IOBOARD_DI_LEVEL_ACTIVE 定义的电平,而不是引脚本来的高低。
* 极性只在 ioboard.h 定义一次,上层(去抖、UI 快照、页面)只看 1 = 有信号。 */
raw = ioboard_di_assemble(bits);
*out_mask = (uint8_t)((IOBOARD_DI_LEVEL_ACTIVE != 0U) ? raw : (uint8_t)~raw);
return BSP_OK;
}