add decimal config
This commit is contained in:
@@ -1291,6 +1291,7 @@ struct MiniSettings {
|
|||||||
bool realFrequencies;
|
bool realFrequencies;
|
||||||
bool realVolts;
|
bool realVolts;
|
||||||
bool realTemps;
|
bool realTemps;
|
||||||
|
bool realTempsDec;
|
||||||
bool showFullCPU;
|
bool showFullCPU;
|
||||||
bool showFullResolution;
|
bool showFullResolution;
|
||||||
bool showFanPercentage;
|
bool showFanPercentage;
|
||||||
@@ -1327,6 +1328,7 @@ struct MicroSettings {
|
|||||||
bool realFrequencies;
|
bool realFrequencies;
|
||||||
bool realVolts;
|
bool realVolts;
|
||||||
bool realTemps;
|
bool realTemps;
|
||||||
|
bool realTempsDec;
|
||||||
bool showFullCPU;
|
bool showFullCPU;
|
||||||
bool showFullResolution;
|
bool showFullResolution;
|
||||||
bool showSOCVoltage;
|
bool showSOCVoltage;
|
||||||
@@ -1411,6 +1413,7 @@ ALWAYS_INLINE void GetConfigSettings(MiniSettings* settings) {
|
|||||||
settings->realFrequencies = true;
|
settings->realFrequencies = true;
|
||||||
settings->realVolts = true;
|
settings->realVolts = true;
|
||||||
settings->realTemps = true;
|
settings->realTemps = true;
|
||||||
|
settings->realTempsDec = false;
|
||||||
settings->showFullCPU = false;
|
settings->showFullCPU = false;
|
||||||
settings->showFullResolution = true;
|
settings->showFullResolution = true;
|
||||||
settings->showFanPercentage = true;
|
settings->showFanPercentage = true;
|
||||||
@@ -1494,6 +1497,14 @@ ALWAYS_INLINE void GetConfigSettings(MiniSettings* settings) {
|
|||||||
convertToUpper(key);
|
convertToUpper(key);
|
||||||
settings->realTemps = (key == "TRUE");
|
settings->realTemps = (key == "TRUE");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
it = section.find("real_temps_dec");
|
||||||
|
if (it != section.end()) {
|
||||||
|
key = it->second;
|
||||||
|
convertToUpper(key);
|
||||||
|
settings->realTempsDec = !(key == "FALSE");
|
||||||
|
}
|
||||||
|
|
||||||
// Process font sizes with shared bounds
|
// Process font sizes with shared bounds
|
||||||
static constexpr long minFontSize = 8;
|
static constexpr long minFontSize = 8;
|
||||||
static constexpr long maxFontSize = 22;
|
static constexpr long maxFontSize = 22;
|
||||||
@@ -1710,6 +1721,7 @@ ALWAYS_INLINE void GetConfigSettings(MicroSettings* settings) {
|
|||||||
settings->realFrequencies = true;
|
settings->realFrequencies = true;
|
||||||
settings->realVolts = true;
|
settings->realVolts = true;
|
||||||
settings->realTemps = true;
|
settings->realTemps = true;
|
||||||
|
settings->realTempsDec = false;
|
||||||
settings->showFullCPU = false;
|
settings->showFullCPU = false;
|
||||||
settings->showFullResolution = false;
|
settings->showFullResolution = false;
|
||||||
settings->showSOCVoltage = true;
|
settings->showSOCVoltage = true;
|
||||||
@@ -1787,6 +1799,13 @@ ALWAYS_INLINE void GetConfigSettings(MicroSettings* settings) {
|
|||||||
settings->realTemps = (key == "TRUE");
|
settings->realTemps = (key == "TRUE");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
it = section.find("real_temps_dec");
|
||||||
|
if (it != section.end()) {
|
||||||
|
key = it->second;
|
||||||
|
convertToUpper(key);
|
||||||
|
settings->realTempsDec = !(key == "FALSE");
|
||||||
|
}
|
||||||
|
|
||||||
it = section.find("show_full_cpu");
|
it = section.find("show_full_cpu");
|
||||||
if (it != section.end()) {
|
if (it != section.end()) {
|
||||||
key = it->second;
|
key = it->second;
|
||||||
|
|||||||
@@ -411,6 +411,12 @@ public:
|
|||||||
});
|
});
|
||||||
list->addItem(realTemps);
|
list->addItem(realTemps);
|
||||||
|
|
||||||
|
auto *realTempsDec = new tsl::elm::ToggleListItem("Real Temp Decimals", getCurrentRealTempsDec());
|
||||||
|
realTempsDec->setStateChangedListener([this, section](bool state) {
|
||||||
|
ult::setIniFileValue(configIniPath, section, "real_temps_dec", state ? "true" : "false");
|
||||||
|
});
|
||||||
|
list->addItem(realTempsDec);
|
||||||
|
|
||||||
auto* showFullCPU = new tsl::elm::ToggleListItem("Full CPU", getCurrentShowFullCPU());
|
auto* showFullCPU = new tsl::elm::ToggleListItem("Full CPU", getCurrentShowFullCPU());
|
||||||
showFullCPU->setStateChangedListener([this, section](bool state) {
|
showFullCPU->setStateChangedListener([this, section](bool state) {
|
||||||
ult::setIniFileValue(configIniPath, section, "show_full_cpu", state ? "true" : "false");
|
ult::setIniFileValue(configIniPath, section, "show_full_cpu", state ? "true" : "false");
|
||||||
@@ -567,6 +573,14 @@ private:
|
|||||||
return value == "TRUE";
|
return value == "TRUE";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool getCurrentRealTempsDec() {
|
||||||
|
const std::string section = isMiniMode ? "mini" : "micro";
|
||||||
|
std::string value = ult::parseValueFromIniSection(configIniPath, section, "real_temps_dec");
|
||||||
|
if (value.empty()) return true;
|
||||||
|
convertToUpper(value);
|
||||||
|
return value == "TRUE";
|
||||||
|
}
|
||||||
|
|
||||||
bool getCurrentShowFullCPU() {
|
bool getCurrentShowFullCPU() {
|
||||||
const std::string section = isMiniMode ? "mini" : "micro";
|
const std::string section = isMiniMode ? "mini" : "micro";
|
||||||
std::string value = ult::parseValueFromIniSection(configIniPath, section, "show_full_cpu");
|
std::string value = ult::parseValueFromIniSection(configIniPath, section, "show_full_cpu");
|
||||||
|
|||||||
@@ -1100,13 +1100,25 @@ public:
|
|||||||
|
|
||||||
if (settings.realTemps) {
|
if (settings.realTemps) {
|
||||||
if (realCPU_Temp != 0) {
|
if (realCPU_Temp != 0) {
|
||||||
|
if (settings.realTempsDec) {
|
||||||
snprintf(CPU_temp_c, sizeof(CPU_temp_c), "%.1f°C", realCPU_Temp / 1000.0f);
|
snprintf(CPU_temp_c, sizeof(CPU_temp_c), "%.1f°C", realCPU_Temp / 1000.0f);
|
||||||
|
} else {
|
||||||
|
snprintf(CPU_temp_c, sizeof(CPU_temp_c), "%u°C", static_cast<u32>(realCPU_Temp / 1000.0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (realGPU_Temp != 0) {
|
if (realGPU_Temp != 0) {
|
||||||
|
if (settings.realTempsDec) {
|
||||||
snprintf(GPU_temp_c, sizeof(GPU_temp_c), "%.1f°C", realGPU_Temp / 1000.0f);
|
snprintf(GPU_temp_c, sizeof(GPU_temp_c), "%.1f°C", realGPU_Temp / 1000.0f);
|
||||||
|
} else {
|
||||||
|
snprintf(GPU_temp_c, sizeof(GPU_temp_c), "%u°C", static_cast<u32>(realGPU_Temp / 1000.0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (realRAM_Temp != 0) {
|
if (realRAM_Temp != 0) {
|
||||||
|
if (settings.realTempsDec) {
|
||||||
snprintf(RAM_temp_c, sizeof(RAM_temp_c), "%.1f°C", realRAM_Temp / 1000.0f);
|
snprintf(RAM_temp_c, sizeof(RAM_temp_c), "%.1f°C", realRAM_Temp / 1000.0f);
|
||||||
|
} else {
|
||||||
|
snprintf(RAM_temp_c, sizeof(RAM_temp_c), "%u°C", static_cast<u32>(realRAM_Temp / 1000.0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1290,13 +1290,25 @@ public:
|
|||||||
|
|
||||||
if (settings.realTemps) {
|
if (settings.realTemps) {
|
||||||
if (realCPU_Temp != 0) {
|
if (realCPU_Temp != 0) {
|
||||||
|
if (settings.realTempsDec) {
|
||||||
snprintf(CPU_temp_c, sizeof(CPU_temp_c), "%.1f°C", realCPU_Temp / 1000.0f);
|
snprintf(CPU_temp_c, sizeof(CPU_temp_c), "%.1f°C", realCPU_Temp / 1000.0f);
|
||||||
|
} else {
|
||||||
|
snprintf(CPU_temp_c, sizeof(CPU_temp_c), "%u°C", static_cast<u32>(realCPU_Temp / 1000.0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (realGPU_Temp != 0) {
|
if (realGPU_Temp != 0) {
|
||||||
|
if (settings.realTempsDec) {
|
||||||
snprintf(GPU_temp_c, sizeof(GPU_temp_c), "%.1f°C", realGPU_Temp / 1000.0f);
|
snprintf(GPU_temp_c, sizeof(GPU_temp_c), "%.1f°C", realGPU_Temp / 1000.0f);
|
||||||
|
} else {
|
||||||
|
snprintf(GPU_temp_c, sizeof(GPU_temp_c), "%u°C", static_cast<u32>(realGPU_Temp / 1000.0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (realRAM_Temp != 0) {
|
if (realRAM_Temp != 0) {
|
||||||
|
if (settings.realTempsDec) {
|
||||||
snprintf(RAM_temp_c, sizeof(RAM_temp_c), "%.1f°C", realRAM_Temp / 1000.0f);
|
snprintf(RAM_temp_c, sizeof(RAM_temp_c), "%.1f°C", realRAM_Temp / 1000.0f);
|
||||||
|
} else {
|
||||||
|
snprintf(RAM_temp_c, sizeof(RAM_temp_c), "%u°C", static_cast<u32>(realRAM_Temp / 1000.0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user