diff --git a/src/FlightDisplay/FlightDisplayView.qml b/src/FlightDisplay/FlightDisplayView.qml index b410685cf07b5ce64cabd85a0fafd1b224657cfa..5956998681a276c5acb3df1d7adb5d3f723010e0 100644 --- a/src/FlightDisplay/FlightDisplayView.qml +++ b/src/FlightDisplay/FlightDisplayView.qml @@ -102,8 +102,9 @@ QGCView { } Connections { - target: _missionController - onResumeMissionReady: guidedActionsController.confirmAction(guidedActionsController.actionResumeMissionReady) + target: _missionController + onResumeMissionReady: guidedActionsController.confirmAction(guidedActionsController.actionResumeMissionReady) + onResumeMissionUploadFail: guidedActionsController.confirmAction(guidedActionsController.actionResumeMissionUploadFail) } MessageDialog { diff --git a/src/FlightDisplay/GuidedActionsController.qml b/src/FlightDisplay/GuidedActionsController.qml index 5aafc3633e56f7c1f11ceac62f699264ed5f56cc..4970fda0478dcc5e562c262dfc43697339c2b1bc 100644 --- a/src/FlightDisplay/GuidedActionsController.qml +++ b/src/FlightDisplay/GuidedActionsController.qml @@ -32,55 +32,58 @@ Item { property var actionList property var altitudeSlider - readonly property string emergencyStopTitle: qsTr("Emergency Stop") - readonly property string armTitle: qsTr("Arm") - readonly property string disarmTitle: qsTr("Disarm") - readonly property string rtlTitle: qsTr("RTL") - readonly property string takeoffTitle: qsTr("Takeoff") - readonly property string landTitle: qsTr("Land") - readonly property string startMissionTitle: qsTr("Start Mission") - readonly property string continueMissionTitle: qsTr("Continue Mission") - readonly property string resumeMissionTitle: qsTr("Resume Mission") - readonly property string pauseTitle: qsTr("Pause") - readonly property string changeAltTitle: qsTr("Change Altitude") - readonly property string orbitTitle: qsTr("Orbit") - readonly property string landAbortTitle: qsTr("Land Abort") - readonly property string setWaypointTitle: qsTr("Set Waypoint") - readonly property string gotoTitle: qsTr("Goto Location") + readonly property string emergencyStopTitle: qsTr("Emergency Stop") + readonly property string armTitle: qsTr("Arm") + readonly property string disarmTitle: qsTr("Disarm") + readonly property string rtlTitle: qsTr("RTL") + readonly property string takeoffTitle: qsTr("Takeoff") + readonly property string landTitle: qsTr("Land") + readonly property string startMissionTitle: qsTr("Start Mission") + readonly property string continueMissionTitle: qsTr("Continue Mission") + readonly property string resumeMissionTitle: qsTr("Resume Mission") + readonly property string resumeMissionUploadFailTitle: qsTr("Resume FAILED") + readonly property string pauseTitle: qsTr("Pause") + readonly property string changeAltTitle: qsTr("Change Altitude") + readonly property string orbitTitle: qsTr("Orbit") + readonly property string landAbortTitle: qsTr("Land Abort") + readonly property string setWaypointTitle: qsTr("Set Waypoint") + readonly property string gotoTitle: qsTr("Goto Location") - readonly property string armMessage: qsTr("Arm the vehicle.") - readonly property string disarmMessage: qsTr("Disarm the vehicle") - readonly property string emergencyStopMessage: qsTr("WARNING: This will stop all motors. If vehicle is currently in air it will crash.") - readonly property string takeoffMessage: qsTr("Takeoff from ground and hold position.") - readonly property string startMissionMessage: qsTr("Takeoff from ground and start the current mission.") - readonly property string continueMissionMessage: qsTr("Continue the mission from the current waypoint.") - property string resumeMissionMessage: qsTr("Resume the current mission. This will re-generate the mission from waypoint %1, takeoff and continue the mission.").arg(_resumeMissionIndex) - readonly property string resumeMissionReadyMessage: qsTr("Review the modified mission. Confirm if you want to takeoff and begin mission.") - readonly property string landMessage: qsTr("Land the vehicle at the current position.") - readonly property string rtlMessage: qsTr("Return to the home position of the vehicle.") - readonly property string changeAltMessage: qsTr("Change the altitude of the vehicle up or down.") - readonly property string gotoMessage: qsTr("Move the vehicle to the location clicked on the map.") - property string setWaypointMessage: qsTr("Adjust current waypoint to %1.").arg(_actionData) - readonly property string orbitMessage: qsTr("Orbit the vehicle around the current location.") - readonly property string landAbortMessage: qsTr("Abort the landing sequence.") - readonly property string pauseMessage: qsTr("Pause the vehicle at it's current position.") + readonly property string armMessage: qsTr("Arm the vehicle.") + readonly property string disarmMessage: qsTr("Disarm the vehicle") + readonly property string emergencyStopMessage: qsTr("WARNING: This will stop all motors. If vehicle is currently in air it will crash.") + readonly property string takeoffMessage: qsTr("Takeoff from ground and hold position.") + readonly property string startMissionMessage: qsTr("Takeoff from ground and start the current mission.") + readonly property string continueMissionMessage: qsTr("Continue the mission from the current waypoint.") + property string resumeMissionMessage: qsTr("Resume the current mission. This will re-generate the mission from waypoint %1, takeoff and continue the mission.").arg(_resumeMissionIndex) + property string resumeMissionUploadFailMessage: qsTr("Upload of resume mission failed. Confirm to retry upload") + readonly property string resumeMissionReadyMessage: qsTr("Review the modified mission. Confirm if you want to takeoff and begin mission.") + readonly property string landMessage: qsTr("Land the vehicle at the current position.") + readonly property string rtlMessage: qsTr("Return to the home position of the vehicle.") + readonly property string changeAltMessage: qsTr("Change the altitude of the vehicle up or down.") + readonly property string gotoMessage: qsTr("Move the vehicle to the location clicked on the map.") + property string setWaypointMessage: qsTr("Adjust current waypoint to %1.").arg(_actionData) + readonly property string orbitMessage: qsTr("Orbit the vehicle around the current location.") + readonly property string landAbortMessage: qsTr("Abort the landing sequence.") + readonly property string pauseMessage: qsTr("Pause the vehicle at it's current position.") - readonly property int actionRTL: 1 - readonly property int actionLand: 2 - readonly property int actionTakeoff: 3 - readonly property int actionArm: 4 - readonly property int actionDisarm: 5 - readonly property int actionEmergencyStop: 6 - readonly property int actionChangeAlt: 7 - readonly property int actionGoto: 8 - readonly property int actionSetWaypoint: 9 - readonly property int actionOrbit: 10 - readonly property int actionLandAbort: 11 - readonly property int actionStartMission: 12 - readonly property int actionContinueMission: 13 - readonly property int actionResumeMission: 14 - readonly property int actionResumeMissionReady: 15 - readonly property int actionPause: 16 + readonly property int actionRTL: 1 + readonly property int actionLand: 2 + readonly property int actionTakeoff: 3 + readonly property int actionArm: 4 + readonly property int actionDisarm: 5 + readonly property int actionEmergencyStop: 6 + readonly property int actionChangeAlt: 7 + readonly property int actionGoto: 8 + readonly property int actionSetWaypoint: 9 + readonly property int actionOrbit: 10 + readonly property int actionLandAbort: 11 + readonly property int actionStartMission: 12 + readonly property int actionContinueMission: 13 + readonly property int actionResumeMission: 14 + readonly property int actionResumeMissionReady: 15 + readonly property int actionResumeMissionUploadFail: 16 + readonly property int actionPause: 17 property bool showEmergenyStop: !_hideEmergenyStop && _activeVehicle && _vehicleArmed && _vehicleFlying property bool showArm: _activeVehicle && !_vehicleArmed @@ -205,6 +208,11 @@ Item { confirmDialog.message = resumeMissionMessage confirmDialog.hideTrigger = Qt.binding(function() { return !showResumeMission }) break; + case actionResumeMissionUploadFail: + confirmDialog.title = resumeMissionUploadFailTitle + confirmDialog.message = resumeMissionUploadFailMessage + confirmDialog.hideTrigger = Qt.binding(function() { return !showResumeMission }) + break; case actionResumeMissionReady: confirmDialog.title = resumeMissionTitle confirmDialog.message = resumeMissionReadyMessage @@ -271,6 +279,7 @@ Item { _activeVehicle.guidedModeTakeoff() break case actionResumeMission: + case actionResumeMissionUploadFail: missionController.resumeMission(missionController.resumeMissionIndex) break case actionResumeMissionReady: diff --git a/src/MissionManager/MissionController.cc b/src/MissionManager/MissionController.cc index d5d9c58ae7cea289c4d265197bfadeac9c33ea18..42c49151912c93b48165cdbee237eac74608509f 100644 --- a/src/MissionManager/MissionController.cc +++ b/src/MissionManager/MissionController.cc @@ -1476,6 +1476,7 @@ void MissionController::managerVehicleChanged(Vehicle* managerVehicle) connect(_missionManager, &MissionManager::currentIndexChanged, this, &MissionController::_currentMissionIndexChanged); connect(_missionManager, &MissionManager::lastCurrentIndexChanged, this, &MissionController::resumeMissionIndexChanged); connect(_missionManager, &MissionManager::resumeMissionReady, this, &MissionController::resumeMissionReady); + connect(_missionManager, &MissionManager::resumeMissionUploadFail, this, &MissionController::resumeMissionUploadFail); connect(_managerVehicle, &Vehicle::homePositionChanged, this, &MissionController::_managerVehicleHomePositionChanged); connect(_managerVehicle, &Vehicle::defaultCruiseSpeedChanged, this, &MissionController::_recalcMissionFlightStatus); connect(_managerVehicle, &Vehicle::defaultHoverSpeedChanged, this, &MissionController::_recalcMissionFlightStatus); diff --git a/src/MissionManager/MissionController.h b/src/MissionManager/MissionController.h index b5d2e1020d7d12499fd7f7777f95ed9848a0b4a6..daba4ffb6b0218ae4dc4e154a8d644c6c67f3ac0 100644 --- a/src/MissionManager/MissionController.h +++ b/src/MissionManager/MissionController.h @@ -160,6 +160,7 @@ signals: void complexMissionItemNamesChanged(void); void resumeMissionIndexChanged(void); void resumeMissionReady(void); + void resumeMissionUploadFail(void); void batteryChangePointChanged(int batteryChangePoint); void batteriesRequiredChanged(int batteriesRequired); void plannedHomePositionChanged(QGeoCoordinate plannedHomePosition); diff --git a/src/MissionManager/MissionManager.cc b/src/MissionManager/MissionManager.cc index 950c61dec685258bb56019571671c2c3464bf97c..5b3372f8aaf0de6235ebb68bed3c207edd7e1765 100644 --- a/src/MissionManager/MissionManager.cc +++ b/src/MissionManager/MissionManager.cc @@ -64,11 +64,6 @@ void MissionManager::_writeMissionItemsWorker(void) _retryCount = 0; emit inProgressChanged(true); _writeMissionCount(); - - _currentMissionIndex = -1; - _lastCurrentIndex = -1; - emit currentIndexChanged(-1); - emit lastCurrentIndexChanged(-1); } @@ -875,7 +870,11 @@ void MissionManager::_finishTransaction(bool success) break; case TransactionWrite: if (success) { - // Write succeeded, update internal list to be current + // Write succeeded, update internal list to be current + _currentMissionIndex = -1; + _lastCurrentIndex = -1; + emit currentIndexChanged(-1); + emit lastCurrentIndexChanged(-1); _clearAndDeleteMissionItems(); for (int i=0; i<_writeMissionItems.count(); i++) { _missionItems.append(_writeMissionItems[i]); @@ -896,7 +895,11 @@ void MissionManager::_finishTransaction(bool success) if (_resumeMission) { _resumeMission = false; - emit resumeMissionReady(); + if (success) { + emit resumeMissionReady(); + } else { + emit resumeMissionUploadFail(); + } } } diff --git a/src/MissionManager/MissionManager.h b/src/MissionManager/MissionManager.h index 5b258d1b12a8ec5e72a6d6bfb8fc4389b530c5a0..6c6a792a7c7433bbe2daf525d1c447d28734a4ed 100644 --- a/src/MissionManager/MissionManager.h +++ b/src/MissionManager/MissionManager.h @@ -88,6 +88,7 @@ signals: void currentIndexChanged(int currentIndex); void lastCurrentIndexChanged(int lastCurrentIndex); void resumeMissionReady(void); + void resumeMissionUploadFail(void); void progressPct(double progressPercentPct); void removeAllComplete (bool error); void sendComplete (bool error);