mirror of
https://github.com/memtest86plus/memtest86plus.git
synced 2024-11-23 08:26:23 -06:00
Fix display issue when current temperature and/or max temperature >= 100°C
This commit is contained in:
parent
4b17a4cc0c
commit
0adcdfa160
@ -298,6 +298,32 @@ void display_start_test(void)
|
||||
test_ticks = 0;
|
||||
}
|
||||
|
||||
void display_temperature(void)
|
||||
{
|
||||
if (!enable_temperature) {
|
||||
return;
|
||||
}
|
||||
|
||||
int actual_cpu_temp = get_cpu_temperature();
|
||||
|
||||
if (actual_cpu_temp == 0) {
|
||||
if (max_cpu_temp == 0) {
|
||||
enable_temperature = false;
|
||||
no_temperature = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (max_cpu_temp < actual_cpu_temp ) {
|
||||
max_cpu_temp = actual_cpu_temp;
|
||||
}
|
||||
|
||||
int offset = actual_cpu_temp / 100 + max_cpu_temp / 100;
|
||||
|
||||
clear_screen_region(1, 18, 1, 22);
|
||||
printf(1, 20-offset, "%2i/%2i%cC", actual_cpu_temp, max_cpu_temp, 0xF8);
|
||||
}
|
||||
|
||||
void check_input(void)
|
||||
{
|
||||
switch (get_key()) {
|
||||
@ -430,18 +456,8 @@ void do_tick(int my_cpu)
|
||||
// This only tick one time per second
|
||||
if (!timed_update_done) {
|
||||
|
||||
// Update temperature one time per second
|
||||
if (enable_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 temperature
|
||||
display_temperature();
|
||||
|
||||
// Update TTY one time every TTY_UPDATE_PERIOD second(s)
|
||||
if (enable_tty) {
|
||||
|
@ -175,9 +175,6 @@ typedef enum {
|
||||
#define display_run_time(hours, mins, secs) \
|
||||
printf(7, 51, "%i:%02i:%02i", hours, mins, secs)
|
||||
|
||||
#define display_temperature(temp, maxtemp) \
|
||||
printf(1, 20, "%2i/%2i%cC", temp, maxtemp, 0xf8)
|
||||
|
||||
#define display_pass_count(count) \
|
||||
printi(8, 51, count, 0, false, true)
|
||||
|
||||
@ -235,6 +232,8 @@ void display_start_pass(void);
|
||||
|
||||
void display_start_test(void);
|
||||
|
||||
void display_temperature(void);
|
||||
|
||||
void check_input(void);
|
||||
|
||||
void set_scroll_lock(bool enabled);
|
||||
|
11
app/main.c
11
app/main.c
@ -257,15 +257,8 @@ static void global_init(void)
|
||||
|
||||
master_cpu = 0;
|
||||
|
||||
if (enable_temperature) {
|
||||
int temp = get_cpu_temperature();
|
||||
if (temp > 0) {
|
||||
display_temperature(temp, temp);
|
||||
} else {
|
||||
enable_temperature = false;
|
||||
no_temperature = true;
|
||||
}
|
||||
}
|
||||
display_temperature();
|
||||
|
||||
if (enable_trace) {
|
||||
display_pinned_message(0, 0,"CPU Trace");
|
||||
display_pinned_message(1, 0,"--- ----------------------------------------------------------------------------");
|
||||
|
Loading…
Reference in New Issue
Block a user