From bab6654070314a961e35d2d64a49a38434b0a3e9 Mon Sep 17 00:00:00 2001 From: MattKear Date: Fri, 3 May 2024 22:03:26 +0100 Subject: [PATCH] AP_MotorsHeli: Swash: Make motor numbers const --- libraries/AP_Motors/AP_MotorsHeli_Swash.cpp | 8 ++------ libraries/AP_Motors/AP_MotorsHeli_Swash.h | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/libraries/AP_Motors/AP_MotorsHeli_Swash.cpp b/libraries/AP_Motors/AP_MotorsHeli_Swash.cpp index 78c126890f7904..049ca0d073292c 100644 --- a/libraries/AP_Motors/AP_MotorsHeli_Swash.cpp +++ b/libraries/AP_Motors/AP_MotorsHeli_Swash.cpp @@ -88,13 +88,9 @@ const AP_Param::GroupInfo AP_MotorsHeli_Swash::var_info[] = { }; AP_MotorsHeli_Swash::AP_MotorsHeli_Swash(uint8_t mot_0, uint8_t mot_1, uint8_t mot_2, uint8_t mot_3, uint8_t instance) : - _instance(instance) + _instance(instance), + _motor_num{mot_0, mot_1, mot_2, mot_2} { - _motor_num[0] = mot_0; - _motor_num[1] = mot_1; - _motor_num[2] = mot_2; - _motor_num[3] = mot_3; - AP_Param::setup_object_defaults(this, var_info); } diff --git a/libraries/AP_Motors/AP_MotorsHeli_Swash.h b/libraries/AP_Motors/AP_MotorsHeli_Swash.h index cde9fde23f0a90..a1c84b21a21309 100644 --- a/libraries/AP_Motors/AP_MotorsHeli_Swash.h +++ b/libraries/AP_Motors/AP_MotorsHeli_Swash.h @@ -81,7 +81,7 @@ class AP_MotorsHeli_Swash { float _pitchFactor[_max_num_servos]; // Pitch axis scaling of servo output based on servo position float _collectiveFactor[_max_num_servos]; // Collective axis scaling of servo output based on servo position float _output[_max_num_servos]; // Servo output value - uint8_t _motor_num[_max_num_servos]; // Motor function to use for output + const uint8_t _motor_num[_max_num_servos]; // Motor function to use for output const uint8_t _instance; // Swashplate instance. Used for logging. // Variables stored for logging