diff --git a/stm-firmware/safety/safety-controller.c b/stm-firmware/safety/safety-controller.c index 53b539d..d7f72c9 100644 --- a/stm-firmware/safety/safety-controller.c +++ b/stm-firmware/safety/safety-controller.c @@ -43,7 +43,7 @@ #include #define check_flag_persistent(flag) ((flag)->persistency && (flag)->persistency->persistency) -#define get_flag_weight(flag) ((flag)->weight ? (flag->weight->weight) : SAFETY_FLAG_CONFIG_WEIGHT_NONE) +#define get_flag_weight(flag) ((flag)->weight ? ((flag)->weight->weight) : SAFETY_FLAG_CONFIG_WEIGHT_NONE) struct safety_weight { uint32_t start_dummy; @@ -388,7 +388,8 @@ static int report_error(enum safety_flag flag, uint32_t key, bool prevent_error_ flags[i].error_state_inv = !flags[i].error_state; flags[i].key = key; - if (check_flag_persistent(&flags[i]) && !old_state && !prevent_error_mem_enty) { + if ((check_flag_persistent(&flags[i]) && !old_state && !prevent_error_mem_enty) || + get_flag_weight(&flags[i]) == SAFETY_FLAG_CONFIG_WEIGHT_PANIC) { err_mem_entry.counter = 1; err_mem_entry.flag_num = flag_enum_to_flag_no(flags[i].flag); err_mem_entry.type = SAFETY_MEMORY_ERR_ENTRY_FLAG;