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
+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: