From 134d8b941b772882b7aeb7dc919301ed4ed43f73 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 14 Jan 2020 17:24:55 +1100 Subject: [PATCH] AP_Motors: added betaflight-x-reversed frame type --- libraries/AP_Motors/AP_MotorsMatrix.cpp | 7 +++++++ libraries/AP_Motors/AP_Motors_Class.h | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/libraries/AP_Motors/AP_MotorsMatrix.cpp b/libraries/AP_Motors/AP_MotorsMatrix.cpp index 82129b56f4..4444d689fe 100644 --- a/libraries/AP_Motors/AP_MotorsMatrix.cpp +++ b/libraries/AP_Motors/AP_MotorsMatrix.cpp @@ -517,6 +517,13 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty add_motor(AP_MOTORS_MOT_3, -135, AP_MOTORS_MATRIX_YAW_FACTOR_CCW,3); add_motor(AP_MOTORS_MOT_4, -45, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 4); break; + case MOTOR_FRAME_TYPE_BF_X_REV: + // betaflight quad X order, reversed motors + add_motor(AP_MOTORS_MOT_1, 135, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 2); + add_motor(AP_MOTORS_MOT_2, 45, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 1); + add_motor(AP_MOTORS_MOT_3, -135, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 3); + add_motor(AP_MOTORS_MOT_4, -45, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 4); + break; case MOTOR_FRAME_TYPE_DJI_X: // DJI quad X order // see https://forum44.djicdn.com/data/attachment/forum/201711/26/172348bppvtt1ot1nrtp5j.jpg diff --git a/libraries/AP_Motors/AP_Motors_Class.h b/libraries/AP_Motors/AP_Motors_Class.h index 2b1a96877b..6d15195924 100644 --- a/libraries/AP_Motors/AP_Motors_Class.h +++ b/libraries/AP_Motors/AP_Motors_Class.h @@ -61,6 +61,7 @@ public: MOTOR_FRAME_TYPE_I = 15, // (sideways H) octo only MOTOR_FRAME_TYPE_NYT_PLUS = 16, // plus frame, no differential torque for yaw MOTOR_FRAME_TYPE_NYT_X = 17, // X frame, no differential torque for yaw + MOTOR_FRAME_TYPE_BF_X_REV = 18, // X frame, betaflight ordering, reversed motors }; // Constructor @@ -265,4 +266,4 @@ private: namespace AP { AP_Motors *motors(); -}; \ No newline at end of file +};