1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +01:00

When a channel is disabled in the mixer force the channel to have a 0 us pulse

duration.  The default before was neutral in failsafe.
This commit is contained in:
James Cotton 2011-05-11 20:09:28 -05:00
parent 5d28276c49
commit 338d363289

View File

@ -198,8 +198,12 @@ static void actuatorTask(void* parameters)
float curve2 = MixerCurve(desired.Throttle,mixerSettings.ThrottleCurve2);
for(int ct=0; ct < MAX_MIX_ACTUATORS; ct++)
{
if(mixers[ct].type == MIXERSETTINGS_MIXER1TYPE_DISABLED)
if(mixers[ct].type == MIXERSETTINGS_MIXER1TYPE_DISABLED) {
// Set to minimum if disabled. This is not the same as saying PWM pulse = 0 us
status[ct] = -1;
command.Channel[ct] = 0;
continue;
}
status[ct] = ProcessMixer(ct, curve1, curve2, &mixerSettings, &desired, dT);
@ -400,14 +404,19 @@ static void setFailsafe()
// Reset ActuatorCommand to safe values
for (int n = 0; n < ACTUATORCOMMAND_CHANNEL_NUMELEM; ++n)
{
if(mixers[n].type == MIXERSETTINGS_MIXER1TYPE_MOTOR)
{
command.Channel[n] = settings.ChannelMin[n];
}
else
else if(mixers[n].type == MIXERSETTINGS_MIXER1TYPE_SERVO)
{
command.Channel[n] = settings.ChannelNeutral[n];
}
else
{
command.Channel[n] = 0;
}
}
// Set alarm