mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
LP-443 - disable Nav Alarm for non Nav algorithms
This commit is contained in:
parent
3eb4b45f04
commit
c5dec236f7
@ -184,7 +184,7 @@ static filterResult filter(stateFilter *self, stateEstimation *state)
|
||||
uint16_t sensors = 0;
|
||||
|
||||
INSSetArmed(state->armed);
|
||||
|
||||
state->navUsed = (this->usePos || this->navOnly);
|
||||
this->work.updated |= state->updated;
|
||||
// check magnetometer alarm, discard any magnetometer readings if not OK
|
||||
// during initialization phase (but let them through afterwards)
|
||||
|
@ -74,6 +74,7 @@ typedef struct {
|
||||
float debugNavYaw;
|
||||
uint8_t magStatus;
|
||||
bool navOk;
|
||||
bool navUsed;
|
||||
bool armed;
|
||||
sensorUpdates updated;
|
||||
} stateEstimation;
|
||||
|
@ -465,6 +465,7 @@ static void StateEstimationCb(void)
|
||||
bool error = 0;
|
||||
states.debugNavYaw = 0;
|
||||
states.navOk = false;
|
||||
states.navUsed = false;
|
||||
while (current != NULL) {
|
||||
int32_t result = current->filter->init((stateFilter *)current->filter);
|
||||
if (result != 0) {
|
||||
@ -600,10 +601,14 @@ static void StateEstimationCb(void)
|
||||
AlarmsClear(SYSTEMALARMS_ALARM_ATTITUDE);
|
||||
}
|
||||
|
||||
if (states.navOk) {
|
||||
AlarmsClear(SYSTEMALARMS_ALARM_NAV);
|
||||
if (!states.navUsed) {
|
||||
AlarmsSet(SYSTEMALARMS_ALARM_NAV, SYSTEMALARMS_ALARM_UNINITIALISED);
|
||||
} else {
|
||||
AlarmsSet(SYSTEMALARMS_ALARM_NAV, SYSTEMALARMS_ALARM_CRITICAL);
|
||||
if (states.navOk) {
|
||||
AlarmsClear(SYSTEMALARMS_ALARM_NAV);
|
||||
} else {
|
||||
AlarmsSet(SYSTEMALARMS_ALARM_NAV, SYSTEMALARMS_ALARM_CRITICAL);
|
||||
}
|
||||
}
|
||||
|
||||
if (updatedSensors) {
|
||||
|
Loading…
Reference in New Issue
Block a user