From 49a0aa7036663e88b706ad436d07cb1f7271be33 Mon Sep 17 00:00:00 2001 From: Oleg Kalachev Date: Tue, 7 Oct 2025 15:42:11 +0300 Subject: [PATCH] Reset yaw target when drone disarmed Prevent unexpected behavior when the drone tries to restore its old yaw on takeoff. --- flix/control.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flix/control.ino b/flix/control.ino index 1c157c1..38c59d7 100644 --- a/flix/control.ino +++ b/flix/control.ino @@ -80,7 +80,7 @@ void interpretControls() { if (mode == STAB) { float yawTarget = attitudeTarget.getYaw(); - if (invalid(yawTarget) || controlYaw != 0) yawTarget = attitude.getYaw(); // reset yaw target if NAN or pilot commands yaw rate + if (!armed || invalid(yawTarget) || controlYaw != 0) yawTarget = attitude.getYaw(); // reset yaw target attitudeTarget = Quaternion::fromEuler(Vector(controlRoll * tiltMax, controlPitch * tiltMax, yawTarget)); ratesExtra = Vector(0, 0, -controlYaw * maxRate.z); // positive yaw stick means clockwise rotation in FLU }