Issue #15: Introduce safety weigths
This commit is contained in:
parent
c4fe006efa
commit
9880c701b1
@ -103,6 +103,18 @@ enum config_override_entry_type {
|
||||
SAFETY_MEMORY_CONFIG_OVERRIDE_PERSISTANCE = 2,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Weights of error flags.
|
||||
*/
|
||||
enum config_override_weight {
|
||||
SAFETY_MEMORY_CONFIG_WEIGHT_NONE = 0, /**< @brief This flag has no global error consequence, but might be respected by certain software modules. */
|
||||
SAFETY_MEMORY_CONFIG_WEIGHT_PID = 1, /**< @brief This flag will force a stop of the temperature PID controller */
|
||||
SAFETY_MEMORY_CONFIG_WEIGHT_PANIC = 2, /**< @brief This flag will trigger the panic mode */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief representation of a config override memory entry
|
||||
*/
|
||||
struct config_override {
|
||||
enum config_override_entry_type type;
|
||||
union {
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user