From b2074a1db45b7ca20b8ef30a592bd30a01fe8a34 Mon Sep 17 00:00:00 2001 From: Shuzhengz Date: Mon, 25 Jul 2022 22:27:43 -0700 Subject: [PATCH] 2.1.5b pre --- fancontrol/fancontrol.h | 2 +- fancontrol/fancontrol.sln | 13 ++- fancontrol/fancontrol.vcxproj | 140 +++++++++++++++++++++++++- fancontrol/fancontrol.vcxproj.filters | 3 + fancontrol/fanstuff.cpp | 18 ++-- fancontrol/lhwm-cpp-wrapper.h | 19 ++++ 6 files changed, 183 insertions(+), 12 deletions(-) create mode 100644 fancontrol/lhwm-cpp-wrapper.h diff --git a/fancontrol/fancontrol.h b/fancontrol/fancontrol.h index 46fd3d5..e17c014 100644 --- a/fancontrol/fancontrol.h +++ b/fancontrol/fancontrol.h @@ -27,7 +27,7 @@ #include "TaskbarTextIcon.h" -#define FANCONTROLVERSION "2.1.5 Dual Fan" +#define FANCONTROLVERSION "2.1.5 B Dual Fan" #define WM__DISMISSDLG WM_USER+5 #define WM__GETDATA WM_USER+6 diff --git a/fancontrol/fancontrol.sln b/fancontrol/fancontrol.sln index 9c28f68..5747926 100644 --- a/fancontrol/fancontrol.sln +++ b/fancontrol/fancontrol.sln @@ -1,22 +1,31 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +# Visual Studio Version 17 +VisualStudioVersion = 17.2.32630.192 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fancontrol", "fancontrol.vcxproj", "{45F7E4D3-AF42-4594-80E1-099D3FCE3F37}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 Release|Win32 = Release|Win32 + Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {45F7E4D3-AF42-4594-80E1-099D3FCE3F37}.Debug|Win32.ActiveCfg = Debug|Win32 {45F7E4D3-AF42-4594-80E1-099D3FCE3F37}.Debug|Win32.Build.0 = Debug|Win32 + {45F7E4D3-AF42-4594-80E1-099D3FCE3F37}.Debug|x64.ActiveCfg = Debug|x64 + {45F7E4D3-AF42-4594-80E1-099D3FCE3F37}.Debug|x64.Build.0 = Debug|x64 {45F7E4D3-AF42-4594-80E1-099D3FCE3F37}.Release|Win32.ActiveCfg = Release|Win32 {45F7E4D3-AF42-4594-80E1-099D3FCE3F37}.Release|Win32.Build.0 = Release|Win32 + {45F7E4D3-AF42-4594-80E1-099D3FCE3F37}.Release|x64.ActiveCfg = Release|x64 + {45F7E4D3-AF42-4594-80E1-099D3FCE3F37}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {94871E1E-B218-4383-AA63-3A4C72367CFF} + EndGlobalSection EndGlobal diff --git a/fancontrol/fancontrol.vcxproj b/fancontrol/fancontrol.vcxproj index ae08ede..e8ad619 100644 --- a/fancontrol/fancontrol.vcxproj +++ b/fancontrol/fancontrol.vcxproj @@ -5,10 +5,18 @@ Debug Win32 + + Debug + x64 + Release Win32 + + Release + x64 + 17.0 @@ -21,6 +29,14 @@ v143 false MultiByte + false + + + Application + v143 + false + MultiByte + false Application @@ -30,6 +46,14 @@ false true + + Application + v143 + false + MultiByte + false + true + @@ -37,10 +61,18 @@ + + + + + + + + <_ProjectFileVersion>17.0.32505.173 @@ -50,11 +82,17 @@ .\Release\ false + + false + .\Debug\ .\Debug\ true + + true + NDEBUG;%(PreprocessorDefinitions) @@ -101,6 +139,51 @@ MachineX86 + + + NDEBUG;%(PreprocessorDefinitions) + true + true + .\Release/fancontrol.tlb + + + + + MaxSpeed + AnySuitable + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + MultiThreaded + true + /J + Use + _prec.h + .\Release/ + .\Release/ + .\Release/ + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x0813 + + + comctl32.lib;%(AdditionalDependencies) + .\Release/TPFanControl.exe + true + .\Release/fancontrol.pdb + Windows + 16384 + 16384 + 16384 + 16384 + true + true + UseLinkTimeCodeGeneration + + _DEBUG;%(PreprocessorDefinitions) @@ -113,7 +196,7 @@ Disabled WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) - EnableFastChecks + Default MultiThreadedDebug /J /source-charset:utf-8 Use @@ -123,7 +206,7 @@ .\Debug/ Level3 true - EditAndContinue + ProgramDatabase _DEBUG;%(PreprocessorDefinitions) @@ -140,32 +223,84 @@ false + + + _DEBUG;%(PreprocessorDefinitions) + true + true + .\Debug/fancontrol.tlb + + + + + Disabled + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + Default + MultiThreadedDebug + /J /source-charset:utf-8 + Use + _prec.h + .\Debug/ + .\Debug/ + .\Debug/ + Level3 + true + ProgramDatabase + + + _DEBUG;%(PreprocessorDefinitions) + 0x0813 + + + comctl32.lib;User32.lib;lhwm-cpp-wrapper.lib;%(AdditionalDependencies) + .\Debug/fancontrol.exe + true + true + .\Debug/fancontrol.pdb + Windows + false + + Use + Use Use + Use Use + Use Use + Use + \OpenHardwareMonitorLib.dll + \OpenHardwareMonitorLib.dll Use + Use + + Use + Use Use + Use Create + Create Create + Create _prec.h + _prec.h @@ -173,6 +308,7 @@ + diff --git a/fancontrol/fancontrol.vcxproj.filters b/fancontrol/fancontrol.vcxproj.filters index 22812b4..09c1c2f 100644 --- a/fancontrol/fancontrol.vcxproj.filters +++ b/fancontrol/fancontrol.vcxproj.filters @@ -74,6 +74,9 @@ Header Files + + Header Files + Header Files diff --git a/fancontrol/fanstuff.cpp b/fancontrol/fanstuff.cpp index 70dd82c..208f859 100644 --- a/fancontrol/fanstuff.cpp +++ b/fancontrol/fanstuff.cpp @@ -19,14 +19,16 @@ #include "fancontrol.h" #include "tools.h" #include "TVicPort.h" +#include "lhwm-cpp-wrapper.h" -#define TP_ECOFFSET_FAN_SWITCH (char)0x31 -#define TP_ECOFFSET_FAN1 (char)0x0000 -#define TP_ECOFFSET_FAN2 (char)0x0001 -#define TP_ECOFFSET_FAN (char)0x2F // 1 byte (binary xyzz zzz) -#define TP_ECOFFSET_FANSPEED (char)0x84 // 16 bit word, lo/hi byte -#define TP_ECOFFSET_TEMP0 (char)0x78 // 8 temp sensor bytes from here -#define TP_ECOFFSET_TEMP1 (char)0xC0 // 4 temp sensor bytes from here + +#define TP_ECOFFSET_FAN_SWITCH (char)0x31 +#define TP_ECOFFSET_FAN1 (char)0x40 +#define TP_ECOFFSET_FAN2 (char)0x41 +#define TP_ECOFFSET_FAN (char)0x2F // 1 byte (binary xyzz zzz) +#define TP_ECOFFSET_FANSPEED (char)0x84 // 16 bit word, lo/hi byte +#define TP_ECOFFSET_TEMP0 (char)0x78 // 8 temp sensor bytes from here +#define TP_ECOFFSET_TEMP1 (char)0xC0 // 4 temp sensor bytes from here @@ -646,6 +648,7 @@ FANCONTROL::ReadEcRaw(FCSTATE* pfcstate) { idxtemp = 0; for (i = 0; i < 8 && ok; i++) { // temp sensors 0x78 - 0x7f + //ok = LHWM::GetSensorValue("0x1B1"); ok = ReadByteFromEC(TP_ECOFFSET_TEMP0 + i, &pfcstate->Sensors[idxtemp]); if (this->ShowBiasedTemps) pfcstate->Sensors[idxtemp] = pfcstate->Sensors[idxtemp] - this->SensorOffset[idxtemp]; @@ -662,6 +665,7 @@ FANCONTROL::ReadEcRaw(FCSTATE* pfcstate) { pfcstate->SensorName[idxtemp] = "n/a"; if (!this->NoExtSensor) { pfcstate->SensorName[idxtemp] = this->gSensorNames[idxtemp]; + //ok = LHWM::GetSensorValue("0x1B1"); ok = ReadByteFromEC(TP_ECOFFSET_TEMP1 + i, &pfcstate->Sensors[idxtemp]); if (this->ShowBiasedTemps) pfcstate->Sensors[idxtemp] = pfcstate->Sensors[idxtemp] - this->SensorOffset[idxtemp]; diff --git a/fancontrol/lhwm-cpp-wrapper.h b/fancontrol/lhwm-cpp-wrapper.h new file mode 100644 index 0000000..392822e --- /dev/null +++ b/fancontrol/lhwm-cpp-wrapper.h @@ -0,0 +1,19 @@ +//#pragma once + +//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +#ifndef LHWM_CPP_WRAPPER_H +#define LHWM_CPP_WRAPPER_H + +#include +#include +#include + +class LHWM +{ +public: + static std::map>> GetHardwareSensorMap(); + static float GetSensorValue(std::string identifier); +}; + +#endif // LHWM_CPP_WRAPPER_H