update handling of analog monitors. Manually adding analog monotprs to the checking function is not necessary anymore
This commit is contained in:
parent
58c72fb2bc
commit
52272938b7
@ -48,6 +48,7 @@ struct analog_monitor_info {
|
||||
float min; /**< @brief Minumum value allowed */
|
||||
float max; /**< @brief Maximum value allowed */
|
||||
enum analog_monitor_status status; /**< @brief Current monitor status */
|
||||
enum safety_flag associated_flag; /**< @brief Associated safety flag, that will be set, if monitor out of range */
|
||||
uint64_t timestamp; /**< @brief ms timestamp when @ref analog_monitor_info::value was taken. */
|
||||
};
|
||||
|
||||
|
@ -358,24 +358,24 @@ static void safety_controller_process_active_timing_mons()
|
||||
static void safety_controller_process_monitor_checks(void)
|
||||
{
|
||||
static bool startup_completed = false;
|
||||
enum analog_monitor_status amon_state;
|
||||
float amon_value;
|
||||
struct analog_monitor_info amon_info;
|
||||
uint32_t idx;
|
||||
uint32_t analog_mon_count;
|
||||
|
||||
if (!startup_completed && systick_get_global_tick() >= 1000)
|
||||
startup_completed = true;
|
||||
|
||||
if (startup_completed) {
|
||||
analog_mon_count = safety_controller_get_analog_monitor_count();
|
||||
for (idx = 0; idx < analog_mon_count; idx++) {
|
||||
if (safety_controller_get_analog_mon_by_index(idx, &amon_info)) {
|
||||
panic_mode();
|
||||
}
|
||||
|
||||
|
||||
amon_state = safety_controller_get_analog_mon_value(ERR_AMON_VREF, &amon_value);
|
||||
if (amon_state != ANALOG_MONITOR_OK)
|
||||
safety_controller_report_error(ERR_FLAG_AMON_VREF);
|
||||
amon_state = safety_controller_get_analog_mon_value(ERR_AMON_UC_TEMP, &amon_value);
|
||||
if (amon_state != ANALOG_MONITOR_OK)
|
||||
safety_controller_report_error(ERR_FLAG_AMON_UC_TEMP);
|
||||
amon_state = safety_controller_get_analog_mon_value(ERR_AMON_SUPPLY_VOLT, &amon_value);
|
||||
if (amon_state != ANALOG_MONITOR_OK)
|
||||
safety_controller_report_error(ERR_FLAG_AMON_SUPPLY_VOLT);
|
||||
if (amon_info.status != ANALOG_MONITOR_OK) {
|
||||
safety_controller_report_error(amon_info.associated_flag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
safety_controller_process_active_timing_mons();
|
||||
@ -1005,6 +1005,7 @@ int safety_controller_get_analog_mon_by_index(uint32_t index, struct analog_moni
|
||||
info->min = mon->min;
|
||||
info->value = mon->value;
|
||||
info->timestamp = mon->timestamp;
|
||||
info->associated_flag = mon->associated_flag;
|
||||
|
||||
if (!mon->valid) {
|
||||
info->status = ANALOG_MONITOR_INACTIVE;
|
||||
|
Loading…
Reference in New Issue
Block a user