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:
@@ -243,12 +243,19 @@ ioboard_bits.c ← 纯逻辑:位序组装。只依赖 <stdint.h>,主机侧
|
||||
不是「继电器现在真的动没动」。后者只能靠辅助触点或万用表。
|
||||
5. **PE2 / PE4 是命名残留**:硬件无信号,本驱动不配置、不读取。若 CubeMX 里还留着它们,
|
||||
那是 `IN_D4` / `IN_E4` 的旧配置,不影响本驱动。
|
||||
6. **开入位序未经人工验证**:8 路开入与板级丝印 `DI_A`~`DI_H` 的对应关系目前只是
|
||||
**按移位顺序推定**,没有现场逐路短接核对过。2026-11-16 那一轮读过 8 次、`ok_reads` 全部正常、
|
||||
但 `read` 恒为 `0x00`——原因是操作员来不及逐路短接,不是驱动故障:数据线通路本身是好的。
|
||||
判定标准见 §5 第 1 步(短接某一路应读到对应位的 `0x01`/`0x80`)。
|
||||
**在完成这一步之前,任何"第 n 路开入处于什么状态"的结论都只能算推定。**
|
||||
UI 侧的状态页 `ui_page_di_do.c` 在文件头注释里做了同样的声明。
|
||||
6. **开入位序仅部分验证**:8 路开入与板级丝印 `DI_A`~`DI_H` 的对应关系按移位顺序推定,
|
||||
2026-11-16 已在 **C 通道**上实测确认(信号接入 C 路 → 屏上只有 `DI_C` 显示「合」,
|
||||
其余 7 路不动),即 A 在 LSB、H 在 MSB 的位序与通道隔离都正确。
|
||||
其余 7 路尚未逐路验证;若某一路接反,症状是「该路动作时屏上亮的是另一路」。
|
||||
UI 侧的遥信页 `Drivers/BSP/UI/ui_page_yx.c`(板级开入开出 12 行已并入该页)在文件头注释里做了同样的声明。
|
||||
7. **开入是电平检测,不是通断检测**(用户口径,2026-11-16):
|
||||
本板开入测量的是**输入信号有没有 24V 高电平**,「导通」本身是测不出来的——
|
||||
外部信号必须提供 24V,仅仅把回路接通而没有电平,开入不会动作。
|
||||
板上是**反相链路**:有 24V 输入 → 光耦导通 → 74HC165 的 A..H 引脚被拉**低**。
|
||||
这个反相由 `ioboard.h` 的 `IOBOARD_DI_LEVEL_ACTIVE`(当前 `0U` = 低电平有效)在
|
||||
`ioboard_di_read()` 返回前转换,所以**上层看到的 mask 里 1 恒表示「有信号」**,
|
||||
消费者不需要各自记住「0 才是有信号」。
|
||||
实测依据:`IOBOARD_DI_LEVEL_ACTIVE` 取 `1U` 时屏上全灭、取 `0U` 时对应那一路亮。
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -92,6 +92,28 @@ extern "C" {
|
||||
/* 由上面的极性推出两档动作电平,供 .c 内部使用;不要在其它地方再写一遍高低 */
|
||||
#define IOBOARD_DO_LEVEL_RELEASE ((IOBOARD_DO_LEVEL_ACTIVE) ? 0U : 1U)
|
||||
|
||||
/*
|
||||
* 开入极性:软件 mask 的 1 = 该路"有信号"(存在 24V 高电平输入),
|
||||
* 而 74HC165 引脚上读到什么电平才算"有信号",只由这一行决定。
|
||||
*
|
||||
* 当前取值 = **低电平有效**,依据:用户口径(2026-11-16)"开入测量的是输入信号有没有
|
||||
* 24V 高电平;导通仅仅导通无法测量出来。当有高电平输入,74HC165 引脚为低电平"。
|
||||
* 即板上是**反相**链路:外部 24V 到来 → 光耦导通 → 74HC165 的 A..H 引脚被拉低。
|
||||
*
|
||||
* 为什么极性在本层转换、而不是留给页面:`ioboard_di_assemble()` 只做位序反转
|
||||
* (H,G,...,A → A 在 LSB),电平原样输出。若这里不转换,"有信号"这个语义就要由
|
||||
* 每个消费者各自记住"0 才是有信号"——读遥信页的人按 1 理解、读状态页的人按 0 理解,
|
||||
* 两处各错一次都不报错。极性只在一处定义、一次转换,上层只看 mask 的 1/0。
|
||||
*
|
||||
* 改这一行要注意:本宏作用在 `ioboard_di_read()` 的返回值上,
|
||||
* 所以去抖模块、UI 快照、任何 mask 消费者都跟着自动变,无需另改。
|
||||
* ⚠ 极性若与硬件不符,症状是"屏上每一路的合/分全反",不是无序乱跳。
|
||||
*/
|
||||
#define IOBOARD_DI_LEVEL_ACTIVE (0U) /* 0 = 低电平表示有信号;若硬件实测相反改成 1U */
|
||||
|
||||
/* 由上面的极性推出一位"有信号"的判据,供 .c 内部使用;不要在其它地方再写一遍 */
|
||||
#define IOBOARD_DI_LEVEL_IDLE ((IOBOARD_DI_LEVEL_ACTIVE) ? 0U : 1U)
|
||||
|
||||
/* ======================== 宏定义:时序(含单位,出处即规格) ======================== */
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user