Skip to content

Commit

Permalink
Patch balanced mode value for laptops with USTT support
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexIII committed Jun 5, 2023
1 parent 9a72bfe commit 3be244e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
21 changes: 18 additions & 3 deletions Backend/AWCCWmiWrapper.py
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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

Expand Down Expand Up @@ -65,15 +68,27 @@ 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
if speed > 0xFF: speed = 0xFF
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)):
Expand Down
2 changes: 1 addition & 1 deletion GUI/AppGUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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*

Expand All @@ -8,7 +8,7 @@ Open-source alternative to AWCC*

<img src="./screen-2.png" />

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.

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 3be244e

Please sign in to comment.