From b2c81aceee457475de29b52f4645792edcf27ea9 Mon Sep 17 00:00:00 2001 From: les Date: Tue, 5 Oct 2010 14:47:48 +0000 Subject: [PATCH] Actuator: Fixed motors not going to min throttle in failsafe. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1884 ebee16cc-31ac-478f-84a7-5cbb03baadba --- flight/OpenPilot/Modules/Actuator/actuator.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/flight/OpenPilot/Modules/Actuator/actuator.c b/flight/OpenPilot/Modules/Actuator/actuator.c index 97f3e3c7f..39e286f9a 100644 --- a/flight/OpenPilot/Modules/Actuator/actuator.c +++ b/flight/OpenPilot/Modules/Actuator/actuator.c @@ -357,10 +357,22 @@ static void setFailsafe() ActuatorCommandGet(&command); ActuatorSettingsGet(&settings); - // Reset ActuatorCommand to neutral values + + MixerSettingsData mixerSettings; + MixerSettingsGet (&mixerSettings); + Mixer_t * mixers = (Mixer_t *)&mixerSettings.Mixer0Type; //pointer to array of mixers in UAVObjects + + // Reset ActuatorCommand to safe values for (int n = 0; n < ACTUATORCOMMAND_CHANNEL_NUMELEM; ++n) { - command.Channel[n] = settings.ChannelNeutral[n]; + if(mixers[n].type == MIXERSETTINGS_MIXER0TYPE_MOTOR) + { + command.Channel[n] = settings.ChannelMin[n]; + } + else + { + command.Channel[n] = settings.ChannelNeutral[n]; + } } // Set alarm