Browse Source

Only loading port names which still are available, fixed more compile errors

QGC4.4
Lorenz Meier 12 years ago
parent
commit
80f8aac39e
  1. 10
      src/ui/SerialConfigurationWindow.cc
  2. 4
      src/ui/map3D/QGCGoogleEarthView.cc
  3. 13
      src/ui/map3D/WaypointGroupNode.cc

10
src/ui/SerialConfigurationWindow.cc

@ -218,6 +218,9 @@ void SerialConfigurationWindow::setupPortList()
// Get the ports available on this system // Get the ports available on this system
QVector<QString>* ports = link->getCurrentPorts(); QVector<QString>* ports = link->getCurrentPorts();
QString storedName = this->link->getPortName();
bool storedFound = false;
// Add the ports in reverse order, because we prepend them to the list // Add the ports in reverse order, because we prepend them to the list
for (int i = ports->size() - 1; i >= 0; --i) for (int i = ports->size() - 1; i >= 0; --i)
{ {
@ -227,9 +230,14 @@ void SerialConfigurationWindow::setupPortList()
ui.portName->insertItem(0, ports->at(i)); ui.portName->insertItem(0, ports->at(i));
if (!userConfigured) ui.portName->setEditText(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) void SerialConfigurationWindow::enableFlowControl(bool flow)

4
src/ui/map3D/QGCGoogleEarthView.cc

@ -265,7 +265,7 @@ void QGCGoogleEarthView::updateWaypointList(int uas)
if (uasInstance) if (uasInstance)
{ {
// Get all waypoints, including non-global waypoints // Get all waypoints, including non-global waypoints
QVector<Waypoint*> wpList = uasInstance->getWaypointManager()->getGlobalFrameAndNavTypeWaypointList(); QList<Waypoint*> wpList = uasInstance->getWaypointManager()->getGlobalFrameAndNavTypeWaypointList();
// Trim internal list to number of global waypoints in the waypoint manager list // Trim internal list to number of global waypoints in the waypoint manager list
javaScript(QString("updateWaypointListLength(%1,%2);").arg(uas).arg(wpList.count())); javaScript(QString("updateWaypointListLength(%1,%2);").arg(uas).arg(wpList.count()));
@ -712,7 +712,7 @@ void QGCGoogleEarthView::updateState()
// Update waypoint or symbol // Update waypoint or symbol
if (mav) if (mav)
{ {
QVector<Waypoint*> wps = mav->getWaypointManager()->getGlobalFrameAndNavTypeWaypointList(); QList<Waypoint*> wps = mav->getWaypointManager()->getGlobalFrameAndNavTypeWaypointList();
bool ok; bool ok;
int index = idText.toInt(&ok); int index = idText.toInt(&ok);

13
src/ui/map3D/WaypointGroupNode.cc

@ -36,6 +36,7 @@ This file is part of the QGROUNDCONTROL project
#include <osg/ShapeDrawable> #include <osg/ShapeDrawable>
#include "Imagery.h" #include "Imagery.h"
#include "UASManager.h"
WaypointGroupNode::WaypointGroupNode(const QColor& color) WaypointGroupNode::WaypointGroupNode(const QColor& color)
: mColor(color) : mColor(color)
@ -70,6 +71,16 @@ WaypointGroupNode::update(UASInterface* uas, MAV_FRAME frame)
Imagery::LLtoUTM(latitude, longitude, robotX, robotY, utmZone); Imagery::LLtoUTM(latitude, longitude, robotX, robotY, utmZone);
robotZ = -altitude; 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) else if (frame == MAV_FRAME_LOCAL_NED)
{ {
robotX = uas->getLocalX(); robotX = uas->getLocalX();
@ -82,7 +93,7 @@ WaypointGroupNode::update(UASInterface* uas, MAV_FRAME frame)
removeChild(0, getNumChildren()); removeChild(0, getNumChildren());
} }
const QVector<Waypoint *>& list = uas->getWaypointManager()->getWaypointEditableList(); const QList<Waypoint *>& list = uas->getWaypointManager()->getWaypointEditableList();
for (int i = 0; i < list.size(); i++) for (int i = 0; i < list.size(); i++)
{ {

Loading…
Cancel
Save