mini: fix garbage temp reading

This commit is contained in:
Lightos1
2026-04-04 12:15:09 +02:00
parent df0969ba6f
commit 8faaaa58d9

View File

@@ -39,6 +39,10 @@ private:
std::atomic<bool> touchPollRunning{false}; std::atomic<bool> touchPollRunning{false};
public: public:
MiniOverlay() { MiniOverlay() {
CPU_temp_c[0] = '\0';
GPU_temp_c[0] = '\0';
RAM_temp_c[0] = '\0';
tsl::hlp::requestForeground(false); tsl::hlp::requestForeground(false);
disableJumpTo = true; disableJumpTo = true;
//tsl::initializeUltrahandSettings(); //tsl::initializeUltrahandSettings();
@@ -1070,7 +1074,7 @@ public:
} }
} }
if (settings.realTemps && realCPU_Temp != 0) { if (settings.realTemps && realCPU_Temp != 0 && CPU_temp_c[0] != '\0') {
char temp_buffer[48]; char temp_buffer[48];
snprintf(temp_buffer, sizeof(temp_buffer), " %s", CPU_temp_c); snprintf(temp_buffer, sizeof(temp_buffer), " %s", CPU_temp_c);
strncat(MINI_CPU_compressed_c, temp_buffer, sizeof(MINI_CPU_compressed_c) - strlen(MINI_CPU_compressed_c) - 1); strncat(MINI_CPU_compressed_c, temp_buffer, sizeof(MINI_CPU_compressed_c) - strlen(MINI_CPU_compressed_c) - 1);
@@ -1110,7 +1114,7 @@ public:
} }
} }
if (settings.realTemps && realGPU_Temp != 0) { if (settings.realTemps && realGPU_Temp != 0 && GPU_temp_c[0] != '\0') {
char temp_buffer[48]; char temp_buffer[48];
snprintf(temp_buffer, sizeof(temp_buffer), " %s", GPU_temp_c); snprintf(temp_buffer, sizeof(temp_buffer), " %s", GPU_temp_c);
strncat(MINI_GPU_Load_c, temp_buffer, sizeof(MINI_GPU_Load_c) - strlen(MINI_GPU_Load_c) - 1); strncat(MINI_GPU_Load_c, temp_buffer, sizeof(MINI_GPU_Load_c) - strlen(MINI_GPU_Load_c) - 1);
@@ -1218,7 +1222,8 @@ public:
} }
} }
} }
if (settings.realTemps && realRAM_Temp != 0) {
if (settings.realTemps && realRAM_Temp != 0 && RAM_temp_c[0] != '\0') {
char temp_buffer[48]; char temp_buffer[48];
snprintf(temp_buffer, sizeof(temp_buffer), " %s", RAM_temp_c); snprintf(temp_buffer, sizeof(temp_buffer), " %s", RAM_temp_c);
strncat(MINI_RAM_var_compressed_c, temp_buffer, sizeof(MINI_RAM_var_compressed_c) - strlen(MINI_RAM_var_compressed_c) - 1); strncat(MINI_RAM_var_compressed_c, temp_buffer, sizeof(MINI_RAM_var_compressed_c) - strlen(MINI_RAM_var_compressed_c) - 1);