Preserve advanced fan mode across user mode changes - #327
Open
DKalimist wants to merge 1 commit into
Open
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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