Issue #15: Introduce safety weigths
This commit is contained in:
		@@ -36,7 +36,7 @@
 | 
			
		||||
#include <stddef.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <reflow-controller/safety/safety-memory.h>
 | 
			
		||||
#include <helper-macros/helper-macros.h>
 | 
			
		||||
#include <helper-macros/helper-macros.h>s
 | 
			
		||||
 | 
			
		||||
struct error_flag {
 | 
			
		||||
	const char *name;
 | 
			
		||||
@@ -69,6 +69,11 @@ struct analog_mon {
 | 
			
		||||
	uint64_t timestamp;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct safety_weight {
 | 
			
		||||
	enum config_override_weight weight;
 | 
			
		||||
	enum safety_flag flag;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#ifdef COUNT_OF
 | 
			
		||||
#undef COUNT_OF
 | 
			
		||||
#endif
 | 
			
		||||
@@ -78,6 +83,7 @@ struct analog_mon {
 | 
			
		||||
#define ERR_FLAG_ENTRY(errflag, persistency) {.name=#errflag, .flag = (errflag), .error_state = false, .error_state_inv = true, .persistent = (persistency), .key = 0UL}
 | 
			
		||||
#define TIM_MON_ENTRY(mon, min, max, flag) {.name=#mon, .monitor = (mon), .associated_flag=(flag), .min_delta = (min), .max_delta = (max), .last = 0ULL, .enabled= false}
 | 
			
		||||
#define ANA_MON_ENTRY(mon, min_value, max_value, flag) {.name=#mon, .monitor = (mon), .associated_flag=(flag), .min = (min_value), .max = (max_value), .value = 0.0f, .valid = false}
 | 
			
		||||
#define ERR_FLAG_WEIGTH()
 | 
			
		||||
 | 
			
		||||
static volatile struct error_flag IN_SECTION(.ccm.data) flags[] = {
 | 
			
		||||
	ERR_FLAG_ENTRY(ERR_FLAG_MEAS_ADC_OFF, false),
 | 
			
		||||
@@ -112,6 +118,10 @@ static volatile struct analog_mon IN_SECTION(.ccm.data) analog_mons[] = {
 | 
			
		||||
		      ERR_FLAG_AMON_UC_TEMP),
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static volatile struct safety_weight IN_SECTION(.ccm.data) flag_weigths[] = {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static bool error_flag_get_status(const volatile struct error_flag *flag)
 | 
			
		||||
{
 | 
			
		||||
	if (flag->error_state == flag->error_state_inv) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user