From 3f344bde4d6176050cddc677b62a9e7d08f5dc25 Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Wed, 16 Mar 2016 15:58:38 +0100 Subject: [PATCH] LP-228 Treat Gimbal outputs only if CamStab module is enabled. --- flight/modules/Actuator/actuator.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/flight/modules/Actuator/actuator.c b/flight/modules/Actuator/actuator.c index 54b6fba7f..f3f77ca41 100644 --- a/flight/modules/Actuator/actuator.c +++ b/flight/modules/Actuator/actuator.c @@ -45,6 +45,7 @@ #include "mixersettings.h" #include "mixerstatus.h" #include "cameradesired.h" +#include "hwsettings.h" #include "manualcontrolcommand.h" #include "taskinfo.h" #include @@ -85,6 +86,7 @@ static xQueueHandle queue; static xTaskHandle taskHandle; static FrameType_t frameType = FRAME_TYPE_MULTIROTOR; static SystemSettingsThrustControlOptions thrustType = SYSTEMSETTINGS_THRUSTCONTROL_THROTTLE; +static bool camStabEnabled; static uint8_t pinsMode[MAX_MIX_ACTUATORS]; // used to inform the actuator thread that actuator update rate is changed @@ -157,6 +159,12 @@ int32_t ActuatorInitialize() // Register AccessoryDesired (Secondary input to this module) AccessoryDesiredInitialize(); + // Check if CameraStab module is enabled + HwSettingsOptionalModulesData optionalModules; + HwSettingsInitialize(); + HwSettingsOptionalModulesGet(&optionalModules); + camStabEnabled = (optionalModules.CameraStab == HWSETTINGS_OPTIONALMODULES_ENABLED); + // Primary output of this module ActuatorCommandInitialize(); @@ -448,8 +456,9 @@ static void actuatorTask(__attribute__((unused)) void *parameters) if ((mixer_type >= MIXERSETTINGS_MIXER1TYPE_CAMERAROLLORSERVO1) && (mixer_type <= MIXERSETTINGS_MIXER1TYPE_CAMERAYAW)) { - CameraDesiredData cameraDesired; - if (CameraDesiredGet(&cameraDesired) == 0) { + if (camStabEnabled) { + CameraDesiredData cameraDesired; + CameraDesiredGet(&cameraDesired); switch (mixer_type) { case MIXERSETTINGS_MIXER1TYPE_CAMERAROLLORSERVO1: status[ct] = cameraDesired.RollOrServo1;