mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-27 16:54:15 +01:00
OP-474: When throttle < 0 and "spin while armed" mode enabled don't take into
account stabilization or stick - stay at neutral
This commit is contained in:
parent
21a71e5294
commit
93d8449814
@ -195,32 +195,36 @@ static void actuatorTask(void* parameters)
|
|||||||
bool spinWhileArmed = settings.MotorsSpinWhileArmed == ACTUATORSETTINGS_MOTORSSPINWHILEARMED_TRUE &&
|
bool spinWhileArmed = settings.MotorsSpinWhileArmed == ACTUATORSETTINGS_MOTORSSPINWHILEARMED_TRUE &&
|
||||||
manualControl.Armed == MANUALCONTROLCOMMAND_ARMED_TRUE;
|
manualControl.Armed == MANUALCONTROLCOMMAND_ARMED_TRUE;
|
||||||
|
|
||||||
bool zeroMotors = !armed || (!spinWhileArmed && !positiveThrottle);
|
|
||||||
|
|
||||||
float curve1 = MixerCurve(desired.Throttle,mixerSettings.ThrottleCurve1);
|
float curve1 = MixerCurve(desired.Throttle,mixerSettings.ThrottleCurve1);
|
||||||
float curve2 = MixerCurve(desired.Throttle,mixerSettings.ThrottleCurve2);
|
float curve2 = MixerCurve(desired.Throttle,mixerSettings.ThrottleCurve2);
|
||||||
for(int ct=0; ct < MAX_MIX_ACTUATORS; ct++)
|
for(int ct=0; ct < MAX_MIX_ACTUATORS; ct++)
|
||||||
{
|
{
|
||||||
if(mixers[ct].type != MIXERSETTINGS_MIXER1TYPE_DISABLED)
|
if(mixers[ct].type == MIXERSETTINGS_MIXER1TYPE_DISABLED)
|
||||||
{
|
continue;
|
||||||
status[ct] = ProcessMixer(ct, curve1, curve2, &mixerSettings, &desired, dT);
|
|
||||||
|
status[ct] = ProcessMixer(ct, curve1, curve2, &mixerSettings, &desired, dT);
|
||||||
|
|
||||||
|
// Motors have additional protection for when to be on
|
||||||
|
if(mixers[ct].type == MIXERSETTINGS_MIXER1TYPE_MOTOR) {
|
||||||
|
|
||||||
if(zeroMotors && mixers[ct].type == MIXERSETTINGS_MIXER1TYPE_MOTOR)
|
// If not armed or motors aren't meant to spin all the time
|
||||||
|
if( !armed ||
|
||||||
|
(!spinWhileArmed && !positiveThrottle))
|
||||||
{
|
{
|
||||||
command.Channel[ct] = settings.ChannelMin[ct]; //force zero throttle
|
|
||||||
filterAccumulator[ct] = 0;
|
filterAccumulator[ct] = 0;
|
||||||
lastResult[ct] = 0;
|
lastResult[ct] = 0;
|
||||||
} else {
|
status[ct] = -1; //force min throttle
|
||||||
// For motors when armed and throttle (or flag to keep spinning) keep above neutral
|
}
|
||||||
if((mixers[ct].type == MIXERSETTINGS_MIXER1TYPE_MOTOR) && (status[ct] < 0))
|
// If armed meant to keep spinning,
|
||||||
status[ct] = 0;
|
else if ((spinWhileArmed && !positiveThrottle) ||
|
||||||
|
(status[ct] < 0) )
|
||||||
command.Channel[ct] = scaleChannel(status[ct],
|
status[ct] = 0;
|
||||||
settings.ChannelMax[ct],
|
|
||||||
settings.ChannelMin[ct],
|
|
||||||
settings.ChannelNeutral[ct]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
command.Channel[ct] = scaleChannel(status[ct],
|
||||||
|
settings.ChannelMax[ct],
|
||||||
|
settings.ChannelMin[ct],
|
||||||
|
settings.ChannelNeutral[ct]);
|
||||||
}
|
}
|
||||||
MixerStatusSet(&mixerStatus);
|
MixerStatusSet(&mixerStatus);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user