fix: commit MCU RGB effects in calibrated order

This commit is contained in:
way
2026-09-27 10:46:18 +08:00
parent 5d541d5ef6
commit ad25c08eb1
3 changed files with 8 additions and 9 deletions
+5 -6
View File
@@ -471,12 +471,11 @@ def rgb_normal_effect(mode):
effect_name=mode.removeprefix("NORMAL_").lower()
state=("effect",effect_name,NORMAL_EFFECT_SPEED,NORMAL_EFFECT_COLOR)
if _last_rgb==state: return
# Seller protocol: close the previous RGB state, then set effect, speed and
# the limited built-in palette. Write this sequence once per mode change.
mcu(0x07,0x00); time.sleep(0.001)
mcu(0x04,RGB_EFFECTS[effect_name]); time.sleep(0.001)
mcu(0x05,NORMAL_EFFECT_SPEED); time.sleep(0.001)
mcu(0x06,RGB_EFFECT_COLORS[NORMAL_EFFECT_COLOR])
# Hardware-calibrated order: speed and color are parameters; the final
# effect register write commits and starts the selected MCU animation.
mcu(0x05,NORMAL_EFFECT_SPEED); time.sleep(RGB_WRITE_DELAY_MS/1000.0)
mcu(0x06,RGB_EFFECT_COLORS[NORMAL_EFFECT_COLOR]); time.sleep(RGB_WRITE_DELAY_MS/1000.0)
mcu(0x04,RGB_EFFECTS[effect_name])
_last_rgb=state
def render_home(cpu,temp,mem,disk):