Lock onto the first error source until cleared

Do not overwrite the error source if the error flag is already set.

As checks are performed in priority order, this ensures min/maxtemp
user-level handlers are triggered even if the thermal model can detect
an issue in the same cycle.

This restores MAXTEMP handling, which was simply shadowed.
This commit is contained in:
Yuri D'Elia 2022-06-09 11:08:54 +02:00
parent f82048977a
commit 8220d0196b

View file

@ -485,12 +485,16 @@ void set_temp_error(TempErrorSource source, uint8_t index, TempErrorType type)
}
#endif
// set the error state
// set the initial error source
if(!temp_error_state.error) {
temp_error_state.source = (uint8_t)source;
temp_error_state.index = index;
temp_error_state.type = (uint8_t)type;
}
// always set the error state
temp_error_state.error = true;
temp_error_state.assert = true;
temp_error_state.source = (uint8_t)source;
temp_error_state.index = index;
temp_error_state.type = (uint8_t)type;
}
void handle_temp_error();