Commit dbe47940 authored by Don Gagne's avatar Don Gagne

Merge pull request #1602 from DonLakeFlyer/AcroWork

Validate against Acro switch setting
parents 0ee78bdb 2735dae7
...@@ -38,7 +38,8 @@ static const SwitchListItem switchList[] = { ...@@ -38,7 +38,8 @@ static const SwitchListItem switchList[] = {
{ "RC_MAP_MODE_SW", "Mode Switch:" }, // First entry must be mode switch { "RC_MAP_MODE_SW", "Mode Switch:" }, // First entry must be mode switch
{ "RC_MAP_POSCTL_SW", "Position Control Switch:" }, { "RC_MAP_POSCTL_SW", "Position Control Switch:" },
{ "RC_MAP_LOITER_SW", "Loiter 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]); static const size_t cSwitchList = sizeof(switchList) / sizeof(switchList[0]);
......
...@@ -47,29 +47,31 @@ Item { ...@@ -47,29 +47,31 @@ Item {
Component { Component {
id: validComponent id: validComponent
Rectangle { FactPanel {
Fact { id: rc_map_throttle; name: "RC_MAP_THROTTLE" } Fact { id: rc_map_throttle; name: "RC_MAP_THROTTLE"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: rc_map_yaw; name: "RC_MAP_YAW" } Fact { id: rc_map_yaw; name: "RC_MAP_YAW"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: rc_map_pitch; name: "RC_MAP_PITCH" } Fact { id: rc_map_pitch; name: "RC_MAP_PITCH"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: rc_map_roll; name: "RC_MAP_ROLL" } Fact { id: rc_map_roll; name: "RC_MAP_ROLL"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: rc_map_flaps; name: "RC_MAP_FLAPS" } Fact { id: rc_map_flaps; name: "RC_MAP_FLAPS"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: rc_map_aux1; name: "RC_MAP_AUX1" } Fact { id: rc_map_aux1; name: "RC_MAP_AUX1"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: rc_map_aux2; name: "RC_MAP_AUX2" } Fact { id: rc_map_aux2; name: "RC_MAP_AUX2"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: rc_map_mode_sw; name: "RC_MAP_MODE_SW" } 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" } 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" } 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" } 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" } 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_assist_th; name: "RC_ASSIST_TH" }
Fact { id: rc_posctl_th; name: "RC_POSCTL_TH" } Fact { id: rc_posctl_th; name: "RC_POSCTL_TH"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: rc_auto_th; name: "RC_AUTO_TH" } Fact { id: rc_return_th; name: "RC_RETURN_TH"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: rc_loiter_th; name: "RC_LOITER_TH" } Fact { id: rc_offboard_th; name: "RC_OFFB_TH"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: rc_return_th; name: "RC_RETURN_TH" } Fact { id: rc_loiter_th; name: "RC_LOITER_TH"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: rc_offboard_th; name: "RC_OFFB_TH" } 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_th_user; name: "RC_TH_USER" } 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 throttleChannel: rc_map_throttle.value
property int yawChannel: rc_map_yaw.value property int yawChannel: rc_map_yaw.value
...@@ -98,9 +100,6 @@ Item { ...@@ -98,9 +100,6 @@ Item {
anchors.fill: parent anchors.fill: parent
color: qgcPal.window
Component { Component {
id: dragHandle id: dragHandle
...@@ -136,7 +135,7 @@ Item { ...@@ -136,7 +135,7 @@ Item {
id: unassignedModeTileComponent id: unassignedModeTileComponent
Rectangle { Rectangle {
Fact { id: fact; name: tileParam } Fact { id: fact; name: tileParam; onFactMissing: showMissingFactOverlay(name) }
property bool dragEnabled: fact.value == 0 property bool dragEnabled: fact.value == 0
id: outerRect id: outerRect
...@@ -222,7 +221,7 @@ Item { ...@@ -222,7 +221,7 @@ Item {
id: assignedModeTileComponent id: assignedModeTileComponent
Rectangle { Rectangle {
Fact { id: fact; name: tileDragEnabled ? tileParam : "" } Fact { id: fact; name: tileDragEnabled ? tileParam : ""; onFactMissing: showMissingFactOverlay(name) }
width: tileWidth width: tileWidth
height: tileHeight height: tileHeight
......
...@@ -77,6 +77,12 @@ void FlightModesComponentController::_validateConfiguration(void) ...@@ -77,6 +77,12 @@ void FlightModesComponentController::_validateConfiguration(void)
_channelCount = _chanMax; _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 // Make sure switches are valid and within channel range
QStringList switchParams, switchNames; QStringList switchParams, switchNames;
......
...@@ -409,7 +409,7 @@ void PX4RCCalibrationTest::_fullCalibration_test(void) ...@@ -409,7 +409,7 @@ void PX4RCCalibrationTest::_fullCalibration_test(void)
// First make sure this function isn't being use for a switch // First make sure this function isn't being use for a switch
QStringList switchList; 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) { foreach (QString switchParam, switchList) {
Q_ASSERT(_autopilot->getParameterFact(switchParam)->value().toInt() != channel + 1); Q_ASSERT(_autopilot->getParameterFact(switchParam)->value().toInt() != channel + 1);
......
...@@ -76,6 +76,7 @@ const struct PX4RCCalibration::FunctionInfo PX4RCCalibration::_rgFunctionInfo[PX ...@@ -76,6 +76,7 @@ const struct PX4RCCalibration::FunctionInfo PX4RCCalibration::_rgFunctionInfo[PX
{ "RC_MAP_POSCTL_SW" }, { "RC_MAP_POSCTL_SW" },
{ "RC_MAP_LOITER_SW" }, { "RC_MAP_LOITER_SW" },
{ "RC_MAP_RETURN_SW" }, { "RC_MAP_RETURN_SW" },
{ "RC_MAP_ACRO_SW" },
{ "RC_MAP_FLAPS" }, { "RC_MAP_FLAPS" },
{ "RC_MAP_AUX1" }, { "RC_MAP_AUX1" },
{ "RC_MAP_AUX2" }, { "RC_MAP_AUX2" },
......
...@@ -78,7 +78,7 @@ private slots: ...@@ -78,7 +78,7 @@ private slots:
private: private:
/// @brief These identify the various controls functions. They are also used as indices into the _rgFunctioInfo /// @brief These identify the various controls functions. They are also used as indices into the _rgFunctioInfo
/// aray. /// array.
enum rcCalFunctions { enum rcCalFunctions {
rcCalFunctionRoll, rcCalFunctionRoll,
rcCalFunctionPitch, rcCalFunctionPitch,
...@@ -88,6 +88,7 @@ private: ...@@ -88,6 +88,7 @@ private:
rcCalFunctionPosCtlSwitch, rcCalFunctionPosCtlSwitch,
rcCalFunctionLoiterSwitch, rcCalFunctionLoiterSwitch,
rcCalFunctionReturnSwitch, rcCalFunctionReturnSwitch,
rcCalFunctionAcroSwitch,
rcCalFunctionFlaps, rcCalFunctionFlaps,
rcCalFunctionAux1, rcCalFunctionAux1,
rcCalFunctionAux2, rcCalFunctionAux2,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment