mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
OP-1161 discard magnetometer in filters if plausibility alarm is set
This commit is contained in:
parent
3d1cc31c3b
commit
c180846ca9
@ -33,6 +33,7 @@
|
||||
#include "inc/stateestimation.h"
|
||||
#include <attitudestate.h>
|
||||
#include <revocalibration.h>
|
||||
#include <systemalarms.h>
|
||||
#include <homelocation.h>
|
||||
|
||||
#include <CoordinateConversions.h>
|
||||
@ -81,8 +82,14 @@ static int32_t filter(stateFilter *self, stateEstimation *state)
|
||||
struct data *this = (struct data *)self->localdata;
|
||||
|
||||
if (IS_SET(state->updated, SENSORUPDATES_mag)) {
|
||||
if (this->revoCalibration.MagBiasNullingRate > 0) {
|
||||
magOffsetEstimation(this, state->mag);
|
||||
SystemAlarmsAlarmData alarms;
|
||||
SystemAlarmsAlarGet(&alarms);
|
||||
if (alarms.Magnetometer != SYSTEMALARMS_ALARM_OK) {
|
||||
UNSET_MASK(state->updated, SENSORUPDATES_mag);
|
||||
} else {
|
||||
if (this->revoCalibration.MagBiasNullingRate > 0) {
|
||||
magOffsetEstimation(this, state->mag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user