From 3be244e05de2afce41e9ef3a4afeaeba88d3f7ce Mon Sep 17 00:00:00 2001 From: Alexander Chernoskutov Date: Mon, 5 Jun 2023 15:15:02 +0400 Subject: [PATCH] Patch balanced mode value for laptops with USTT support --- Backend/AWCCWmiWrapper.py | 21 ++++++++++++++++++--- GUI/AppGUI.py | 2 +- README.md | 7 ++++--- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/Backend/AWCCWmiWrapper.py b/Backend/AWCCWmiWrapper.py index 6e37fc5..976f84d 100644 --- a/Backend/AWCCWmiWrapper.py +++ b/Backend/AWCCWmiWrapper.py @@ -1,5 +1,5 @@ from enum import Enum -from typing import Optional, Tuple +from typing import Optional, Tuple, Union import wmi # type: ignore class AWCCWmiWrapper: @@ -13,6 +13,9 @@ class ThermalMode(Enum): Balanced = 0x97 G_Mode = 0xAB + _balancedModePatch = None # type: Optional[Union[False, int]] + _USTT_Balanced = 0xA0 + def __init__(self, awcc: wmi._wmi_object) -> None: self._awcc = awcc @@ -65,8 +68,17 @@ def GetFanIdsAndRelatedSensorsIds(self) -> list[Tuple[int, Tuple[int, ...]]]: def ApplyThermalMode(self, mode: ThermalMode) -> bool: if not isinstance(mode, self.ThermalMode): raise Exception('Invalid argument: mode is not instance of ThermalMode') - arg = ((mode.value & 0xFF) << 8) | 1 - return self._call('Thermal_Control', arg) == 0 + value = mode.value + + # Patch balanced mode value for laptops with USTT support + if mode == self.ThermalMode.Balanced: + if self._balancedModePatch is None: + self._balancedModePatch = self._USTT_Balanced if self._Thermal_Control(self._USTT_Balanced) else False + print(f'Balanced mode patch: {self._balancedModePatch}') + if isinstance(self._balancedModePatch, int): + value = self._balancedModePatch + + return self._Thermal_Control(value) def SetAddonSpeedPercent(self, fanId: int, speed: int) -> bool: if not (fanId in range(self.FAN_ID_FIRST, self.FAN_ID_LAST + 1)): return False @@ -74,6 +86,9 @@ def SetAddonSpeedPercent(self, fanId: int, speed: int) -> bool: arg = ((speed & 0xFF) << 16) | ((fanId & 0xFF) << 8) | 2 return self._call('Thermal_Control', arg) == 0 + def _Thermal_Control(self, arg: int) -> bool: + arg = ((arg & 0xFF) << 8) | 1 + return self._call('Thermal_Control', arg) == 0 def _call(self, method: str, arg: int) -> Optional[int]: if not hasattr(self._awcc, method) or not callable(getattr(self._awcc, method)): diff --git a/GUI/AppGUI.py b/GUI/AppGUI.py index 82b503a..782afcf 100644 --- a/GUI/AppGUI.py +++ b/GUI/AppGUI.py @@ -56,7 +56,7 @@ class TCC_GUI(QtWidgets.QWidget): FAILSAFE_GPU_TEMP = 85 FAILSAFE_RESET_AFTER_TEMP_IS_OK_FOR_SEC = 60 APP_NAME = "Thermal Control Center for Dell G15 5515" - APP_VERSION = "1.3.0" + APP_VERSION = "1.4.0" APP_DESCRIPTION = "This app is an open-source replacement for Alienware Control Center " APP_URL = "github.com/AlexIII/tcc-g15" diff --git a/README.md b/README.md index 0364a60..8da88a6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Thermal Control Center for Dell G15 5515 +# Thermal Control Center for Dell G15 5515 / 5511 / 5525 Open-source alternative to AWCC* @@ -8,7 +8,7 @@ Open-source alternative to AWCC* -Tested only for Dell G15 5515. May also work on other Dell G15 notebooks. +Tested for Dell G15 5515, 5511, 5525 _(big thanks to @T7imal and @cemkaya-mpi for testing and debugging!)_. May also work on other Dell G15 notebooks. Please report if it worked / didn't work for you. Your feedback is highly appreciated. @@ -49,13 +49,14 @@ I'll implement these things if the project receives sufficient number of stars* - [[see issue](https://github.com/AlexIII/tcc-g15/issues/7)] Autorun on system startup option (30x ⭐) - [interferes with the build-in fan regulator] ~~"Target temperature mode" - automatically control the fans to maintain user-specified GPU/CPU temperature~~ - ✔️ Adjustable fail-safe threshold temperature, drop out of fail-safe mode after the temperature returns to normal (40x ⭐) +- ✔️ Patch for G15 5511 / 5525 - Proper Windows installer (50x ⭐) *or maybe I'll do it regardless, who knows. ## Target platfom -Tested with Dell G15 5515 on Windows 10. +Tested with Dell G15 5515, 5511, 5525 on Windows 10/11. ## How it works