Skip to content

Commit 9d05ed3

Browse files
mindneverfilnet
authored andcommitted
Merged in mindnever/librepilot/LP-549_aswa_fix (pull request #462)
LP-549 aswa fix Approved-by: Vladimir Zidar <mr_w@mindnever.org> Approved-by: Alessio Morale <alessiomorale@gmail.com> Approved-by: Mateusz Kaduk <mateusz.kaduk@gmail.com> Approved-by: Paul Jewell <teulupaul@gmail.com> Approved-by: Philippe Renon <philippe_renon@yahoo.fr> Approved-by: Lalanne Laurent <f5soh@free.fr> Approved-by: Jan NIJS <dr.oblivium@gmail.com>
2 parents e3a658d + 885d46c commit 9d05ed3

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

flight/modules/ManualControl/manualcontrol.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,8 @@ static void manualControlTask(void)
499499
if (alwaysStabilizedSwitch) {
500500
if (acc.AccessoryVal <= -ALWAYSTABILIZEACCESSORY_THRESHOLD) {
501501
newAlwaysStabilized = FLIGHTSTATUS_ALWAYSSTABILIZEWHENARMED_FALSE;
502-
} else if (acc.AccessoryVal >= ALWAYSTABILIZEACCESSORY_THRESHOLD) {
502+
} else if ((acc.AccessoryVal >= ALWAYSTABILIZEACCESSORY_THRESHOLD) &&
503+
(cmd.Throttle >= modeSettings.AlwaysStabilizeWhenArmedThrottleThreshold)) {
503504
newAlwaysStabilized = FLIGHTSTATUS_ALWAYSSTABILIZEWHENARMED_TRUE;
504505
}
505506
} else {

flight/modules/Stabilization/innerloop.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,10 +449,15 @@ static void stabilizationInnerloopTask()
449449
{
450450
FlightStatusArmedOptions armed;
451451
FlightStatusArmedGet(&armed);
452+
FlightStatusAlwaysStabilizeWhenArmedOptions alwaysStabilizeWhenArmed;
453+
FlightStatusAlwaysStabilizeWhenArmedGet(&alwaysStabilizeWhenArmed);
454+
452455
float throttleDesired;
453456
ManualControlCommandThrottleGet(&throttleDesired);
454457
if (armed != FLIGHTSTATUS_ARMED_ARMED ||
455-
((stabSettings.settings.LowThrottleZeroIntegral == STABILIZATIONSETTINGS_LOWTHROTTLEZEROINTEGRAL_TRUE) && throttleDesired < 0)) {
458+
((stabSettings.settings.LowThrottleZeroIntegral == STABILIZATIONSETTINGS_LOWTHROTTLEZEROINTEGRAL_TRUE) &&
459+
(throttleDesired < 0) &&
460+
(alwaysStabilizeWhenArmed != FLIGHTSTATUS_ALWAYSSTABILIZEWHENARMED_TRUE))) {
456461
// Force all axes to reinitialize when engaged
457462
for (t = 0; t < AXES; t++) {
458463
previous_mode[t] = 255;

shared/uavobjectdefinition/flightmodesettings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
options="Disabled,Accessory 0,Accessory 1,Accessory 2,Accessory 3"
8383
defaultvalue="Disabled"
8484
description="For Multirotors. Always stabilize no matter the throttle setting when vehicle is armed. Does not work when vehicle is set to Always Armed."/>
85+
<field name="AlwaysStabilizeWhenArmedThrottleThreshold" units="%" type="float" elements="1" defaultvalue="0.2"/>
8586

8687
<field name="ArmedTimeout" units="ms" type="uint16" elements="1" defaultvalue="30000"/>
8788
<field name="ArmingSequenceTime" units="ms" type="uint16" elements="1" defaultvalue="1000"/>

0 commit comments

Comments
 (0)