Add timing monitor for main loop and add monitors to safety flag command

This commit is contained in:
2020-08-16 12:34:41 +02:00
parent fa3c980207
commit d1d2d514bd
5 changed files with 80 additions and 1 deletions

View File

@@ -37,12 +37,14 @@ enum safety_flag {
ERR_FLAG_WTCHDG_FIRED = (1<<11),
ERR_FLAG_UNCAL = (1<<12),
ERR_FLAG_DEBUG = (1<<13),
ERR_FLAG_TIMING_MAIN_LOOP = (1<<14),
};
enum timing_monitor {
ERR_TIMING_PID = (1<<0),
ERR_TIMING_MEAS_ADC = (1<<1),
ERR_TIMING_SAFETY_ADC = (1<<2),
ERR_TIMING_MAIN_LOOP = (1<<3),
};
enum analog_value_monitor {

View File

@@ -46,6 +46,14 @@ struct analog_monitor_info {
uint64_t timestamp;
};
struct timing_monitor_info {
uint64_t last_run;
uint64_t min;
uint64_t max;
bool enabled;
uint64_t delta;
};
/**
* @brief Initialize the safety controller
*
@@ -94,6 +102,12 @@ int safety_controller_get_analog_mon_by_index(uint32_t index, struct analog_moni
int safety_controller_get_analog_mon_name_by_index(uint32_t index, char *buffer, size_t buffsize);
int safety_controller_get_timing_mon_by_index(uint32_t index, struct timing_monitor_info *info);
int safety_controller_get_timing_mon_name_by_index(uint32_t index, char *buffer, size_t buffsize);
uint32_t safety_controller_get_timing_monitor_count();
#endif /* __SAFETY_CONTROLLER_H__ */
/** @} */