diff --git a/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc b/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc index c5cffe94656544fb704a4e8e2a3101047a5ef6b4..419561db40dcc03399b1f72854777a5d0f5cf027 100644 --- a/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc +++ b/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc @@ -23,6 +23,8 @@ #include "RadioComponentController.h" #include "QGCCameraManager.h" #include "QGCFileDownload.h" +#include "SettingsManager.h" +#include "PlanViewSettings.h" #include @@ -279,7 +281,7 @@ void PX4FirmwarePlugin::getParameterMetaDataVersionInfo(const QString& metaDataF QList PX4FirmwarePlugin::supportedMissionCommands(void) { - return { + QList cmds = { MAV_CMD_NAV_WAYPOINT, MAV_CMD_NAV_LOITER_UNLIM, MAV_CMD_NAV_LOITER_TIME, MAV_CMD_NAV_LOITER_TO_ALT, MAV_CMD_NAV_LAND, MAV_CMD_NAV_TAKEOFF, MAV_CMD_NAV_RETURN_TO_LAUNCH, @@ -298,6 +300,12 @@ QList PX4FirmwarePlugin::supportedMissionCommands(void) MAV_CMD_NAV_DELAY, MAV_CMD_CONDITION_YAW, }; + + if (qgcApp()->toolbox()->settingsManager()->planViewSettings()->useConditionGate()->rawValue().toBool()) { + cmds.append(MAV_CMD_CONDITION_GATE); + } + + return cmds; } QString PX4FirmwarePlugin::missionCommandOverrides(MAV_TYPE vehicleType) const diff --git a/src/Settings/PlanView.SettingsGroup.json b/src/Settings/PlanView.SettingsGroup.json index eb1921d9d94c202513305533517669f02b0250eb..38a63492c720542939922789cc398fc57ce1fbd0 100644 --- a/src/Settings/PlanView.SettingsGroup.json +++ b/src/Settings/PlanView.SettingsGroup.json @@ -16,5 +16,11 @@ "shortDescription": "Show/Hide the mission item status display", "type": "bool", "defaultValue": false +}, +{ + "name": "useConditionGate", + "shortDescription": "Use MAV_CMD_CONDITION_GATE for pattern generation", + "type": "bool", + "defaultValue": false } ] diff --git a/src/Settings/PlanViewSettings.cc b/src/Settings/PlanViewSettings.cc index 8f82dc044f3aedd9453277162ef7aeab58e8e128..b6ea71fac50fe05607063b82d4fc7437af9b8bfd 100644 --- a/src/Settings/PlanViewSettings.cc +++ b/src/Settings/PlanViewSettings.cc @@ -20,3 +20,4 @@ DECLARE_SETTINGGROUP(PlanView, "PlanView") DECLARE_SETTINGSFACT(PlanViewSettings, displayPresetsTabFirst) DECLARE_SETTINGSFACT(PlanViewSettings, aboveTerrainWarning) DECLARE_SETTINGSFACT(PlanViewSettings, showMissionItemStatus) +DECLARE_SETTINGSFACT(PlanViewSettings, useConditionGate) diff --git a/src/Settings/PlanViewSettings.h b/src/Settings/PlanViewSettings.h index 2fbc3bdc03fa0d37be8f96f4d2f8e6ed915ddb2a..c1a6d0c04daf8c8d95d2ce4d3d8f6daeb933a8cb 100644 --- a/src/Settings/PlanViewSettings.h +++ b/src/Settings/PlanViewSettings.h @@ -23,4 +23,5 @@ public: DEFINE_SETTINGFACT(displayPresetsTabFirst) DEFINE_SETTINGFACT(aboveTerrainWarning) DEFINE_SETTINGFACT(showMissionItemStatus) + DEFINE_SETTINGFACT(useConditionGate) }; diff --git a/src/ui/preferences/GeneralSettings.qml b/src/ui/preferences/GeneralSettings.qml index 3897dc61a7196323bb6f69588240b01b5463ce31..c698d44af44b1e811df4f994d099107984a3fab8 100644 --- a/src/ui/preferences/GeneralSettings.qml +++ b/src/ui/preferences/GeneralSettings.qml @@ -621,6 +621,11 @@ Rectangle { fact: QGroundControl.settingsManager.appSettings.defaultMissionItemAltitude } } + + FactCheckBox { + text: qsTr("Use MAV_CMD_CONDITION_GATE for pattern generation") + fact: QGroundControl.settingsManager.planViewSettings.useConditionGate + } } }