Browse Source

Press and Hold on Arm will change it to Force Arm

QGC4.4
DonLakeFlyer 5 years ago
parent
commit
50acd9a992
  1. 1
      ChangeLog.md
  2. 17
      src/FlightDisplay/GuidedActionsController.qml
  3. 9
      src/Vehicle/Vehicle.cc
  4. 1
      src/Vehicle/Vehicle.h
  5. 1
      src/ui/MainRootWindow.qml
  6. 14
      src/ui/toolbar/MainStatusIndicator.qml

1
ChangeLog.md

@ -4,6 +4,7 @@ Note: This file only contains high level features or important fixes. @@ -4,6 +4,7 @@ Note: This file only contains high level features or important fixes.
## 4.1 - Daily build
* Fly: Press and hold on arm button will change it to Force Arm. Click again to force arm.
* VTOL: General setting for transition distance which affects Plan takeoff, landing pattern creation
* VTOL: Much better VTOL support throughout QGC
* Maps: Support zoom up to level 23 even if map provider doesn't provide tiles that high

17
src/FlightDisplay/GuidedActionsController.qml

@ -35,6 +35,7 @@ Item { @@ -35,6 +35,7 @@ Item {
readonly property string emergencyStopTitle: qsTr("EMERGENCY STOP")
readonly property string armTitle: qsTr("Arm")
readonly property string forceArmTitle: qsTr("Force Arm")
readonly property string disarmTitle: qsTr("Disarm")
readonly property string rtlTitle: qsTr("Return")
readonly property string takeoffTitle: qsTr("Takeoff")
@ -55,6 +56,7 @@ Item { @@ -55,6 +56,7 @@ Item {
readonly property string actionListTitle: qsTr("Action")
readonly property string armMessage: qsTr("Arm the vehicle.")
readonly property string forceArmMessage: qsTr("WARNING: This will force arming of the vehicle bypassing any safety checks.")
readonly property string disarmMessage: qsTr("Disarm the vehicle")
readonly property string emergencyStopMessage: qsTr("WARNING: THIS WILL STOP ALL MOTORS. IF VEHICLE IS CURRENTLY IN THE AIR IT WILL CRASH.")
readonly property string takeoffMessage: qsTr("Takeoff from ground and hold position.")
@ -97,6 +99,7 @@ Item { @@ -97,6 +99,7 @@ Item {
readonly property int actionVtolTransitionToMRFlight: 21
readonly property int actionROI: 22
readonly property int actionActionList: 23
readonly property int actionForceArm: 24
property bool _useChecklist: QGroundControl.settingsManager.appSettings.useChecklist.rawValue && QGroundControl.corePlugin.options.preFlightChecklistUrl.toString().length
property bool _enforceChecklist: _useChecklist && QGroundControl.settingsManager.appSettings.enforceChecklist.rawValue
@ -104,6 +107,7 @@ Item { @@ -104,6 +107,7 @@ Item {
property bool showEmergenyStop: _guidedActionsEnabled && !_hideEmergenyStop && _vehicleArmed && _vehicleFlying
property bool showArm: _guidedActionsEnabled && !_vehicleArmed && _canArm
property bool showForceArm: _guidedActionsEnabled && !_vehicleArmed
property bool showDisarm: _guidedActionsEnabled && _vehicleArmed && !_vehicleFlying
property bool showRTL: _guidedActionsEnabled && _vehicleArmed && activeVehicle.guidedModeSupported && _vehicleFlying && !_vehicleInRTLMode
property bool showTakeoff: _guidedActionsEnabled && activeVehicle.takeoffVehicleSupported && !_vehicleFlying && _canArm
@ -274,6 +278,7 @@ Item { @@ -274,6 +278,7 @@ Item {
Connections {
target: mainWindow
onArmVehicleRequest: armVehicleRequest()
onForceArmVehicleRequest: forceArmVehicleRequest()
onDisarmVehicleRequest: disarmVehicleRequest()
onVtolTransitionToFwdFlightRequest: vtolTransitionToFwdFlightRequest()
onVtolTransitionToMRFlightRequest: vtolTransitionToMRFlightRequest()
@ -283,6 +288,10 @@ Item { @@ -283,6 +288,10 @@ Item {
confirmAction(actionArm)
}
function forceArmVehicleRequest() {
confirmAction(actionForceArm)
}
function disarmVehicleRequest() {
if (showEmergenyStop) {
confirmAction(actionEmergencyStop)
@ -325,6 +334,11 @@ Item { @@ -325,6 +334,11 @@ Item {
confirmDialog.message = armMessage
confirmDialog.hideTrigger = Qt.binding(function() { return !showArm })
break;
case actionForceArm:
confirmDialog.title = forceArmTitle
confirmDialog.message = forceArmMessage
confirmDialog.hideTrigger = Qt.binding(function() { return !showForceArm })
break;
case actionDisarm:
if (_vehicleFlying) {
return
@ -480,6 +494,9 @@ Item { @@ -480,6 +494,9 @@ Item {
case actionArm:
activeVehicle.armed = true
break
case actionForceArm:
activeVehicle.forceArm()
break
case actionDisarm:
activeVehicle.armed = false
break

9
src/Vehicle/Vehicle.cc

@ -2397,6 +2397,15 @@ void Vehicle::setArmed(bool armed) @@ -2397,6 +2397,15 @@ void Vehicle::setArmed(bool armed)
armed ? 1.0f : 0.0f);
}
void Vehicle::forceArm(void)
{
sendMavCommand(_defaultComponentId,
MAV_CMD_COMPONENT_ARM_DISARM,
true, // show error if fails
1.0f, // arm
2989); // force arm
}
bool Vehicle::flightModeSetAvailable()
{
return _firmwarePlugin->isCapable(this, FirmwarePlugin::SetFlightModeCapability);

1
src/Vehicle/Vehicle.h

@ -791,6 +791,7 @@ public: @@ -791,6 +791,7 @@ public:
Q_INVOKABLE void gimbalPitchStep (int direction);
Q_INVOKABLE void gimbalYawStep (int direction);
Q_INVOKABLE void centerGimbal ();
Q_INVOKABLE void forceArm ();
/// Sends PARAM_MAP_RC message to vehicle
Q_INVOKABLE void sendParamMapRC(const QString& paramName, double scale, double centerValue, int tuningID, double minValue, double maxValue);

1
src/ui/MainRootWindow.qml

@ -96,6 +96,7 @@ ApplicationWindow { @@ -96,6 +96,7 @@ ApplicationWindow {
//-- Actions
signal armVehicleRequest
signal forceArmVehicleRequest
signal disarmVehicleRequest
signal vtolTransitionToFwdFlightRequest
signal vtolTransitionToMRFlightRequest

14
src/ui/toolbar/MainStatusIndicator.qml

@ -190,13 +190,23 @@ RowLayout { @@ -190,13 +190,23 @@ RowLayout {
QGCButton {
Layout.alignment: Qt.AlignHCenter
text: _armed ? qsTr("Disarm") : qsTr("Arm")
text: _armed ? qsTr("Disarm") : (forceArm ? qsTr("Force Arm") : qsTr("Arm"))
property bool forceArm: false
onPressAndHold: forceArm = true
onClicked: {
if (_armed) {
mainWindow.disarmVehicleRequest()
} else {
mainWindow.armVehicleRequest()
if (forceArm) {
mainWindow.forceArmVehicleRequest()
} else {
mainWindow.armVehicleRequest()
}
}
forceArm = false
mainWindow.hideIndicatorPopup()
}
}

Loading…
Cancel
Save