Commit df489c3e authored by Valentin Platzgummer's avatar Valentin Platzgummer

Phase duration and time after smart RTL now displayed correctly

parent 86978aa1
......@@ -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
......
......@@ -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
......
......@@ -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();
......
......@@ -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;
......
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