From 885d46c8dfce8972754564f1989659b651437201 Mon Sep 17 00:00:00 2001 From: Vladimir Zidar Date: Fri, 8 Sep 2017 13:22:42 +0200 Subject: [PATCH] LP-549 Make ASWA throttle threshold configurable. Add FlightModeSettings.AlwaysStabilizeWhenArmedThrottleThreshold with default value of 0.2 --- flight/modules/ManualControl/manualcontrol.c | 4 ++-- shared/uavobjectdefinition/flightmodesettings.xml | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/flight/modules/ManualControl/manualcontrol.c b/flight/modules/ManualControl/manualcontrol.c index fa9cf6978..81c40eb9f 100644 --- a/flight/modules/ManualControl/manualcontrol.c +++ b/flight/modules/ManualControl/manualcontrol.c @@ -66,7 +66,6 @@ #define ASSISTEDCONTROL_BRAKETHRUST_DEADBAND_FACTOR_HI 1.04f #define ALWAYSTABILIZEACCESSORY_THRESHOLD 0.05f -#define ALWAYSTABILIZETHROTTLE_THRESHOLD 0.2f // defined handlers @@ -500,7 +499,8 @@ static void manualControlTask(void) if (alwaysStabilizedSwitch) { if (acc.AccessoryVal <= -ALWAYSTABILIZEACCESSORY_THRESHOLD) { newAlwaysStabilized = FLIGHTSTATUS_ALWAYSSTABILIZEWHENARMED_FALSE; - } else if ((acc.AccessoryVal >= ALWAYSTABILIZEACCESSORY_THRESHOLD) && (cmd.Thrust >= ALWAYSTABILIZETHROTTLE_THRESHOLD)) { // && Thrust (or Throttle?) above threshold + } else if ((acc.AccessoryVal >= ALWAYSTABILIZEACCESSORY_THRESHOLD) && + (cmd.Throttle >= modeSettings.AlwaysStabilizeWhenArmedThrottleThreshold)) { newAlwaysStabilized = FLIGHTSTATUS_ALWAYSSTABILIZEWHENARMED_TRUE; } } else { diff --git a/shared/uavobjectdefinition/flightmodesettings.xml b/shared/uavobjectdefinition/flightmodesettings.xml index 42d50e142..e11cb706b 100644 --- a/shared/uavobjectdefinition/flightmodesettings.xml +++ b/shared/uavobjectdefinition/flightmodesettings.xml @@ -82,7 +82,8 @@ options="Disabled,Accessory 0,Accessory 1,Accessory 2,Accessory 3" defaultvalue="Disabled" description="For Multirotors. Always stabilize no matter the throttle setting when vehicle is armed. Does not work when vehicle is set to Always Armed."/> - + +