diff --git a/src/FlightDisplay/FlightDisplayView.qml b/src/FlightDisplay/FlightDisplayView.qml index 98e48f2cef7093e9b80f71a2da5eb1dbbd6d622c..2c41ff26bdebdd635b14b1c0bea07b1d5edaf0c5 100644 --- a/src/FlightDisplay/FlightDisplayView.qml +++ b/src/FlightDisplay/FlightDisplayView.qml @@ -608,7 +608,8 @@ QGCView { anchors.leftMargin: ScreenTools.defaultFontPixelWidth anchors.bottomMargin: ScreenTools.defaultFontPixelWidth maxWidth: singleMultiSelector.x - ScreenTools.defaultFontPixelHeight*4 - maxHeight: parent.height - toolStrip.height - toolStrip.y - ScreenTools.defaultFontPixelHeight*4 + maxHeight: _flightMap.height - toolStrip.height - toolStrip.y + - ScreenTools.defaultFontPixelHeight*4 wimaController: _wimaController @@ -679,7 +680,7 @@ QGCView { maxHeight: (_flightVideo.visible ? _flightVideo.y : parent.height) - toolStrip.y buttonVisible: [ _useChecklist, _guidedController.showTakeoff || !_guidedController.showLand, _guidedController.showLand && !_guidedController.showTakeoff, true, true, true ] buttonEnabled: [ _useChecklist && _activeVehicle, _guidedController.showTakeoff, _guidedController.showLand, _guidedController.showRTL, _guidedController.showPause, _anyActionAvailable ] - horizontal: false + horizontal: true enableSwitchButton: true property bool _anyActionAvailable: _guidedController.showStartMission || _guidedController.showResumeMission || _guidedController.showChangeAlt || _guidedController.showLandAbort diff --git a/src/FlightDisplay/FlightDisplayWimaMenu.qml b/src/FlightDisplay/FlightDisplayWimaMenu.qml index 471279ec8332ce857d4a7557fa2df2e72313cc3c..02f55e884044acc2bb1ea5d4413e587676d2e991 100644 --- a/src/FlightDisplay/FlightDisplayWimaMenu.qml +++ b/src/FlightDisplay/FlightDisplayWimaMenu.qml @@ -21,6 +21,7 @@ Item { id: _root height: mainFrame.height width: mainFrame.width + clip: true property int maxHeight: 500 property int maxWidth: 300 @@ -36,6 +37,10 @@ Item { signal initSmartRTL(); + DeadMouseArea { + anchors.fill: parent + } + Item { id: _private property bool missionReadyForStart: true diff --git a/src/Wima/WimaController.cc b/src/Wima/WimaController.cc index b89c684d1cd7a56d904df9d7b0f48a3c3917928f..53db294864abef9a46450a6970b5935c23c872e2 100644 --- a/src/Wima/WimaController.cc +++ b/src/Wima/WimaController.cc @@ -42,6 +42,8 @@ WimaController::WimaController(QObject *parent) , _returnPathLength (-1) , _phaseDistance (-1) , _phaseDuration (-1) + , _phaseDistanceBuffer (-1) + , _phaseDurationBuffer (-1) , _vehicleHasLowBattery (false) , _lowBatteryHandlingTriggered(false) , _executingSmartRTL (false) @@ -807,10 +809,12 @@ bool WimaController::calcNextPhase() _currentMissionItems.append(visualItemCopy); } - _setPhaseDistance(_measurementPathLength + _arrivalPathLength + _returnPathLength); - _setPhaseDuration(_measurementPathLength/_flightSpeed.rawValue().toDouble() - + (_arrivalPathLength + _returnPathLength) - / _arrivalReturnSpeed.rawValue().toDouble()); + double dist = 0; + double time = 0; + if (!_missionController->distanceTimeToMissionEnd(dist, time, 1, false)) + qWarning("WimaController::calcNextPhase: distanceTimeToMissionEnd returned false!"); + _setPhaseDistance(dist); + _setPhaseDuration(time); _missionController->removeAll(); // remove items from _missionController, will be added on upload updateAltitude(); @@ -978,6 +982,8 @@ void WimaController::smartRTLCleanUp(bool flying) if (_executingSmartRTL) { _executingSmartRTL = false; _loadCurrentMissionItemsFromBuffer(); + _setPhaseDistance(_phaseDistanceBuffer); + _setPhaseDuration(_phaseDurationBuffer); _showAllMissionItems.setRawValue(true); _missionController->removeAllFromVehicle(); _missionController->removeAll(); @@ -1062,6 +1068,9 @@ bool WimaController::_calcReturnPath(QString &errorSring) // qWarning() << "returnPath.size()" << returnPath.size(); _saveCurrentMissionItemsToBuffer(); + _phaseDistanceBuffer = _phaseDistance; + _phaseDurationBuffer = _phaseDuration; + // create Mission Items removeFromVehicle(); @@ -1127,10 +1136,8 @@ bool WimaController::_calcReturnPath(QString &errorSring) } //qWarning() << "_currentMissionItems.count()" << _currentMissionItems.count(); - _setPhaseDistance(_phaseDistance + _arrivalPathLength + _returnPathLength); - _setPhaseDuration(_phaseDistance/_flightSpeed.rawValue().toDouble() - + (_arrivalPathLength + _returnPathLength) - / _arrivalReturnSpeed.rawValue().toDouble()); + _setPhaseDistance(-1); + _setPhaseDuration(-1); _missionController->removeAll(); // remove items from _missionController, will be added on upload updateAltitude(); diff --git a/src/Wima/WimaController.h b/src/Wima/WimaController.h index 2c2cb287143ef8fbf2c0846d1c8a079c2bdf8500..4a4a085fb4bf771f001d74c9913d104392c2fe60 100644 --- a/src/Wima/WimaController.h +++ b/src/Wima/WimaController.h @@ -238,6 +238,8 @@ private: double _returnPathLength; // the length of the arrival and return path in meters double _phaseDistance; // the lenth in meters of the current phase double _phaseDuration; // the phase duration in seconds + double _phaseDistanceBuffer; // buffer for storing _phaseDistance when doing smart RTL + double _phaseDurationBuffer; // buffer for storing _phaseDuration when doing smart RTL QTimer _checkBatteryTimer; bool _vehicleHasLowBattery;