1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +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 "mixersettings.h"
#include "mixerstatus.h" #include "mixerstatus.h"
#include "cameradesired.h" #include "cameradesired.h"
#include "hwsettings.h"
#include "manualcontrolcommand.h" #include "manualcontrolcommand.h"
#include "taskinfo.h" #include "taskinfo.h"
#include <systemsettings.h> #include <systemsettings.h>
@ -85,6 +86,7 @@ static xQueueHandle queue;
static xTaskHandle taskHandle; static xTaskHandle taskHandle;
static FrameType_t frameType = FRAME_TYPE_MULTIROTOR; static FrameType_t frameType = FRAME_TYPE_MULTIROTOR;
static SystemSettingsThrustControlOptions thrustType = SYSTEMSETTINGS_THRUSTCONTROL_THROTTLE; static SystemSettingsThrustControlOptions thrustType = SYSTEMSETTINGS_THRUSTCONTROL_THROTTLE;
static bool camStabEnabled;
static uint8_t pinsMode[MAX_MIX_ACTUATORS]; static uint8_t pinsMode[MAX_MIX_ACTUATORS];
// used to inform the actuator thread that actuator update rate is changed // 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) // Register AccessoryDesired (Secondary input to this module)
AccessoryDesiredInitialize(); AccessoryDesiredInitialize();
// Check if CameraStab module is enabled
HwSettingsOptionalModulesData optionalModules;
HwSettingsInitialize();
HwSettingsOptionalModulesGet(&optionalModules);
camStabEnabled = (optionalModules.CameraStab == HWSETTINGS_OPTIONALMODULES_ENABLED);
// Primary output of this module // Primary output of this module
ActuatorCommandInitialize(); ActuatorCommandInitialize();
@ -448,8 +456,9 @@ static void actuatorTask(__attribute__((unused)) void *parameters)
if ((mixer_type >= MIXERSETTINGS_MIXER1TYPE_CAMERAROLLORSERVO1) && if ((mixer_type >= MIXERSETTINGS_MIXER1TYPE_CAMERAROLLORSERVO1) &&
(mixer_type <= MIXERSETTINGS_MIXER1TYPE_CAMERAYAW)) { (mixer_type <= MIXERSETTINGS_MIXER1TYPE_CAMERAYAW)) {
if (camStabEnabled) {
CameraDesiredData cameraDesired; CameraDesiredData cameraDesired;
if (CameraDesiredGet(&cameraDesired) == 0) { CameraDesiredGet(&cameraDesired);
switch (mixer_type) { switch (mixer_type) {
case MIXERSETTINGS_MIXER1TYPE_CAMERAROLLORSERVO1: case MIXERSETTINGS_MIXER1TYPE_CAMERAROLLORSERVO1:
status[ct] = cameraDesired.RollOrServo1; status[ct] = cameraDesired.RollOrServo1;