mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-19 04:52:12 +01:00
LP-401 Add sanity check for FlightModeSettings to bring up reboot-required alarm if flightmode has autotune, but no autotune modules started.
This commit is contained in:
parent
a8f09d277e
commit
4e427f69db
@ -159,6 +159,19 @@ static void UpdateSystemIdentState(const float *X, const float *noise, float dT_
|
||||
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
|
||||
* \returns 0 on success or -1 if initialisation failed
|
||||
@ -202,6 +215,10 @@ int32_t AutoTuneInitialize(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (!moduleEnabled) {
|
||||
FlightModeSettingsConnectCallback(flightModeSettingsUpdatedCb);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user