Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: rename and sort sensor variable #28

Merged
merged 3 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions smctemp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -409,19 +409,19 @@ double SmcTemp::GetCpuTemp() {
const std::pair<unsigned int, unsigned int> valid_temperature_limits{0, 110};
// The reason why I prefer CPU die temperature to CPU proximity temperature:
// https://github.com/narugit/smctemp/issues/2
temp = smc_accessor_.ReadValue(kSensorTc0d);
temp = smc_accessor_.ReadValue(kSensorTC0D);
if (IsValidTemperature(temp, valid_temperature_limits)) {
return temp;
}
temp = smc_accessor_.ReadValue(kSensorTc0e);
temp = smc_accessor_.ReadValue(kSensorTC0E);
if (IsValidTemperature(temp, valid_temperature_limits)) {
return temp;
}
temp = smc_accessor_.ReadValue(kSensorTc0f);
temp = smc_accessor_.ReadValue(kSensorTC0F);
if (IsValidTemperature(temp, valid_temperature_limits)) {
return temp;
}
temp = smc_accessor_.ReadValue(kSensorTc0p);
temp = smc_accessor_.ReadValue(kSensorTC0P);
if (IsValidTemperature(temp, valid_temperature_limits)) {
return temp;
}
Expand All @@ -443,7 +443,7 @@ double SmcTemp::GetCpuTemp() {
// CPU core 5
sensors.emplace_back(static_cast<std::string>(kSensorTp05));
// CPU core 6
sensors.emplace_back(static_cast<std::string>(kSensorTp0d));
sensors.emplace_back(static_cast<std::string>(kSensorTp0D));
// CPU core 7
sensors.emplace_back(static_cast<std::string>(kSensorTp0j));
// CPU core 8
Expand All @@ -460,7 +460,7 @@ double SmcTemp::GetCpuTemp() {
// CPU core 5
sensors.emplace_back(static_cast<std::string>(kSensorTp05));
// CPU core 6
sensors.emplace_back(static_cast<std::string>(kSensorTp0d));
sensors.emplace_back(static_cast<std::string>(kSensorTp0D));
// CPU core 7
sensors.emplace_back(static_cast<std::string>(kSensorTp0j));
// CPU core 8
Expand All @@ -471,21 +471,21 @@ double SmcTemp::GetCpuTemp() {
// CPU performance core 2 temperature
sensors.emplace_back(static_cast<std::string>(kSensorTp05));
// CPU performance core 3 temperature
sensors.emplace_back(static_cast<std::string>(kSensorTp0d));
sensors.emplace_back(static_cast<std::string>(kSensorTp0D));
// CPU performance core 4 temperature
sensors.emplace_back(static_cast<std::string>(kSensorTp0h));
sensors.emplace_back(static_cast<std::string>(kSensorTp0H));
// CPU performance core 5 temperature
sensors.emplace_back(static_cast<std::string>(kSensorTp0l));
sensors.emplace_back(static_cast<std::string>(kSensorTp0L));
// CPU performance core 6 temperature
sensors.emplace_back(static_cast<std::string>(kSensorTp0p));
sensors.emplace_back(static_cast<std::string>(kSensorTp0P));
// CPU performance core 7 temperature
sensors.emplace_back(static_cast<std::string>(kSensorTp0x));
sensors.emplace_back(static_cast<std::string>(kSensorTp0X));
// CPU performance core 8 temperature
sensors.emplace_back(static_cast<std::string>(kSensorTp0b));
// CPU efficient core 1 temperature
sensors.emplace_back(static_cast<std::string>(kSensorTp09));
// CPU efficient core 2 temperature
sensors.emplace_back(static_cast<std::string>(kSensorTp0t));
sensors.emplace_back(static_cast<std::string>(kSensorTp0T));

aux_sensors.emplace_back(static_cast<std::string>(kSensorTc0a));
aux_sensors.emplace_back(static_cast<std::string>(kSensorTc0b));
Expand All @@ -510,11 +510,11 @@ double SmcTemp::GetGpuTemp() {
double temp = 0.0;
#if defined(ARCH_TYPE_X86_64)
const std::pair<unsigned int, unsigned int> valid_temperature_limits{0, 110};
temp = smc_accessor_.ReadValue(kSensorTg0d);
temp = smc_accessor_.ReadValue(kSensorTG0D);
if (IsValidTemperature(temp, valid_temperature_limits)) {
return temp;
}
temp = smc_accessor_.ReadValue(kSensorTpcd);
temp = smc_accessor_.ReadValue(kSensorTPCD);
if (IsValidTemperature(temp, valid_temperature_limits)) {
return temp;
}
Expand Down
36 changes: 18 additions & 18 deletions smctemp.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ constexpr int kOpReadGpuTemp = 3;
// - https://github.com/acidanthera/VirtualSMC/blob/632fec680d996a5dd015afd9acf0ba40f75e69e2/Docs/SMCSensorKeys.txt
#if defined(ARCH_TYPE_X86_64)
// CPU
constexpr UInt32Char_t kSensorTc0d = "TC0D"; // CPU die temperature
constexpr UInt32Char_t kSensorTc0e = "TC0E"; // CPU PECI die filtered temperature
constexpr UInt32Char_t kSensorTc0f = "TC0F"; // CPU PECI die temperature filtered then adjusted
constexpr UInt32Char_t kSensorTc0p = "TC0P"; // CPU proximity temperature
constexpr UInt32Char_t kSensorTC0D = "TC0D"; // CPU die temperature
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
At least two spaces is best between code and comments [whitespace/comments] [2]

constexpr UInt32Char_t kSensorTC0E = "TC0E"; // CPU PECI die filtered temperature
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
At least two spaces is best between code and comments [whitespace/comments] [2]

constexpr UInt32Char_t kSensorTC0F = "TC0F"; // CPU PECI die temperature filtered then adjusted
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
At least two spaces is best between code and comments [whitespace/comments] [2]

constexpr UInt32Char_t kSensorTC0P = "TC0P"; // CPU proximity temperature
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
At least two spaces is best between code and comments [whitespace/comments] [2]

// GPU
constexpr UInt32Char_t kSensorTg0d = "TG0D"; // PCH Die Temp
constexpr UInt32Char_t kSensorTpcd = "TPCD"; // PCH Die Temp (digital)
constexpr UInt32Char_t kSensorTG0D = "TG0D"; // PCH Die Temp
constexpr UInt32Char_t kSensorTPCD = "TPCD"; // PCH Die Temp (digital)
#elif defined(ARCH_TYPE_ARM64)
// CPU
constexpr UInt32Char_t kSensorTc0a = "Tc0a";
Expand All @@ -64,31 +64,31 @@ constexpr UInt32Char_t kSensorTc0x = "Tc0x";
constexpr UInt32Char_t kSensorTc0z = "Tc0z";
constexpr UInt32Char_t kSensorTp01 = "Tp01";
constexpr UInt32Char_t kSensorTp05 = "Tp05";
constexpr UInt32Char_t kSensorTp0d = "Tp0D";
constexpr UInt32Char_t kSensorTp0h = "Tp0H";
constexpr UInt32Char_t kSensorTp0l = "Tp0L";
constexpr UInt32Char_t kSensorTp0p = "Tp0P";
constexpr UInt32Char_t kSensorTp0x = "Tp0X";
constexpr UInt32Char_t kSensorTp0b = "Tp0b";
constexpr UInt32Char_t kSensorTp09 = "Tp09";
constexpr UInt32Char_t kSensorTp0t = "Tp0T";
constexpr UInt32Char_t kSensorTp0j = "Tp0j";
constexpr UInt32Char_t kSensorTp0r = "Tp0r";
constexpr UInt32Char_t kSensorTp0D = "Tp0D";
constexpr UInt32Char_t kSensorTp0H = "Tp0H";
constexpr UInt32Char_t kSensorTp0L = "Tp0L";
constexpr UInt32Char_t kSensorTp0P = "Tp0P";
constexpr UInt32Char_t kSensorTp0T = "Tp0T";
constexpr UInt32Char_t kSensorTp0X = "Tp0X";
constexpr UInt32Char_t kSensorTp0b = "Tp0b";
constexpr UInt32Char_t kSensorTp0f = "Tp0f";
constexpr UInt32Char_t kSensorTp0j = "Tp0j";
constexpr UInt32Char_t kSensorTp0n = "Tp0n";
constexpr UInt32Char_t kSensorTp0r = "Tp0r";
// GPU
constexpr UInt32Char_t kSensorTg1b = "Tg1b";
constexpr UInt32Char_t kSensorTg4b = "Tg4b";
constexpr UInt32Char_t kSensorTg05 = "Tg05";
constexpr UInt32Char_t kSensorTg0D = "Tg0D";
constexpr UInt32Char_t kSensorTg0P = "Tg0P";
constexpr UInt32Char_t kSensorTg0L = "Tg0L";
constexpr UInt32Char_t kSensorTg0P = "Tg0P";
constexpr UInt32Char_t kSensorTg0T = "Tg0T";
constexpr UInt32Char_t kSensorTg0X = "Tg0X";
constexpr UInt32Char_t kSensorTg0b = "Tg0b";
constexpr UInt32Char_t kSensorTg0f = "Tg0f";
constexpr UInt32Char_t kSensorTg0j = "Tg0j";
constexpr UInt32Char_t kSensorTg0v = "Tg0v";
constexpr UInt32Char_t kSensorTg1b = "Tg1b";
constexpr UInt32Char_t kSensorTg4b = "Tg4b";
#endif

class SmcAccessor {
Expand Down
Loading