fix: quench RGB after fan register writes

This commit is contained in:
way
2026-09-27 15:19:05 +08:00
parent ae8f756749
commit a976dfa3fa
3 changed files with 9 additions and 5 deletions
+1 -1
View File
@@ -69,7 +69,7 @@ CHECK STORAGE
### 4. DisplayController、OLED 与 RGB
每个当前故障都是 DisplayController 中的一个 active request,包含稳定 ID、priority、severity、OLED 显示数据、首次发现时间、最后变化时间和元数据。监控只提交或清除 request,同一轮采样作为一个原子批次,全部更新后只仲裁一次。DisplayController 始终只选一个最高优先级 owner;同一 ID 更新原请求而不重复入队,恢复时删除请求,同优先级新 request 排队而不抢占,owner 恢复后按 priority、first_seen、ID 重新仲裁。OLED 与 RGB 分别由专属工作线程驱动,监控主循环只更新共享显示状态;OLED 在主页和全部当前告警页之间轮播,告警页右上角显示 `当前页/告警总数`,新 owner 会立即唤醒 OLED 线程。告警页显示时 RGB 同步表达该页对象;回到主页时 RGB 保持最高优先级 active owner,全部恢复后才 OFF。相邻 OLED 页面需要的 RGB mode 相同时,RGB 线程不写寄存器、不重置动画相位。 风扇与 RGB 共用 MCU 0x0D;RGB 正在告警闪烁时,风扇档位命令排到灭灯阶段写入,并以 `FAN_LEVEL` 事件记录实际写入。历史 power flags 只进入 diagnose 和一次性 Journal 记录。
每个当前故障都是 DisplayController 中的一个 active request,包含稳定 ID、priority、severity、OLED 显示数据、首次发现时间、最后变化时间和元数据。监控只提交或清除 request,同一轮采样作为一个原子批次,全部更新后只仲裁一次。DisplayController 始终只选一个最高优先级 owner;同一 ID 更新原请求而不重复入队,恢复时删除请求,同优先级新 request 排队而不抢占,owner 恢复后按 priority、first_seen、ID 重新仲裁。OLED 与 RGB 分别由专属工作线程驱动,监控主循环只更新共享显示状态;OLED 在主页和全部当前告警页之间轮播,告警页右上角显示 `当前页/告警总数`,新 owner 会立即唤醒 OLED 线程。告警页显示时 RGB 同步表达该页对象;回到主页时 RGB 保持最高优先级 active owner,全部恢复后才 OFF。相邻 OLED 页面需要的 RGB mode 相同时,RGB 线程不写寄存器、不重置动画相位。 风扇与 RGB 共用 MCU 0x0D;RGB 正在告警闪烁时,风扇档位命令排到灭灯阶段写入,并在写入后重新确认 RGB OFF,以 `FAN_LEVEL` 事件记录实际写入。历史 power flags 只进入 diagnose 和一次性 Journal 记录。
### 5. RGB 正常状态与告警引擎
+2 -2
View File
@@ -1,6 +1,6 @@
7df7ae7e17248c2e0fb3a2d418e118668c055d7274e78fd2588515a613a857d0 README.md
4ac63c19d60ed3bb9d804727fe3d373a338f8203a2730a63876fb1845574822c README.md
72c46162c33f9587c6ccb01ad53fbaaf4ecec8cd21014b909e87e8707e253e36 app/oled_font_5x7.bin
d3f597e5b3ae7c04b6edcd7db304d939adf8c5014628e82f168899a40cc34eb7 app/pigway_pi_control.py
e925e9b4720b24f2c802cdb746cfa9e2f5af1de84a7533acb09ab1efcce73a82 app/pigway_pi_control.py
034931590d83969f9f24222cc57800ab193588beea3d3dcedb98f1690000370d app/pigway_pi_control_api.py
ee0f682e8016f75f906d974f00c3e3340edddf30447d441ddfd61a7a34c9e83c config/pigway-pi-control.conf
f9fbb4defa45b43abe0ce66973b1f4d553369b3a43c01d04f206c573f7dc96ca install.sh
+6 -2
View File
@@ -194,7 +194,7 @@ def update_fan(t):
pending_fan=(old,fan_level,float(t))
fan_initialized=True
def apply_pending_fan():
def apply_pending_fan(keep_rgb_off=False):
global pending_fan
with pending_fan_lock:
command=pending_fan
@@ -203,6 +203,10 @@ def apply_pending_fan():
old,new,temp=command
try:
mcu(0x08,FAN_REG[new])
# Some revisions of the shared MCU briefly expose their previous RGB
# state after a fan-register write. When the flash engine is already
# in its dark phase, immediately reassert OFF without changing phase.
if keep_rgb_off: mcu(0x07,0x00)
except Exception:
with pending_fan_lock:
if pending_fan is None: pending_fan=command
@@ -782,7 +786,7 @@ class DisplayController:
# fan changes only while RGB is already dark so MCU-internal
# register handling cannot expose a transient unrelated color.
if not applied_flash or flash_on is False:
with bus_lock: apply_pending_fan()
with bus_lock: apply_pending_fan(keep_rgb_off=applied_flash)
if previous_error is not None: log("INFO","RGB_RECOVERED")
previous_error=None
except Exception as e: