diff --git a/HandheldCompanion/Devices/Lenovo/LegionGo.cs b/HandheldCompanion/Devices/Lenovo/LegionGo.cs index ec6821aad..889ca662c 100644 --- a/HandheldCompanion/Devices/Lenovo/LegionGo.cs +++ b/HandheldCompanion/Devices/Lenovo/LegionGo.cs @@ -132,6 +132,12 @@ public override void SetFanControl(bool enable, int mode = 0) // do something } + public void SetFanFullSpeed(bool enabled) + { + // Fan control: Default, Full (0, 1) + ECRAMWrite(0x8A, (byte)(enabled ? 1 : 0)); + } + public override void SetFanDuty(double percent) { // do something @@ -268,6 +274,9 @@ public override void Close() device.CloseDevice(); } + // Reset the fan speed to default before device shutdown/restart + SetFanFullSpeed(false); + base.Close(); } diff --git a/HandheldCompanion/Properties/Resources.Designer.cs b/HandheldCompanion/Properties/Resources.Designer.cs index b467041ed..06f264c94 100644 --- a/HandheldCompanion/Properties/Resources.Designer.cs +++ b/HandheldCompanion/Properties/Resources.Designer.cs @@ -979,6 +979,24 @@ public static string DevicePage_DynamicLightingDesc { } } + /// + /// Looks up a localized string similar to Sets the fan to max speed. + /// + public static string DevicePage_FullFanSpeedDesc { + get { + return ResourceManager.GetString("DevicePage_FullFanSpeedDesc", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Fan max speed override. + /// + public static string DevicePage_FullFanSpeedText { + get { + return ResourceManager.GetString("DevicePage_FullFanSpeedText", resourceCulture); + } + } + /// /// Looks up a localized string similar to Power options. /// diff --git a/HandheldCompanion/Properties/Resources.resx b/HandheldCompanion/Properties/Resources.resx index dd819e0e4..15a88ba11 100644 --- a/HandheldCompanion/Properties/Resources.resx +++ b/HandheldCompanion/Properties/Resources.resx @@ -2667,4 +2667,10 @@ with motion input toggle, press selected button(s) to switch from enabled to dis You might want to turn off core isolation and restart your system to enable TDP manipulations + + Sets the fan to max speed + + + Fan max speed override + \ No newline at end of file diff --git a/HandheldCompanion/Views/QuickPages/QuickDevicePage.xaml b/HandheldCompanion/Views/QuickPages/QuickDevicePage.xaml index 615bcb1ef..b12e6427f 100644 --- a/HandheldCompanion/Views/QuickPages/QuickDevicePage.xaml +++ b/HandheldCompanion/Views/QuickPages/QuickDevicePage.xaml @@ -67,5 +67,35 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/HandheldCompanion/Views/QuickPages/QuickDevicePage.xaml.cs b/HandheldCompanion/Views/QuickPages/QuickDevicePage.xaml.cs index 6eb67081a..81167047d 100644 --- a/HandheldCompanion/Views/QuickPages/QuickDevicePage.xaml.cs +++ b/HandheldCompanion/Views/QuickPages/QuickDevicePage.xaml.cs @@ -1,5 +1,7 @@ -using HandheldCompanion.Managers; +using HandheldCompanion.Devices; +using HandheldCompanion.Managers; using HandheldCompanion.Platforms; +using Inkore.UI.WPF.Modern.Controls; using System; using System.Windows; using System.Windows.Controls; @@ -21,6 +23,7 @@ public QuickDevicePage() { InitializeComponent(); + FullFanSpeedToggler.Visibility = MainWindow.CurrentDevice is LegionGo ? Visibility.Visible : Visibility.Collapsed; SettingsManager.SettingValueChanged += SettingsManager_SettingValueChanged; PlatformManager.RTSS.Updated += RTSS_Updated; @@ -89,4 +92,13 @@ private void ComboBoxOverlayDisplayLevel_SelectionChanged(object sender, Selecti SettingsManager.SetProperty("OnScreenDisplayLevel", ComboBoxOverlayDisplayLevel.SelectedIndex); } + + private void Toggle_cFFanSpeed_Toggled(object sender, RoutedEventArgs e) + { + if (MainWindow.CurrentDevice is LegionGo device) + { + ToggleSwitch toggleSwitch = (ToggleSwitch)sender; + device.SetFanFullSpeed(toggleSwitch.IsOn); + } + } } \ No newline at end of file