From 80f8aac39eb8a94d05c61da7c9aae6fb78dce934 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 25 May 2013 17:05:27 +0200 Subject: [PATCH] Only loading port names which still are available, fixed more compile errors --- src/ui/SerialConfigurationWindow.cc | 10 +++++++++- src/ui/map3D/QGCGoogleEarthView.cc | 4 ++-- src/ui/map3D/WaypointGroupNode.cc | 13 ++++++++++++- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/ui/SerialConfigurationWindow.cc b/src/ui/SerialConfigurationWindow.cc index a063c1c..499188e 100644 --- a/src/ui/SerialConfigurationWindow.cc +++ b/src/ui/SerialConfigurationWindow.cc @@ -218,6 +218,9 @@ void SerialConfigurationWindow::setupPortList() // Get the ports available on this system QVector* ports = link->getCurrentPorts(); + QString storedName = this->link->getPortName(); + bool storedFound = false; + // Add the ports in reverse order, because we prepend them to the list for (int i = ports->size() - 1; i >= 0; --i) { @@ -227,9 +230,14 @@ void SerialConfigurationWindow::setupPortList() ui.portName->insertItem(0, ports->at(i)); if (!userConfigured) ui.portName->setEditText(ports->at(i)); } + + // Check if the stored link name is still present + if (ports->at(i).contains(storedName) || storedName.contains(ports->at(i))) + storedFound = true; } - ui.portName->setEditText(this->link->getPortName()); + if (storedFound) + ui.portName->setEditText(storedName); } void SerialConfigurationWindow::enableFlowControl(bool flow) diff --git a/src/ui/map3D/QGCGoogleEarthView.cc b/src/ui/map3D/QGCGoogleEarthView.cc index d620341..022da23 100644 --- a/src/ui/map3D/QGCGoogleEarthView.cc +++ b/src/ui/map3D/QGCGoogleEarthView.cc @@ -265,7 +265,7 @@ void QGCGoogleEarthView::updateWaypointList(int uas) if (uasInstance) { // Get all waypoints, including non-global waypoints - QVector wpList = uasInstance->getWaypointManager()->getGlobalFrameAndNavTypeWaypointList(); + QList wpList = uasInstance->getWaypointManager()->getGlobalFrameAndNavTypeWaypointList(); // Trim internal list to number of global waypoints in the waypoint manager list javaScript(QString("updateWaypointListLength(%1,%2);").arg(uas).arg(wpList.count())); @@ -712,7 +712,7 @@ void QGCGoogleEarthView::updateState() // Update waypoint or symbol if (mav) { - QVector wps = mav->getWaypointManager()->getGlobalFrameAndNavTypeWaypointList(); + QList wps = mav->getWaypointManager()->getGlobalFrameAndNavTypeWaypointList(); bool ok; int index = idText.toInt(&ok); diff --git a/src/ui/map3D/WaypointGroupNode.cc b/src/ui/map3D/WaypointGroupNode.cc index 15fe3f9..af9f275 100644 --- a/src/ui/map3D/WaypointGroupNode.cc +++ b/src/ui/map3D/WaypointGroupNode.cc @@ -36,6 +36,7 @@ This file is part of the QGROUNDCONTROL project #include #include "Imagery.h" +#include "UASManager.h" WaypointGroupNode::WaypointGroupNode(const QColor& color) : mColor(color) @@ -70,6 +71,16 @@ WaypointGroupNode::update(UASInterface* uas, MAV_FRAME frame) Imagery::LLtoUTM(latitude, longitude, robotX, robotY, utmZone); robotZ = -altitude; } + else if (frame == MAV_FRAME_GLOBAL_RELATIVE_ALT) + { + double latitude = uas->getLatitude(); + double longitude = uas->getLongitude(); + double altitude = uas->getAltitude() + UASManager::instance()->getHomeAltitude(); + + QString utmZone; + Imagery::LLtoUTM(latitude, longitude, robotX, robotY, utmZone); + robotZ = -altitude; + } else if (frame == MAV_FRAME_LOCAL_NED) { robotX = uas->getLocalX(); @@ -82,7 +93,7 @@ WaypointGroupNode::update(UASInterface* uas, MAV_FRAME frame) removeChild(0, getNumChildren()); } - const QVector& list = uas->getWaypointManager()->getWaypointEditableList(); + const QList& list = uas->getWaypointManager()->getWaypointEditableList(); for (int i = 0; i < list.size(); i++) {