diff --git a/src/AutoPilotPlugins/PX4/FlightModesComponent.cc b/src/AutoPilotPlugins/PX4/FlightModesComponent.cc index c03f66c1b7b9979f1be166d9a553c20304b086a1..f0b03bd2eff55581879f0a2728a00d21ac3b48f3 100644 --- a/src/AutoPilotPlugins/PX4/FlightModesComponent.cc +++ b/src/AutoPilotPlugins/PX4/FlightModesComponent.cc @@ -38,7 +38,8 @@ static const SwitchListItem switchList[] = { { "RC_MAP_MODE_SW", "Mode Switch:" }, // First entry must be mode switch { "RC_MAP_POSCTL_SW", "Position Control Switch:" }, { "RC_MAP_LOITER_SW", "Loiter Switch:" }, - { "RC_MAP_RETURN_SW", "Return Switch:" } + { "RC_MAP_RETURN_SW", "Return Switch:" }, + { "RC_MAP_ACRO_SW", "Acro Switch:" }, }; static const size_t cSwitchList = sizeof(switchList) / sizeof(switchList[0]); diff --git a/src/AutoPilotPlugins/PX4/FlightModesComponent.qml b/src/AutoPilotPlugins/PX4/FlightModesComponent.qml index 2e55283abfaafe006b565760cd57463027807522..5c90016d68886c61ed9fa23be9423a1252951efa 100644 --- a/src/AutoPilotPlugins/PX4/FlightModesComponent.qml +++ b/src/AutoPilotPlugins/PX4/FlightModesComponent.qml @@ -47,29 +47,31 @@ Item { Component { id: validComponent - Rectangle { - Fact { id: rc_map_throttle; name: "RC_MAP_THROTTLE" } - Fact { id: rc_map_yaw; name: "RC_MAP_YAW" } - Fact { id: rc_map_pitch; name: "RC_MAP_PITCH" } - Fact { id: rc_map_roll; name: "RC_MAP_ROLL" } - Fact { id: rc_map_flaps; name: "RC_MAP_FLAPS" } - Fact { id: rc_map_aux1; name: "RC_MAP_AUX1" } - Fact { id: rc_map_aux2; name: "RC_MAP_AUX2" } - - Fact { id: rc_map_mode_sw; name: "RC_MAP_MODE_SW" } - Fact { id: rc_map_posctl_sw; name: "RC_MAP_POSCTL_SW" } - Fact { id: rc_map_return_sw; name: "RC_MAP_RETURN_SW" } - Fact { id: rc_map_offboard_sw; name: "RC_MAP_OFFB_SW" } - Fact { id: rc_map_loiter_sw; name: "RC_MAP_LOITER_SW" } - - Fact { id: rc_assist_th; name: "RC_ASSIST_TH" } - Fact { id: rc_posctl_th; name: "RC_POSCTL_TH" } - Fact { id: rc_auto_th; name: "RC_AUTO_TH" } - Fact { id: rc_loiter_th; name: "RC_LOITER_TH" } - Fact { id: rc_return_th; name: "RC_RETURN_TH" } - Fact { id: rc_offboard_th; name: "RC_OFFB_TH" } - - Fact { id: rc_th_user; name: "RC_TH_USER" } + FactPanel { + Fact { id: rc_map_throttle; name: "RC_MAP_THROTTLE"; onFactMissing: showMissingFactOverlay(name) } + Fact { id: rc_map_yaw; name: "RC_MAP_YAW"; onFactMissing: showMissingFactOverlay(name) } + Fact { id: rc_map_pitch; name: "RC_MAP_PITCH"; onFactMissing: showMissingFactOverlay(name) } + Fact { id: rc_map_roll; name: "RC_MAP_ROLL"; onFactMissing: showMissingFactOverlay(name) } + Fact { id: rc_map_flaps; name: "RC_MAP_FLAPS"; onFactMissing: showMissingFactOverlay(name) } + Fact { id: rc_map_aux1; name: "RC_MAP_AUX1"; onFactMissing: showMissingFactOverlay(name) } + Fact { id: rc_map_aux2; name: "RC_MAP_AUX2"; onFactMissing: showMissingFactOverlay(name) } + + Fact { id: rc_map_mode_sw; name: "RC_MAP_MODE_SW"; onFactMissing: showMissingFactOverlay(name) } + Fact { id: rc_map_posctl_sw; name: "RC_MAP_POSCTL_SW"; onFactMissing: showMissingFactOverlay(name) } + Fact { id: rc_map_return_sw; name: "RC_MAP_RETURN_SW"; onFactMissing: showMissingFactOverlay(name) } + Fact { id: rc_map_offboard_sw; name: "RC_MAP_OFFB_SW"; onFactMissing: showMissingFactOverlay(name) } + Fact { id: rc_map_loiter_sw; name: "RC_MAP_LOITER_SW"; onFactMissing: showMissingFactOverlay(name) } + Fact { id: rc_map_acro_sw; name: "RC_MAP_ACRO_SW"; onFactMissing: showMissingFactOverlay(name) } + + Fact { id: rc_posctl_th; name: "RC_POSCTL_TH"; onFactMissing: showMissingFactOverlay(name) } + Fact { id: rc_return_th; name: "RC_RETURN_TH"; onFactMissing: showMissingFactOverlay(name) } + Fact { id: rc_offboard_th; name: "RC_OFFB_TH"; onFactMissing: showMissingFactOverlay(name) } + Fact { id: rc_loiter_th; name: "RC_LOITER_TH"; onFactMissing: showMissingFactOverlay(name) } + Fact { id: rc_acro_th; name: "RC_ACRO_TH"; onFactMissing: showMissingFactOverlay(name) } + Fact { id: rc_assist_th; name: "RC_ASSIST_TH"; onFactMissing: showMissingFactOverlay(name) } + Fact { id: rc_auto_th; name: "RC_AUTO_TH"; onFactMissing: showMissingFactOverlay(name) } + + Fact { id: rc_th_user; name: "RC_TH_USER"; onFactMissing: showMissingFactOverlay(name) } property int throttleChannel: rc_map_throttle.value property int yawChannel: rc_map_yaw.value @@ -98,9 +100,6 @@ Item { anchors.fill: parent - - color: qgcPal.window - Component { id: dragHandle @@ -136,7 +135,7 @@ Item { id: unassignedModeTileComponent Rectangle { - Fact { id: fact; name: tileParam } + Fact { id: fact; name: tileParam; onFactMissing: showMissingFactOverlay(name) } property bool dragEnabled: fact.value == 0 id: outerRect @@ -222,7 +221,7 @@ Item { id: assignedModeTileComponent Rectangle { - Fact { id: fact; name: tileDragEnabled ? tileParam : "" } + Fact { id: fact; name: tileDragEnabled ? tileParam : ""; onFactMissing: showMissingFactOverlay(name) } width: tileWidth height: tileHeight diff --git a/src/AutoPilotPlugins/PX4/FlightModesComponentController.cc b/src/AutoPilotPlugins/PX4/FlightModesComponentController.cc index 90f78113aa9a5da65199ab0afb757534f0afd2d4..e603cabe99501fcf7af7ba5ad0b3de1cf65946d8 100644 --- a/src/AutoPilotPlugins/PX4/FlightModesComponentController.cc +++ b/src/AutoPilotPlugins/PX4/FlightModesComponentController.cc @@ -77,6 +77,12 @@ void FlightModesComponentController::_validateConfiguration(void) _channelCount = _chanMax; } + // Acro is not full supported yet. If Acro is mapped you uhave to set up the hard way. + if (_autoPilotPlugin->getParameterFact("RC_MAP_ACRO_SW")->value().toInt() != 0) { + _validConfiguration = false; + _configurationErrors += "Flight Mode setup does not yet support Acro switch"; + } + // Make sure switches are valid and within channel range QStringList switchParams, switchNames; diff --git a/src/qgcunittest/PX4RCCalibrationTest.cc b/src/qgcunittest/PX4RCCalibrationTest.cc index 350b1d9047ff081e991395a0f15662a2771c4d24..f22dd4221bdaccc3ad4abd8814ea30aaa634e40e 100644 --- a/src/qgcunittest/PX4RCCalibrationTest.cc +++ b/src/qgcunittest/PX4RCCalibrationTest.cc @@ -409,7 +409,7 @@ void PX4RCCalibrationTest::_fullCalibration_test(void) // First make sure this function isn't being use for a switch QStringList switchList; - switchList << "RC_MAP_MODE_SW" << "RC_MAP_LOITER_SW" << "RC_MAP_RETURN_SW" << "RC_MAP_POSCTL_SW"; + switchList << "RC_MAP_MODE_SW" << "RC_MAP_LOITER_SW" << "RC_MAP_RETURN_SW" << "RC_MAP_POSCTL_SW" << "RC_MAP_ACRO_SW"; foreach (QString switchParam, switchList) { Q_ASSERT(_autopilot->getParameterFact(switchParam)->value().toInt() != channel + 1); diff --git a/src/ui/px4_configuration/PX4RCCalibration.cc b/src/ui/px4_configuration/PX4RCCalibration.cc index 7959c76f5b15593616010f4a43a157da72a1eeaa..4f288c5d401fe21e6adb320009146defe080678a 100644 --- a/src/ui/px4_configuration/PX4RCCalibration.cc +++ b/src/ui/px4_configuration/PX4RCCalibration.cc @@ -76,6 +76,7 @@ const struct PX4RCCalibration::FunctionInfo PX4RCCalibration::_rgFunctionInfo[PX { "RC_MAP_POSCTL_SW" }, { "RC_MAP_LOITER_SW" }, { "RC_MAP_RETURN_SW" }, + { "RC_MAP_ACRO_SW" }, { "RC_MAP_FLAPS" }, { "RC_MAP_AUX1" }, { "RC_MAP_AUX2" }, diff --git a/src/ui/px4_configuration/PX4RCCalibration.h b/src/ui/px4_configuration/PX4RCCalibration.h index 25ae3e4865d97b66200a734bd473a3ab3a98fdd7..718bb38e7b69ae5d73cb0e2bd3b4f2a70dd01f66 100644 --- a/src/ui/px4_configuration/PX4RCCalibration.h +++ b/src/ui/px4_configuration/PX4RCCalibration.h @@ -78,7 +78,7 @@ private slots: private: /// @brief These identify the various controls functions. They are also used as indices into the _rgFunctioInfo - /// aray. + /// array. enum rcCalFunctions { rcCalFunctionRoll, rcCalFunctionPitch, @@ -88,6 +88,7 @@ private: rcCalFunctionPosCtlSwitch, rcCalFunctionLoiterSwitch, rcCalFunctionReturnSwitch, + rcCalFunctionAcroSwitch, rcCalFunctionFlaps, rcCalFunctionAux1, rcCalFunctionAux2,