Skip to content

armgit / flix

Public Imported from GitHub
0

Making an ESP32-based quadcopter from scratch

Exit auto mode when sticks moved only when mode switch is not configured

Oleg Kalachev9ca68415589a
diff --git a/docs/usage.md b/docs/usage.md
index 974f851..18493e8 100644
--- a/docs/usage.md
+++ b/docs/usage.md
@@ -266,7 +266,7 @@ In this mode, the pilot controls the angular rates. This control method is diffi
In this mode, the pilot inputs are ignored (except the mode switch). The drone can be controlled using [pyflix](../tools/pyflix/) Python library, or by modifying the firmware to implement the needed behavior.
-If the pilot moves the control sticks, the drone will switch back to *STAB* mode.
+If the pilot moves the control sticks and mode switch is not configured, the drone will switch back to *STAB* mode.
## Wi-Fi configuration
diff --git a/flix/safety.ino b/flix/safety.ino
index 1d67010..05fd758 100644
--- a/flix/safety.ino
+++ b/flix/safety.ino
@@ -37,8 +37,8 @@ void descend() {
void autoFailsafe() {
static float roll, pitch, yaw, throttle;
if (roll != controlRoll || pitch != controlPitch || yaw != controlYaw || abs(throttle - controlThrottle) > 0.05) {
- // controls changed
- if (mode == AUTO) mode = STAB; // regain control by the pilot
+ // controls changed and mode switch is not configured
+ if (mode == AUTO && invalid(controlMode)) mode = STAB; // regain control by the pilot
}
roll = controlRoll;
pitch = controlPitch;