From 81f3d3edda3a06de4bba8c22f7428349a2e32de2 Mon Sep 17 00:00:00 2001 From: Iampete1 Date: Fri, 5 May 2023 20:06:42 +0100 Subject: [PATCH] AP_Motors: Heli: get_output_mask return only motors --- libraries/AP_Motors/AP_MotorsHeli.cpp | 7 +++++++ libraries/AP_Motors/AP_MotorsHeli.h | 2 +- libraries/AP_Motors/AP_MotorsHeli_Dual.cpp | 19 ------------------- libraries/AP_Motors/AP_MotorsHeli_Dual.h | 3 --- libraries/AP_Motors/AP_MotorsHeli_Quad.cpp | 12 ------------ libraries/AP_Motors/AP_MotorsHeli_Quad.h | 3 --- libraries/AP_Motors/AP_MotorsHeli_RSC.cpp | 9 +++++++++ libraries/AP_Motors/AP_MotorsHeli_RSC.h | 3 +++ libraries/AP_Motors/AP_MotorsHeli_Single.cpp | 18 +----------------- 9 files changed, 21 insertions(+), 55 deletions(-) diff --git a/libraries/AP_Motors/AP_MotorsHeli.cpp b/libraries/AP_Motors/AP_MotorsHeli.cpp index 43db815da7..00724bbe5c 100644 --- a/libraries/AP_Motors/AP_MotorsHeli.cpp +++ b/libraries/AP_Motors/AP_MotorsHeli.cpp @@ -617,3 +617,10 @@ bool AP_MotorsHeli::arming_checks(size_t buflen, char *buffer) const return true; } + +// get_motor_mask - returns a bitmask of which outputs are being used for motors or servos (1 means being used) +// this can be used to ensure other pwm outputs (i.e. for servos) do not conflict +uint32_t AP_MotorsHeli::get_motor_mask() +{ + return _main_rotor.get_output_mask(); +} diff --git a/libraries/AP_Motors/AP_MotorsHeli.h b/libraries/AP_Motors/AP_MotorsHeli.h index 0e47f964e9..ef8ca00022 100644 --- a/libraries/AP_Motors/AP_MotorsHeli.h +++ b/libraries/AP_Motors/AP_MotorsHeli.h @@ -113,7 +113,7 @@ public: // get_motor_mask - returns a bitmask of which outputs are being used for motors or servos (1 means being used) // this can be used to ensure other pwm outputs (i.e. for servos) do not conflict - virtual uint32_t get_motor_mask() override = 0; + virtual uint32_t get_motor_mask() override; virtual void set_acro_tail(bool set) {} diff --git a/libraries/AP_Motors/AP_MotorsHeli_Dual.cpp b/libraries/AP_Motors/AP_MotorsHeli_Dual.cpp index 6dc77f5bd9..4e3613adcf 100644 --- a/libraries/AP_Motors/AP_MotorsHeli_Dual.cpp +++ b/libraries/AP_Motors/AP_MotorsHeli_Dual.cpp @@ -463,25 +463,6 @@ float AP_MotorsHeli_Dual::get_swashplate (int8_t swash_num, int8_t swash_axis, f return swash_tilt; } -// get_motor_mask - returns a bitmask of which outputs are being used for motors or servos (1 means being used) -// this can be used to ensure other pwm outputs (i.e. for servos) do not conflict -uint32_t AP_MotorsHeli_Dual::get_motor_mask() -{ - // dual heli uses channels 1,2,3,4,5,6 and 8 - uint32_t mask = 0; - for (uint8_t i=0; i