From cbdba55e382edb2574452bfaf894e9febfb0047d Mon Sep 17 00:00:00 2001 From: "Diego.F" Date: Thu, 30 Jul 2026 02:50:14 +0200 Subject: [PATCH] Preserve advanced fan mode across user mode changes 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 #246 --- src/operate.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/operate.cpp b/src/operate.cpp index cf8e14e..8dd1f2e 100644 --- a/src/operate.cpp +++ b/src/operate.cpp @@ -416,8 +416,16 @@ void Operate::setUserMode(user_mode userMode) const { if (msiEcHelper.hasShiftMode()) { msiEcHelper.setShiftMode(shiftMode); } - - if (msiEcHelper.hasFanMode()) { + + // Custom fan curve (advanced mode) is orthogonal to the shift/user mode. + // Don't stomp it back to auto here - the UI resyncs the mode radio buttons + // (MainWindow::updateUserMode) right after settings are restored on startup, + // which re-enters this function and would otherwise silently drop advanced mode. + bool keepAdvanced = userMode != user_mode::silent_mode && + msiEcHelper.hasFanMode() && + getFanMode() == fan_mode::advanced_fan_mode; + + if (msiEcHelper.hasFanMode() && !keepAdvanced) { msiEcHelper.setFanMode(fanMode); }