Preserve advanced fan mode across user mode changes - #327
Conversation
setUserMode() unconditionally forced fan_mode back to auto. On startup, loadConfigs() calls loadSettings() (which correctly restores advanced mode) immediately followed by updateUserMode(), which re-syncs the mode radio buttons via click() and re-enters setUserMode() as a side effect, silently dropping advanced mode back to auto. Same happens on any shift-mode change while advanced is active. Skip the fan_mode write in setUserMode() when advanced mode is already active, unless switching to silent mode (which intentionally forces silent fan mode). Fixes dmitry-s93#246
|
Tested PR #327 successfully on a real MSI Stealth 14 Studio A13VF. Environment: Ubuntu 26.04 LTS Before this patch, enabling Advanced Fan mode worked initially, but starting MControlCenter or changing the Shift/User Mode silently changed fan_mode from advanced back to auto. The saved fanModeAdvanced=true setting was therefore not reliably preserved. Built and installed this PR from commit cbdba55 and verified: MControlCenter starts with Advanced Fan mode preserved. The built binaries matched the installed binaries by SHA-256 after installation, confirming that the PR build was the version being tested. This fixes the issue for my hardware/configuration. Thanks! |
|
Working wonderfully, thank you so much. Cachyos |
Root cause
Operate::setUserMode()unconditionally forcesfan_modeback toauto,regardless of whether advanced/custom fan control is active.
On startup,
MainWindow::loadConfigs()callsoperate.loadSettings()(which correctly restores
UserModefirst, thenfanModeAdvancedlast -ending in advanced mode), immediately followed by
updateUserMode(). Thatfunction calls
radioButton->click()to sync the UI, which fires thebutton's
toggledsignal and re-enterssetUserMode()as a side effect -silently dropping advanced mode back to
autoright after it was restored.The same happens any time the shift/user mode changes while advanced is
active, not just at startup.
Confirmed at the raw EC register level (fan curve arrays stay correctly
loaded at their addresses, only
fan_modegets reset).Fix
Skip the
fan_modewrite insetUserMode()when advanced mode is alreadyactive, unless the target mode is
silent_mode(which intentionallyforces silent fan mode on purpose).
Testing
Built from source, reproduced the bug pre-patch (fresh launch with
fanModeAdvanced=truesaved always came up inauto). Post-patch, testedtwo independent cold launches:
fan_modecomes up and staysadvancedautomatically, curve values unchanged, no manual re-toggle needed.
Fixes #246