1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-31 16:52:10 +01:00

Merged in mindnever/librepilot/LP-401_Fix_Reboot_is_required_after_AutoTune_is_set_in_FMS (pull request #322)

LP-401 Fix for missing reboot-required after FMS was configured with autotune
This commit is contained in:
Philippe Renon 2016-09-21 21:07:41 +02:00
commit e7c4b4b302

View File

@ -159,6 +159,19 @@ static void UpdateSystemIdentState(const float *X, const float *noise, float dT_
static void UpdateStabilizationDesired(bool doingIdent); static void UpdateStabilizationDesired(bool doingIdent);
static void flightModeSettingsUpdatedCb(__attribute__((unused)) UAVObjEvent *ev)
{
FlightModeSettingsFlightModePositionOptions fms[FLIGHTMODESETTINGS_FLIGHTMODEPOSITION_NUMELEM];
FlightModeSettingsFlightModePositionGet(fms);
for (uint8_t i = 0; i < FLIGHTMODESETTINGS_FLIGHTMODEPOSITION_NUMELEM; ++i) {
if (fms[i] == FLIGHTMODESETTINGS_FLIGHTMODEPOSITION_AUTOTUNE) {
ExtendedAlarmsSet(SYSTEMALARMS_ALARM_BOOTFAULT, SYSTEMALARMS_ALARM_CRITICAL, SYSTEMALARMS_EXTENDEDALARMSTATUS_REBOOTREQUIRED, 0);
break;
}
}
}
/** /**
* Initialise the module, called on startup * Initialise the module, called on startup
* \returns 0 on success or -1 if initialisation failed * \returns 0 on success or -1 if initialisation failed
@ -202,6 +215,10 @@ int32_t AutoTuneInitialize(void)
} }
} }
if (!moduleEnabled) {
FlightModeSettingsConnectCallback(flightModeSettingsUpdatedCb);
}
return 0; return 0;
} }