1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-30 15:52:12 +01:00

OP-1704 - Change Hook alarm level to Critical to prevent arming and allow them to be disabled with DisableSanityChecks

This commit is contained in:
Alessio Morale 2015-02-09 00:50:22 +01:00
parent a4da83a1be
commit 26893554c0

View File

@ -178,26 +178,26 @@ int32_t configuration_check()
} }
} }
uint8_t checks_disabled;
FlightModeSettingsDisableSanityChecksGet(&checks_disabled);
if (checks_disabled == FLIGHTMODESETTINGS_DISABLESANITYCHECKS_TRUE) {
severity = SYSTEMALARMS_ALARM_WARNING;
}
// query sanity check hooks // query sanity check hooks
if (severity == SYSTEMALARMS_ALARM_OK) { if (severity < SYSTEMALARMS_ALARM_CRITICAL) {
SANITYCHECK_CustomHookInstance *instance = NULL; SANITYCHECK_CustomHookInstance *instance = NULL;
LL_FOREACH(hooks, instance) { LL_FOREACH(hooks, instance) {
if (instance->enabled) { if (instance->enabled) {
alarmstatus = instance->hook(); alarmstatus = instance->hook();
if (alarmstatus != SYSTEMALARMS_EXTENDEDALARMSTATUS_NONE) { if (alarmstatus != SYSTEMALARMS_EXTENDEDALARMSTATUS_NONE) {
severity = SYSTEMALARMS_ALARM_WARNING; severity = SYSTEMALARMS_ALARM_CRITICAL;
break; break;
} }
} }
} }
} }
uint8_t checks_disabled;
FlightModeSettingsDisableSanityChecksGet(&checks_disabled);
if (checks_disabled == FLIGHTMODESETTINGS_DISABLESANITYCHECKS_TRUE) {
severity = SYSTEMALARMS_ALARM_WARNING;
}
if (severity != SYSTEMALARMS_ALARM_OK) { if (severity != SYSTEMALARMS_ALARM_OK) {
ExtendedAlarmsSet(SYSTEMALARMS_ALARM_SYSTEMCONFIGURATION, severity, alarmstatus, alarmsubstatus); ExtendedAlarmsSet(SYSTEMALARMS_ALARM_SYSTEMCONFIGURATION, severity, alarmstatus, alarmsubstatus);
} else { } else {