Skip to content

Commit

Permalink
Fan control polling rate UI, power mode switch fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
T-Troll committed Oct 29, 2023
1 parent d9481af commit 11b0af8
Show file tree
Hide file tree
Showing 22 changed files with 67 additions and 82 deletions.
70 changes: 9 additions & 61 deletions Install/Install.vdproj
Expand Up @@ -21,12 +21,6 @@
}
"Entry"
{
"MsmKey" = "8:_055E075BF224A12F432351DF93952E0E"
"OwnerKey" = "8:_B829425435A04EFB81D071102204D8B4"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_09B1992F95E748E1845109AD2B634C5A"
"OwnerKey" = "8:_UNDEFINED"
"MsmSig" = "8:_UNDEFINED"
Expand Down Expand Up @@ -69,12 +63,6 @@
}
"Entry"
{
"MsmKey" = "8:_8F3090BEFD2084C54DFF0BFAD98DA84F"
"OwnerKey" = "8:_B829425435A04EFB81D071102204D8B4"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_9503587A884F4044BECE7881E4187E1C"
"OwnerKey" = "8:_UNDEFINED"
"MsmSig" = "8:_UNDEFINED"
Expand Down Expand Up @@ -223,26 +211,6 @@
"IsDependency" = "11:FALSE"
"IsolateTo" = "8:"
}
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_055E075BF224A12F432351DF93952E0E"
{
"SourcePath" = "8:POWRPROF.dll"
"TargetName" = "8:POWRPROF.dll"
"Tag" = "8:"
"Folder" = "8:_77CCC7F3944A4B009D9231F8B41DFD6D"
"Condition" = "8:"
"Transitive" = "11:FALSE"
"Vital" = "11:TRUE"
"ReadOnly" = "11:FALSE"
"Hidden" = "11:FALSE"
"System" = "11:FALSE"
"Permanent" = "11:FALSE"
"SharedLegacy" = "11:FALSE"
"PackageAs" = "3:1"
"Register" = "3:1"
"Exclude" = "11:FALSE"
"IsDependency" = "11:TRUE"
"IsolateTo" = "8:"
}
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_09B1992F95E748E1845109AD2B634C5A"
{
"SourcePath" = "8:..\\Doc\\alienfan-gui.md"
Expand Down Expand Up @@ -343,26 +311,6 @@
"IsDependency" = "11:FALSE"
"IsolateTo" = "8:"
}
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_8F3090BEFD2084C54DFF0BFAD98DA84F"
{
"SourcePath" = "8:SETUPAPI.dll"
"TargetName" = "8:SETUPAPI.dll"
"Tag" = "8:"
"Folder" = "8:_77CCC7F3944A4B009D9231F8B41DFD6D"
"Condition" = "8:"
"Transitive" = "11:FALSE"
"Vital" = "11:TRUE"
"ReadOnly" = "11:FALSE"
"Hidden" = "11:FALSE"
"System" = "11:FALSE"
"Permanent" = "11:FALSE"
"SharedLegacy" = "11:FALSE"
"PackageAs" = "3:1"
"Register" = "3:1"
"Exclude" = "11:FALSE"
"IsDependency" = "11:TRUE"
"IsolateTo" = "8:"
}
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_9503587A884F4044BECE7881E4187E1C"
{
"SourcePath" = "8:..\\alienfx-config.cmd"
Expand Down Expand Up @@ -609,15 +557,15 @@
{
"Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:AlienFX Tools"
"ProductCode" = "8:{7A39B5A2-0D78-4915-BF72-4811967F29E3}"
"PackageCode" = "8:{27112E65-3F50-4A81-BE89-968785D10FBA}"
"ProductCode" = "8:{03D4EBEB-8C73-43DC-B2B3-858F4E1363DF}"
"PackageCode" = "8:{AED79AEC-6544-4DE6-B540-61B1C2D799B4}"
"UpgradeCode" = "8:{EFC2D182-AE5E-4585-92D3-0759F77F59AA}"
"AspNetVersion" = "8:4.0.30319.0"
"RestartWWWService" = "11:FALSE"
"RemovePreviousVersions" = "11:TRUE"
"DetectNewerInstalledVersion" = "11:FALSE"
"InstallAllUsers" = "11:FALSE"
"ProductVersion" = "8:8.5.100"
"ProductVersion" = "8:8.5.200"
"Manufacturer" = "8:T-Troll"
"ARPHELPTELEPHONE" = "8:"
"ARPHELPLINK" = "8:https://github.com/T-Troll/alienfx-tools/discussions"
Expand Down Expand Up @@ -977,7 +925,7 @@
{
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_1924518F6EA84AD696BCCE8E589E25C7"
{
"SourcePath" = "8:..\\x64\\Release_V1\\alienfx-gui.exe"
"SourcePath" = "8:..\\x64\\Debug\\alienfx-gui.exe"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_77CCC7F3944A4B009D9231F8B41DFD6D"
Expand Down Expand Up @@ -1005,7 +953,7 @@
}
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_4B7975803E6C492C8F7D8B599766674C"
{
"SourcePath" = "8:..\\x64\\Release_V1\\alienfan-gui.exe"
"SourcePath" = "8:..\\x64\\Debug\\alienfan-gui.exe"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_77CCC7F3944A4B009D9231F8B41DFD6D"
Expand Down Expand Up @@ -1033,7 +981,7 @@
}
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_AB07B12C770D4D4A9DE7E3A7F6280FFF"
{
"SourcePath" = "8:..\\x64\\Release\\LightFX\\LightFX.dll"
"SourcePath" = "8:..\\x64\\Debug\\LightFX.dll"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_39E2774D52CE4B619039352379796769"
Expand Down Expand Up @@ -1061,7 +1009,7 @@
}
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_B829425435A04EFB81D071102204D8B4"
{
"SourcePath" = "8:..\\x64\\Release_V1\\alienfan-cli.exe"
"SourcePath" = "8:..\\x64\\Debug\\alienfan-cli.exe"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_77CCC7F3944A4B009D9231F8B41DFD6D"
Expand Down Expand Up @@ -1117,7 +1065,7 @@
}
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_E287D1712A1A426DA4A815104949F017"
{
"SourcePath" = "8:..\\x64\\Release\\alienfx-cli.exe"
"SourcePath" = "8:..\\x64\\Debug\\alienfx-cli.exe"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_77CCC7F3944A4B009D9231F8B41DFD6D"
Expand Down Expand Up @@ -1145,7 +1093,7 @@
}
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_FA7989C51ECD437AB3316446FB849F60"
{
"SourcePath" = "8:..\\x64\\Release_V1\\alienfx-mon.exe"
"SourcePath" = "8:..\\x64\\Debug\\alienfx-mon.exe"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_77CCC7F3944A4B009D9231F8B41DFD6D"
Expand Down
4 changes: 2 additions & 2 deletions LightFX/LightFX.rc
Expand Up @@ -62,7 +62,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US

VS_VERSION_INFO VERSIONINFO
FILEVERSION 8,5,0,0
PRODUCTVERSION 8,5,1,0
PRODUCTVERSION 8,5,2,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -83,7 +83,7 @@ BEGIN
VALUE "LegalCopyright", "Copyright (C) 2021"
VALUE "OriginalFilename", "LightFX.dll"
VALUE "ProductName", "AlienFX Tools"
VALUE "ProductVersion", "8.5.1.0"
VALUE "ProductVersion", "8.5.2.0"
END
END
BLOCK "VarFileInfo"
Expand Down
3 changes: 2 additions & 1 deletion LightFX/LightFX.vcxproj
Expand Up @@ -15,7 +15,7 @@
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{9e86c7e5-6e4c-4120-b8a5-9ab53b57f918}</ProjectGuid>
<RootNamespace>LightFX</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
Expand Down Expand Up @@ -85,6 +85,7 @@
<DebugInformationFormat>None</DebugInformationFormat>
<OmitFramePointers>true</OmitFramePointers>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<FloatingPointModel>Fast</FloatingPointModel>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand Down
3 changes: 2 additions & 1 deletion alienfan-tools/alienfan-cli/alienfan-tools.vcxproj
Expand Up @@ -19,7 +19,7 @@
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{d6ad2e10-f61c-43f1-87ea-e77dea12dd42}</ProjectGuid>
<RootNamespace>alienfantools</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
<ProjectName>alienfan-cli</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
Expand Down Expand Up @@ -98,6 +98,7 @@
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<StringPooling>true</StringPooling>
<ControlFlowGuard>false</ControlFlowGuard>
<FloatingPointModel>Fast</FloatingPointModel>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
Expand Down
1 change: 1 addition & 0 deletions alienfan-tools/alienfan-curve/FanCurve.cpp
Expand Up @@ -225,6 +225,7 @@ DWORD WINAPI CheckFanOverboost(LPVOID lpParam) {
+ " @ " + to_string(bestBoostPoint.maxRPM) + " RPM.");
}
mon->ResetBoost();
mon->SetCurrentMode();
mon->inControl = true;
SendMessage((HWND)lpParam, WM_APP + 2, 0, 1);
return 0;
Expand Down
7 changes: 7 additions & 0 deletions alienfan-tools/alienfan-gui/alienfan-gui.cpp
Expand Up @@ -181,6 +181,7 @@ LRESULT CALLBACK FanDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
CheckMenuItem(GetMenu(hDlg), IDM_SETTINGS_DISABLEAWCC, fan_conf->awcc_disable ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(GetMenu(hDlg), IDM_SETTINGS_KEYBOARDSHORTCUTS, fan_conf->keyShortcuts ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(GetMenu(hDlg), IDM_SETTINGS_RESTOREPOWERMODE, fan_conf->keepSystem ? MF_CHECKED : MF_UNCHECKED);
SetDlgItemInt(hDlg, IDC_EDIT_POLLING, fan_conf->pollingRate, false);

return true;
} break;
Expand All @@ -202,6 +203,12 @@ LRESULT CALLBACK FanDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
} break;
}
} break;
case IDC_EDIT_POLLING:
if (HIWORD(wParam) == EN_KILLFOCUS) {
fan_conf->pollingRate = GetDlgItemInt(hDlg, IDC_EDIT_POLLING, NULL, false);
mon->Start();
}
break;
case IDOK: {
RECT rect;
ListView_GetSubItemRect(tempList, ListView_GetSelectionMark(tempList), 1, LVIR_LABEL, &rect);
Expand Down
Binary file modified alienfan-tools/alienfan-gui/alienfan-gui.rc
Binary file not shown.
2 changes: 1 addition & 1 deletion alienfan-tools/alienfan-gui/alienfan-gui.vcxproj
Expand Up @@ -19,7 +19,7 @@
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{3b208a8c-0e41-4830-a2b8-1319cfc778a7}</ProjectGuid>
<RootNamespace>alienfangui</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
Expand Down
4 changes: 3 additions & 1 deletion alienfan-tools/alienfan-gui/resource.h
Expand Up @@ -19,6 +19,8 @@
#define IDC_SYSLINK_HOMEPAGE 1010
#define IDC_MAX_RESET 1016
#define IDC_BUT_RESETBOOST 1017
#define IDC_EDIT1 1018
#define IDC_EDIT_POLLING 1018
#define IDC_AC_BOOST 1124
#define IDC_DC_BOOST 1125
#define IDC_BUT_OVER 1130
Expand All @@ -44,7 +46,7 @@
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 135
#define _APS_NEXT_COMMAND_VALUE 32801
#define _APS_NEXT_CONTROL_VALUE 1018
#define _APS_NEXT_CONTROL_VALUE 1019
#define _APS_NEXT_SYMED_VALUE 111
#endif
#endif
24 changes: 15 additions & 9 deletions alienfan-tools/alienfan-mon/MonHelper.cpp
Expand Up @@ -24,6 +24,8 @@ MonHelper::MonHelper() {

MonHelper::~MonHelper() {
Stop();
if (fan_conf->keepSystem)
SetCurrentMode(oldPower);
delete acpi;
}

Expand All @@ -41,21 +43,25 @@ void MonHelper::Start() {
// start thread...
if (!monThread) {
// Stuck fan fix
acpi->SetPower(0xa0);
SetCurrentMode();
monThread = new ThreadHelper(CMonProc, this, 750, THREAD_PRIORITY_BELOW_NORMAL);
//acpi->SetPower(0xa0);
//SetCurrentMode();
monThread = new ThreadHelper(CMonProc, this, fan_conf->pollingRate, THREAD_PRIORITY_BELOW_NORMAL);
#ifdef _DEBUG
OutputDebugString("Mon thread start.\n");
#endif
}
else {
Stop();
Start();
}
}

void MonHelper::Stop() {
if (monThread) {
delete monThread;
monThread = NULL;
if (fan_conf->keepSystem)
SetCurrentMode(oldPower);
//if (fan_conf->keepSystem)
// SetCurrentMode(oldPower);
ResetBoost();
#ifdef _DEBUG
OutputDebugString("Mon thread stop.\n");
Expand All @@ -68,11 +74,11 @@ void MonHelper::SetCurrentMode(int newMode) {
newMode = fan_conf->lastProf->gmode_stage ? powerSize : fan_conf->lastProf->powerStage;
int cmode = GetPowerMode();
if (newMode != cmode) {
acpi->SetPower(0xa0);
if (newMode < powerSize) {
if (cmode == powerSize) {
acpi->SetGMode(false);
}
acpi->SetPower(0xa0);
acpi->SetPower(acpi->powers[newMode]);
}
else
Expand Down Expand Up @@ -152,8 +158,8 @@ void CMonProc(LPVOID param) {
cBoost = cur->points.back().boost;
src->senBoosts[i][senID] = cBoost;
if (cBoost > curBoost) {
if (cBoost < src->boostCooked[i])
cBoost += 7 * ((src->boostCooked[i] - cBoost) >> 3);
//if (cBoost < src->boostCooked[i])
// cBoost += 7 * ((src->boostCooked[i] - cBoost) >> 3);
curBoost = cBoost;
src->lastBoost[i] = senID;
}
Expand All @@ -173,7 +179,7 @@ void CMonProc(LPVOID param) {
if (curBoostRaw != boostOld) {
acpi->SetFanBoost(i, curBoostRaw);
src->boostRaw[i] = curBoostRaw;
src->boostCooked[i] = curBoost;
//src->boostCooked[i] = curBoost;
//DebugPrint(("Boost for fan#" + to_string(i) + " changed from " + to_string(src->boostRaw[i])
// + " to " + to_string(src->boostSets[i]) + "\n").c_str());
}
Expand Down
2 changes: 1 addition & 1 deletion alienfan-tools/alienfan-mon/MonHelper.h
Expand Up @@ -11,7 +11,7 @@ class MonHelper {
AlienFan_SDK::Control* acpi;
bool inControl = true;
map<byte,WORD> fanRpm, lastBoost;
map<byte,byte> boostRaw, boostCooked, fanSleep;
map<byte,byte> boostRaw, /*boostCooked,*/ fanSleep;
map<WORD, short> senValues, maxTemps;
map<byte,map<WORD, byte>> senBoosts;
WORD powerMode = 0;
Expand Down
2 changes: 2 additions & 0 deletions alienfan-tools/alienfan-shared/ConfigFan.cpp
Expand Up @@ -55,6 +55,7 @@ void ConfigFan::Load() {
GetReg("KeyboardShortcut", &keyShortcuts, 1);
GetReg("KeepSystemMode", &keepSystem, 1);
GetReg("DPTF", &needDPTF, 1);
GetReg("PollingRate", &pollingRate, 750);

// Now load sensor mappings...
char name[256];
Expand Down Expand Up @@ -106,6 +107,7 @@ void ConfigFan::Save() {
SetReg("KeyboardShortcut", keyShortcuts);
SetReg("KeepSystemMode", keepSystem);
SetReg("DPTF", needDPTF);
SetReg("PollingRate", pollingRate);
// clean old data
RegDeleteTree(keyMain, "Sensors");
RegCreateKeyEx(keyMain, "Sensors", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &keySensors, NULL);
Expand Down
1 change: 1 addition & 0 deletions alienfan-tools/alienfan-shared/ConfigFan.h
Expand Up @@ -48,6 +48,7 @@ class ConfigFan {
DWORD keyShortcuts;
DWORD keepSystem;
DWORD needDPTF;
DWORD pollingRate;
bool wasAWCC;

fan_profile prof;
Expand Down
3 changes: 2 additions & 1 deletion alienfx-cli/alienfx-cli.vcxproj
Expand Up @@ -14,7 +14,7 @@
<ProjectGuid>{FF6119EA-878F-4E7B-9FCD-8410A5D3FBF8}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>alienfxcli</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
Expand Down Expand Up @@ -83,6 +83,7 @@
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<StringPooling>true</StringPooling>
<ControlFlowGuard>false</ControlFlowGuard>
<FloatingPointModel>Fast</FloatingPointModel>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
Expand Down

0 comments on commit 11b0af8

Please sign in to comment.