Restructure safety handle function. Now returns worst flag state set. Used to blink LED

This commit is contained in:
2022-07-30 16:04:46 +02:00
parent 6ac108e1b2
commit aaed95cc95
5 changed files with 33 additions and 19 deletions

View File

@@ -286,6 +286,7 @@ int main(void)
shellmatta_handle_t shell_handle;
int menu_wait_request;
uint64_t quarter_sec_timestamp = 0ULL;
enum config_weight worst_safety_flag = SAFETY_FLAG_CONFIG_WEIGHT_NONE;
/** - Setup all the peripherals and external componets like LCD, EEPROM etc. and the safety controller */
setup_system();
@@ -328,7 +329,7 @@ int main(void)
/* Check if any flags are present, that disable the PID controller. Blink
* LED 0 in this case
*/
if (oven_pid_get_status() == OVEN_PID_ABORTED)
if (worst_safety_flag >= SAFETY_FLAG_CONFIG_WEIGHT_PID)
led_set(0u, led_get(0u) ? 0 : 1);
else
led_set(0u, 0);
@@ -346,7 +347,7 @@ int main(void)
temp_profile_executer_handle();
/** - Handle the safety controller. This must be called! Otherwise a watchdog reset will occur */
safety_controller_handle();
worst_safety_flag = safety_controller_handle();
/** - If the Oven PID controller is running, we handle its sample function */
if (oven_pid_get_status() == OVEN_PID_RUNNING)