Skip to content

Commit 0dbbd00

Browse files
committed
feat: enhance fan control functionality with auto-reset on disable
- Added logic to reset all fans to auto when switching fan control from enabled to disabled. - Improved state management by tracking previous fan control status before changes.
1 parent 478a766 commit 0dbbd00

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/util/settings.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -911,9 +911,17 @@ export class Settings {
911911

912912
//设置风扇控制开关状态
913913
static setFanControlEnabled(enabled: boolean) {
914+
const wasEnabled = Settings.ensureApp().fanControlEnabled ?? false;
915+
914916
if (Settings.ensureApp().fanControlEnabled != enabled) {
915917
Settings.ensureApp().fanControlEnabled = enabled;
916918
Settings.saveSettings();
919+
920+
// When switching from enabled to disabled, reset all fans to auto once
921+
if (wasEnabled && !enabled) {
922+
Backend.resetFanSettings();
923+
}
924+
917925
Backend.applySettings(APPLYTYPE.SET_FAN_ALL);
918926
PluginManager.updateComponent(ComponentName.FAN_ALL, UpdateType.UPDATE);
919927
}

0 commit comments

Comments
 (0)