mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
LP-443 - Handle arming
This commit is contained in:
parent
ce87ce105e
commit
4f045bc73a
@ -202,6 +202,7 @@ static filterResult filter(stateFilter *self, stateEstimation *state)
|
||||
float dT;
|
||||
uint16_t sensors = 0;
|
||||
|
||||
INSSetArmed(state->armed);
|
||||
|
||||
this->work.updated |= state->updated;
|
||||
// check magnetometer alarm, discard any magnetometer readings if not OK
|
||||
|
@ -70,8 +70,9 @@ typedef struct {
|
||||
float airspeed[2];
|
||||
float baro[1];
|
||||
float auxMag[3];
|
||||
uint8_t magStatus;
|
||||
float boardMag[3];
|
||||
uint8_t magStatus;
|
||||
bool armed;
|
||||
sensorUpdates updated;
|
||||
} stateEstimation;
|
||||
|
||||
|
@ -355,7 +355,6 @@ static void StateEstimationCb(void)
|
||||
static stateEstimation states;
|
||||
static uint32_t last_time;
|
||||
static uint16_t bootDelay = 64;
|
||||
|
||||
// after system startup, first few sensor readings might be messed up, delay until everything has settled
|
||||
if (bootDelay) {
|
||||
bootDelay--;
|
||||
@ -373,12 +372,13 @@ static void StateEstimationCb(void)
|
||||
} else {
|
||||
last_time = PIOS_DELAY_GetRaw();
|
||||
}
|
||||
FlightStatusArmedOptions fsarmed;
|
||||
FlightStatusArmedGet(&fsarmed);
|
||||
states.armed = fsarmed != FLIGHTSTATUS_ARMED_DISARMED;
|
||||
|
||||
// check if a new filter chain should be initialized
|
||||
if (fusionAlgorithm != revoSettings.FusionAlgorithm) {
|
||||
FlightStatusData fs;
|
||||
FlightStatusGet(&fs);
|
||||
if (fs.Armed == FLIGHTSTATUS_ARMED_DISARMED || fusionAlgorithm == FILTER_INIT_FORCE) {
|
||||
if (fsarmed == FLIGHTSTATUS_ARMED_DISARMED || fusionAlgorithm == FILTER_INIT_FORCE) {
|
||||
const filterPipeline *newFilterChain;
|
||||
switch ((RevoSettingsFusionAlgorithmOptions)revoSettings.FusionAlgorithm) {
|
||||
case REVOSETTINGS_FUSIONALGORITHM_BASICCOMPLEMENTARY:
|
||||
|
Loading…
Reference in New Issue
Block a user