Add tracking & display for maximum CPU Temperature. Make the enable_temperature flag working as expected

This commit is contained in:
Sam Demeulemeester 2022-04-07 02:27:41 +02:00 committed by Sam Demeulemeester
parent 272f1ce4f6
commit 5580f7562d
4 changed files with 16 additions and 6 deletions

View File

@ -91,7 +91,7 @@ error_mode_t error_mode = ERROR_MODE_NONE;
cpu_state_t cpu_state[MAX_CPUS];
bool enable_temperature = false;
bool enable_temperature = true;
bool enable_trace = false;
bool enable_sm = true;
@ -761,7 +761,7 @@ void config_init(void)
cpu_state[i] = CPU_STATE_ENABLED;
}
enable_temperature = !no_temperature;
enable_temperature &= !no_temperature;
power_save = POWER_SAVE_HIGH;

View File

@ -64,6 +64,8 @@ static bool timed_update_done = false; // update cycle status
int scroll_message_row;
int max_cpu_temp = 0;
//------------------------------------------------------------------------------
// Public Functions
//------------------------------------------------------------------------------
@ -347,7 +349,15 @@ void do_tick(int my_cpu)
// Update temperature one time per second
if (enable_temperature) {
display_temperature(get_cpu_temperature());
int actual_cpu_temp = get_cpu_temperature();
if(max_cpu_temp < actual_cpu_temp ) {
max_cpu_temp = actual_cpu_temp;
}
if(actual_cpu_temp != 0) {
display_temperature(actual_cpu_temp, max_cpu_temp);
}
}
// Update TTY one time every TTY_UPDATE_PERIOD second(s)

View File

@ -145,8 +145,8 @@
#define display_run_time(hours, mins, secs) \
printf(7, 47, "%i:%02i:%02i", hours, mins, secs)
#define display_temperature(temp) \
printf(1, 20, "%2i/%2i%cC", temp, temp, 0xf8)
#define display_temperature(temp, maxtemp) \
printf(1, 20, "%2i/%2i%cC", temp, maxtemp, 0xf8)
#define display_pass_count(count) \
printi(8, 47, count, 0, false, true)

View File

@ -246,7 +246,7 @@ static void global_init(void)
if (enable_temperature) {
int temp = get_cpu_temperature();
if (temp > 0) {
display_temperature(temp);
display_temperature(temp, temp);
} else {
enable_temperature = false;
no_temperature = true;