From e9e54dd813fba326f79771e4f0607a62bff9374d 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 9e18d0a1fa..78adcc5a1e 100644 --- a/libraries/AP_Motors/AP_Motors_Class.h +++ b/libraries/AP_Motors/AP_Motors_Class.h @@ -59,6 +59,7 @@ public: MOTOR_FRAME_TYPE_DJI_X = 13, // X frame, DJI ordering MOTOR_FRAME_TYPE_CW_X = 14, // X frame, clockwise ordering MOTOR_FRAME_TYPE_I = 15, // (sideways H) octo only + MOTOR_FRAME_TYPE_BF_X_REV = 18, // X frame, betaflight ordering, reversed motors }; // Constructor @@ -263,4 +264,4 @@ private: namespace AP { AP_Motors *motors(); -}; \ No newline at end of file +};