diff --git a/flight/CopterControl/Makefile b/flight/CopterControl/Makefile index 21fa59f97..349edd2d1 100644 --- a/flight/CopterControl/Makefile +++ b/flight/CopterControl/Makefile @@ -140,6 +140,7 @@ endif ## UAVOBJECTS ifndef TESTAPP +SRC += $(OPUAVSYNTHDIR)/accessorydesired.c SRC += $(OPUAVSYNTHDIR)/objectpersistence.c SRC += $(OPUAVSYNTHDIR)/gcstelemetrystats.c SRC += $(OPUAVSYNTHDIR)/flighttelemetrystats.c diff --git a/flight/Modules/ManualControl/manualcontrol.c b/flight/Modules/ManualControl/manualcontrol.c index 63543c67a..4d499b10c 100644 --- a/flight/Modules/ManualControl/manualcontrol.c +++ b/flight/Modules/ManualControl/manualcontrol.c @@ -42,6 +42,7 @@ #include "stabilizationdesired.h" #include "flighttelemetrystats.h" #include "flightstatus.h" +#include "accessorydesired.h" // Private constants #if defined(PIOS_MANUAL_STACK_SIZE) @@ -75,6 +76,7 @@ static ArmState_t armState; static portTickType lastSysTime; // Private functions +static void updateAccessoryDesired(ManualControlCommandData * cmd); static void updateActuatorDesired(ManualControlCommandData * cmd); static void updateStabilizationDesired(ManualControlCommandData * cmd, ManualControlSettingsData * settings); static void processFlightMode(ManualControlSettingsData * settings, float flightMode); @@ -294,17 +296,30 @@ static void manualControlTask(void *parameters) break; case FLIGHTMODE_MANUAL: updateActuatorDesired(&cmd); + updateAccessoryDesired(&cmd); break; case FLIGHTMODE_STABILIZED: updateStabilizationDesired(&cmd, &settings); + updateAccessoryDesired(&cmd); break; case FLIGHTMODE_GUIDANCE: + updateAccessoryDesired(&cmd); // TODO: Implement break; } } } +static void updateAccessoryDesired(ManualControlCommandData * cmd) +{ + AccessoryDesiredData accessory; + AccessoryDesiredGet(&accessory); + accessory.Accessory1 = cmd->Accessory1; + accessory.Accessory2 = cmd->Accessory2; + accessory.Accessory3 = cmd->Accessory3; + AccessoryDesiredSet(&accessory); +} + static void updateActuatorDesired(ManualControlCommandData * cmd) { ActuatorDesiredData actuator; diff --git a/flight/OpenPilot/UAVObjects.inc b/flight/OpenPilot/UAVObjects.inc index 4849367a9..3eb2fa571 100644 --- a/flight/OpenPilot/UAVObjects.inc +++ b/flight/OpenPilot/UAVObjects.inc @@ -24,6 +24,7 @@ # (all architectures) UAVOBJSRCFILENAMES = +UAVOBJSRCFILENAMES += accessorydesired UAVOBJSRCFILENAMES += actuatorcommand UAVOBJSRCFILENAMES += actuatordesired UAVOBJSRCFILENAMES += actuatorsettings diff --git a/flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/project.pbxproj b/flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/project.pbxproj index 0fc7ccf73..4f2252237 100644 --- a/flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/project.pbxproj +++ b/flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/project.pbxproj @@ -2738,6 +2738,7 @@ 65E6E09912E037C800058553 /* pios_adc_priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_adc_priv.h; sourceTree = ""; }; 65E8C743139A6D0900E1F979 /* pios_crc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pios_crc.c; sourceTree = ""; }; 65E8C745139A6D1A00E1F979 /* pios_crc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_crc.h; sourceTree = ""; }; + 65E8C788139AA2A800E1F979 /* accessorydesired.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = accessorydesired.xml; sourceTree = ""; }; 65E8EF1F11EEA61E00BBF654 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; name = Makefile; path = ../../OpenPilot/Makefile; sourceTree = SOURCE_ROOT; }; 65E8EF2011EEA61E00BBF654 /* Makefile.posix */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Makefile.posix; path = ../../OpenPilot/Makefile.posix; sourceTree = SOURCE_ROOT; }; 65E8EF5C11EEA61E00BBF654 /* alarms.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = alarms.c; path = ../../OpenPilot/System/alarms.c; sourceTree = SOURCE_ROOT; }; @@ -7418,6 +7419,7 @@ 65C35E4F12EFB2F3004811C2 /* uavobjectdefinition */ = { isa = PBXGroup; children = ( + 65E8C788139AA2A800E1F979 /* accessorydesired.xml */, 65C35E5012EFB2F3004811C2 /* actuatorcommand.xml */, 65C35E5112EFB2F3004811C2 /* actuatordesired.xml */, 65C35E5212EFB2F3004811C2 /* actuatorsettings.xml */, diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobjects.pro b/ground/openpilotgcs/src/plugins/uavobjects/uavobjects.pro index e895c74ea..8bd7420be 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobjects.pro +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobjects.pro @@ -23,7 +23,8 @@ SOURCES += uavobject.cpp \ OTHER_FILES += UAVObjects.pluginspec # Add in all of the synthetic/generated uavobject files -HEADERS += $$UAVOBJECT_SYNTHETICS/ahrsstatus.h \ +HEADERS += $$UAVOBJECT_SYNTHETICS/accessorydesired.h \ + $$UAVOBJECT_SYNTHETICS/ahrsstatus.h \ $$UAVOBJECT_SYNTHETICS/ahrscalibration.h \ $$UAVOBJECT_SYNTHETICS/baroaltitude.h \ $$UAVOBJECT_SYNTHETICS/attitudeactual.h \ @@ -69,7 +70,8 @@ HEADERS += $$UAVOBJECT_SYNTHETICS/ahrsstatus.h \ $$UAVOBJECT_SYNTHETICS/flightstatus.h \ $$UAVOBJECT_SYNTHETICS/attitudesettings.h -SOURCES += $$UAVOBJECT_SYNTHETICS/ahrsstatus.cpp \ +SOURCES += $$UAVOBJECT_SYNTHETICS/accessorydesired.cpp \ + $$UAVOBJECT_SYNTHETICS/ahrsstatus.cpp \ $$UAVOBJECT_SYNTHETICS/ahrscalibration.cpp \ $$UAVOBJECT_SYNTHETICS/baroaltitude.cpp \ $$UAVOBJECT_SYNTHETICS/attitudeactual.cpp \