From 1b1163da102c858b099426a3499af59459b72c82 Mon Sep 17 00:00:00 2001 From: Dominic Clifton Date: Mon, 9 Mar 2015 23:42:18 +0100 Subject: [PATCH] Previously, at minimum throttle, the quad would do absolutely no self-leveling and simply run the motors at constant minthrottle. This allowed the chance for the quad to lose control during flight if the throttle was set to minimum, say, to drop from a high altitude to a lower one. With this edit, the quad will still self-level at minimum throttle when armed, allowing for safe decents from altitude. To prevent motors spinning when arming/disarming, the yaw input is ignored if the throttle is at minimum and we're using the sticks to arm/disarm. Conflicts: src/main/flight/mixer.c added cli command disable_pid_at_min_throttle (same as previous) --- src/main/config/config.c | 1 + src/main/config/config_master.h | 2 +- src/main/flight/mixer.c | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/config/config.c b/src/main/config/config.c index 55150f758..45861c92e 100644 --- a/src/main/config/config.c +++ b/src/main/config/config.c @@ -380,6 +380,7 @@ static void resetConf(void) masterConfig.small_angle = 25; masterConfig.disable_pid_at_min_throttle = 0; + masterConfig.airplaneConfig.flaps_speed = 0; masterConfig.airplaneConfig.fixedwing_althold_dir = 1; diff --git a/src/main/config/config_master.h b/src/main/config/config_master.h index 357ecbc0f..6de9f68a1 100644 --- a/src/main/config/config_master.h +++ b/src/main/config/config_master.h @@ -65,7 +65,7 @@ typedef struct master_t { uint8_t disarm_kill_switch; // allow disarm via AUX switch regardless of throttle value uint8_t auto_disarm_delay; // allow automatically disarming multicopters after auto_disarm_delay seconds of zero throttle. Disabled when 0 uint8_t small_angle; - uint8_t disable_pid_at_min_throttle; // when enabled (nonzero), ignore pids at minimum throttle + uint8_t disable_pid_at_min_throttle; // when enabled (nonzero), ignore pids at minimum throttle airplaneConfig_t airplaneConfig; diff --git a/src/main/flight/mixer.c b/src/main/flight/mixer.c index ea74f2021..f222d7887 100755 --- a/src/main/flight/mixer.c +++ b/src/main/flight/mixer.c @@ -701,6 +701,8 @@ void mixTable(void) if ((rcData[THROTTLE]) < rxConfig->mincheck) { if (feature(FEATURE_MOTOR_STOP)) { motor[i] = escAndServoConfig->mincommand; + } else if (masterConfig.disable_pid_at_min_throttle != 0) { + motor[i] = escAndServoConfig->minthrottle; } } }