From c1f810f1cef6a3774127149c1e3505b92dd3e05c Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Wed, 22 Jan 2014 00:01:38 +0100 Subject: [PATCH] OP-1188 fix an issue that is preventing bank initialization at startup --- flight/modules/Stabilization/stabilization.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/flight/modules/Stabilization/stabilization.c b/flight/modules/Stabilization/stabilization.c index 186c10739..65462ae0c 100644 --- a/flight/modules/Stabilization/stabilization.c +++ b/flight/modules/Stabilization/stabilization.c @@ -194,7 +194,6 @@ MODULE_INITCALL(StabilizationInitialize, StabilizationStart); static void stabilizationTask(__attribute__((unused)) void *parameters) { UAVObjEvent ev; - uint32_t timeval = PIOS_DELAY_GetRaw(); ActuatorDesiredData actuatorDesired; @@ -760,10 +759,10 @@ static void SettingsBankUpdatedCb(__attribute__((unused)) UAVObjEvent *ev) if (cur_flight_mode < 0 || cur_flight_mode >= NUM_FMS_POSITIONS) { return; } - if ((settings.FlightModeMap[cur_flight_mode] == 0 && ev->obj != StabilizationSettingsBank1Handle()) || - (settings.FlightModeMap[cur_flight_mode] == 1 && ev->obj != StabilizationSettingsBank2Handle()) || - (settings.FlightModeMap[cur_flight_mode] == 2 && ev->obj != StabilizationSettingsBank3Handle()) || - settings.FlightModeMap[cur_flight_mode] > 2) { + if ((ev) && ((settings.FlightModeMap[cur_flight_mode] == 0 && ev->obj != StabilizationSettingsBank1Handle()) || + (settings.FlightModeMap[cur_flight_mode] == 1 && ev->obj != StabilizationSettingsBank2Handle()) || + (settings.FlightModeMap[cur_flight_mode] == 2 && ev->obj != StabilizationSettingsBank3Handle()) || + settings.FlightModeMap[cur_flight_mode] > 2)) { return; }