Skip to content

Preserve advanced fan mode across user mode changes - #327

Open
DKalimist wants to merge 1 commit into
dmitry-s93:mainfrom
DKalimist:fix-advanced-fan-mode-persistence
Open

Preserve advanced fan mode across user mode changes#327
DKalimist wants to merge 1 commit into
dmitry-s93:mainfrom
DKalimist:fix-advanced-fan-mode-persistence

Conversation

@DKalimist

Copy link
Copy Markdown

Root cause

Operate::setUserMode() unconditionally forces fan_mode back to auto,
regardless of whether advanced/custom fan control is active.

On startup, MainWindow::loadConfigs() calls operate.loadSettings()
(which correctly restores UserMode first, then fanModeAdvanced last -
ending in advanced mode), immediately followed by updateUserMode(). That
function calls radioButton->click() to sync the UI, which fires the
button's toggled signal and re-enters setUserMode() as a side effect -
silently dropping advanced mode back to auto right 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_mode gets reset).

Fix

Skip the fan_mode write in setUserMode() when advanced mode is already
active, unless the target mode is silent_mode (which intentionally
forces silent fan mode on purpose).

Testing

Built from source, reproduced the bug pre-patch (fresh launch with
fanModeAdvanced=true saved always came up in auto). Post-patch, tested
two independent cold launches: fan_mode comes up and stays advanced
automatically, curve values unchanged, no manual re-toggle needed.

Fixes #246

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fan Mode resets to Auto on Restart and Performance Mode Change

1 participant