1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

LP-228 Treat Gimbal outputs only if CamStab module is enabled.

This commit is contained in:
Laurent Lalanne 2016-03-16 15:58:38 +01:00
parent 9e6989d6a1
commit 3f344bde4d

View File

@ -45,6 +45,7 @@
#include "mixersettings.h"
#include "mixerstatus.h"
#include "cameradesired.h"
#include "hwsettings.h"
#include "manualcontrolcommand.h"
#include "taskinfo.h"
#include <systemsettings.h>
@ -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)) {
if (camStabEnabled) {
CameraDesiredData cameraDesired;
if (CameraDesiredGet(&cameraDesired) == 0) {
CameraDesiredGet(&cameraDesired);
switch (mixer_type) {
case MIXERSETTINGS_MIXER1TYPE_CAMERAROLLORSERVO1:
status[ct] = cameraDesired.RollOrServo1;