From 2610344266c024b708314012c610890bd038a861 Mon Sep 17 00:00:00 2001 From: Bruce Luckcuck Date: Sat, 24 Feb 2018 09:08:23 -0500 Subject: [PATCH] Disable stick command processing while ARMING_DISABLED_RUNAWAY_TAKEOFF is set Addresses the rare possibility that if runway takeoff triggers and disarms while the pilot has the sticks in some valid stick command configuration. Prevents the stick command from processing until the craft is disarmed and the ARMING_DISABLED_RUNAWAY_TAKEOFF condition is cleared. For example, if the pilot was mid throttle and went full yaw right and runway takeoff triggered, then camera control would have be entered. --- src/main/fc/rc_controls.c | 2 +- src/test/unit/rc_controls_unittest.cc | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/fc/rc_controls.c b/src/main/fc/rc_controls.c index e02fa0dc3..49280ef80 100644 --- a/src/main/fc/rc_controls.c +++ b/src/main/fc/rc_controls.c @@ -215,7 +215,7 @@ void processRcStickPositions() return; } - if (ARMING_FLAG(ARMED) || doNotRepeat || rcDelayMs <= STICK_DELAY_MS) { + if (ARMING_FLAG(ARMED) || doNotRepeat || rcDelayMs <= STICK_DELAY_MS || (getArmingDisableFlags() & ARMING_DISABLED_RUNAWAY_TAKEOFF)) { return; } doNotRepeat = true; diff --git a/src/test/unit/rc_controls_unittest.cc b/src/test/unit/rc_controls_unittest.cc index 97862dbce..e498b70e3 100644 --- a/src/test/unit/rc_controls_unittest.cc +++ b/src/test/unit/rc_controls_unittest.cc @@ -730,3 +730,6 @@ PG_REGISTER(systemConfig_t, systemConfig, PG_SYSTEM_CONFIG, 2); void resetArmingDisabled(void) {} timeDelta_t getTaskDeltaTime(cfTaskId_e) { return 20000; } } +armingDisableFlags_e getArmingDisableFlags(void) { + return (armingDisableFlags_e) 0; +} \ No newline at end of file -- 2.11.4.GIT