Issue #18: Write init of safety memory
This commit is contained in:
@@ -30,10 +30,12 @@
|
||||
#include <reflow-controller/stack-check.h>
|
||||
#include <helper-macros/helper-macros.h>
|
||||
#include <reflow-controller/systick.h>
|
||||
#include <reflow-controller/safety/fault.h>
|
||||
#include <stm32/stm32f4xx.h>
|
||||
#include <cmsis/core_cm4.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <reflow-controller/safety/safety-memory.h>
|
||||
|
||||
struct error_flag {
|
||||
const char *name;
|
||||
@@ -248,6 +250,15 @@ void safety_controller_report_analog_value(enum analog_value_monitor monitor, fl
|
||||
|
||||
void safety_controller_init()
|
||||
{
|
||||
enum safety_memory_state found_memory_state;
|
||||
|
||||
/* Init the safety memory */
|
||||
if (safety_memory_init(&found_memory_state)) {
|
||||
/* Trigger panic mode! */
|
||||
panic_mode();
|
||||
}
|
||||
if (found_memory_state == SAFETY_MEMORY_INIT_CORRUPTED)
|
||||
safety_controller_report_error(ERR_FLAG_SAFETY_MEM_CORRUPT);
|
||||
|
||||
/* Init default flag states */
|
||||
safety_controller_report_error_with_key(ERR_FLAG_MEAS_ADC_OFF | ERR_FLAG_MEAS_ADC_UNSTABLE,
|
||||
|
||||
Reference in New Issue
Block a user