From 9eea3f1030345cf117f9697dceaa1e3aa825d7de Mon Sep 17 00:00:00 2001 From: Andy Piper Date: Sat, 29 May 2021 12:52:08 +0100 Subject: [PATCH] AP_BLHeli: add auto support to rover --- libraries/AP_BLHeli/AP_BLHeli.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/libraries/AP_BLHeli/AP_BLHeli.cpp b/libraries/AP_BLHeli/AP_BLHeli.cpp index 02f49baf17..7aa887eb4e 100644 --- a/libraries/AP_BLHeli/AP_BLHeli.cpp +++ b/libraries/AP_BLHeli/AP_BLHeli.cpp @@ -26,7 +26,12 @@ #ifdef HAVE_AP_BLHELI_SUPPORT #include +#include +#if APM_BUILD_TYPE(APM_BUILD_Rover) +#include +#else #include +#endif #include #include #include @@ -53,7 +58,7 @@ const AP_Param::GroupInfo AP_BLHeli::var_info[] = { // @User: Advanced AP_GROUPINFO("MASK", 1, AP_BLHeli, channel_mask, 0), -#if APM_BUILD_TYPE(APM_BUILD_ArduCopter) || APM_BUILD_TYPE(APM_BUILD_ArduPlane) +#if APM_BUILD_TYPE(APM_BUILD_ArduCopter) || APM_BUILD_TYPE(APM_BUILD_ArduPlane) || APM_BUILD_TYPE(APM_BUILD_Rover) // @Param: AUTO // @DisplayName: BLHeli auto-enable for multicopter motors // @Description: If set to 1 this auto-enables BLHeli pass-thru support for all multicopter motors @@ -1355,12 +1360,16 @@ void AP_BLHeli::init(void) digital_mask = mask; } -#if APM_BUILD_TYPE(APM_BUILD_ArduCopter) || APM_BUILD_TYPE(APM_BUILD_ArduPlane) +#if APM_BUILD_TYPE(APM_BUILD_ArduCopter) || APM_BUILD_TYPE(APM_BUILD_ArduPlane) || APM_BUILD_TYPE(APM_BUILD_Rover) /* plane and copter can use AP_Motors to get an automatic mask */ if (channel_auto.get() == 1) { - AP_Motors *motors = AP_Motors::get_singleton(); +#if APM_BUILD_TYPE(APM_BUILD_Rover) + AP_MotorsUGV *motors = AP::motors_ugv(); +#else + AP_Motors *motors = AP::motors(); +#endif if (motors) { uint16_t motormask = motors->get_motor_mask(); // set the rest of the digital channels