Commit d87add18 authored by Lorenz Meier's avatar Lorenz Meier

Compile fixes, added warning for log replay

parent 259403be
......@@ -3,6 +3,7 @@
#include <QDesktopServices>
#include "MainWindow.h"
#include "SerialLink.h"
#include "QGCMAVLinkLogPlayer.h"
#include "QGC.h"
#include "ui_QGCMAVLinkLogPlayer.h"
......@@ -361,6 +362,22 @@ bool QGCMAVLinkLogPlayer::loadLogFile(const QString& file)
// Reset current state
reset(0);
// Check if a serial link is connected
bool linkWarning = false;
foreach (LinkInterface* link, LinkManager::instance()->getLinks())
{
SerialLink* s = dynamic_cast<SerialLink*>(link);
if (s && s->isConnected())
linkWarning = true;
}
if (linkWarning)
MainWindow::instance()->showInfoMessage(tr("Active MAVLink links found"), tr("Currently other links are connected. It is recommended to disconnect any active link before replaying a log."));
play();
return true;
}
}
......
......@@ -46,6 +46,16 @@ QGCToolBar::QGCToolBar(QWidget *parent) :
// Do not load UI, wait for actions
}
void QGCToolBar::globalPositionChanged(UASInterface* uas, double lat, double lon, double alt, quint64 usec)
{
Q_UNUSED(uas);
Q_UNUSED(lat);
Q_UNUSED(lon);
Q_UNUSED(usec);
altitudeMSL = alt;
changed = true;
}
void QGCToolBar::heartbeatTimeout(bool timeout, unsigned int ms)
{
// set timeout label visible
......@@ -281,6 +291,7 @@ void QGCToolBar::setActiveUAS(UASInterface* active)
disconnect(mav, SIGNAL(batteryChanged(UASInterface*,double,double,int)), this, SLOT(updateBatteryRemaining(UASInterface*,double,double,int)));
disconnect(mav, SIGNAL(armingChanged(bool)), this, SLOT(updateArmingState(bool)));
disconnect(mav, SIGNAL(heartbeatTimeout(bool, unsigned int)), this, SLOT(heartbeatTimeout(bool,unsigned int)));
disconnect(active, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(globalPositionChanged(UASInterface*,double,double,double,quint64)));
if (mav->getWaypointManager())
{
disconnect(mav->getWaypointManager(), SIGNAL(currentWaypointChanged(quint16)), this, SLOT(updateCurrentWaypoint(quint16)));
......@@ -298,6 +309,7 @@ void QGCToolBar::setActiveUAS(UASInterface* active)
connect(active, SIGNAL(batteryChanged(UASInterface*,double,double,int)), this, SLOT(updateBatteryRemaining(UASInterface*,double,double,int)));
connect(active, SIGNAL(armingChanged(bool)), this, SLOT(updateArmingState(bool)));
connect(active, SIGNAL(heartbeatTimeout(bool, unsigned int)), this, SLOT(heartbeatTimeout(bool,unsigned int)));
connect(active, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(globalPositionChanged(UASInterface*,double,double,double,quint64)));
if (active->getWaypointManager())
{
connect(active->getWaypointManager(), SIGNAL(currentWaypointChanged(quint16)), this, SLOT(updateCurrentWaypoint(quint16)));
......@@ -314,6 +326,7 @@ void QGCToolBar::setActiveUAS(UASInterface* active)
toolBarStateLabel->setText(mav->getShortState());
toolBarTimeoutLabel->setStyleSheet(QString(""));
toolBarTimeoutLabel->setText("");
toolBarDistLabel->setText("");
setSystemType(mav, mav->getSystemType());
}
......@@ -333,7 +346,9 @@ void QGCToolBar::updateArmingState(bool armed)
void QGCToolBar::updateView()
{
if (!changed) return;
toolBarDistLabel->setText(tr("%1 m").arg(wpDistance, 6, 'f', 2, '0'));
//toolBarDistLabel->setText(tr("%1 m").arg(wpDistance, 6, 'f', 2, '0'));
// XXX add also rel altitude
toolBarDistLabel->setText(QString("%1 m MSL").arg(altitudeMSL, 6, 'f', 2, '0'));
toolBarWpLabel->setText(tr("WP%1").arg(wpId));
toolBarBatteryBar->setValue(batteryPercent);
if (batteryPercent < 30 && toolBarBatteryBar->value() >= 30) {
......
......@@ -74,6 +74,8 @@ public slots:
void updateView();
/** @brief Update connection timeout time */
void heartbeatTimeout(bool timeout, unsigned int ms);
/** @brief Update global position */
void globalPositionChanged(UASInterface* uas, double lat, double lon, double alt, quint64 usec);
/** @brief Create or connect link */
void connectLink(bool connect);
/** @brief Clear status string */
......@@ -106,6 +108,8 @@ protected:
float batteryVoltage;
int wpId;
double wpDistance;
float altitudeMSL;
float altitudeRel;
QString state;
QString mode;
QString systemName;
......
......@@ -834,7 +834,7 @@ Pixhawk3DWidget::moveWaypointPosition(void)
return;
}
const QVector<Waypoint *> waypoints =
const QList<Waypoint *> waypoints =
mActiveUAS->getWaypointManager()->getWaypointEditableList();
Waypoint* waypoint = waypoints.at(mSelectedWpIndex);
......@@ -882,7 +882,7 @@ Pixhawk3DWidget::moveWaypointHeading(void)
return;
}
const QVector<Waypoint *> waypoints =
const QList<Waypoint *> waypoints =
mActiveUAS->getWaypointManager()->getWaypointEditableList();
Waypoint* waypoint = waypoints.at(mSelectedWpIndex);
......@@ -929,7 +929,7 @@ Pixhawk3DWidget::setWaypointAltitude(void)
}
bool ok;
const QVector<Waypoint *> waypoints =
const QList<Waypoint *> waypoints =
mActiveUAS->getWaypointManager()->getWaypointEditableList();
Waypoint* waypoint = waypoints.at(mSelectedWpIndex);
......@@ -960,7 +960,7 @@ Pixhawk3DWidget::clearAllWaypoints(void)
{
if (mActiveUAS)
{
const QVector<Waypoint *> waypoints =
const QList<Waypoint *> waypoints =
mActiveUAS->getWaypointManager()->getWaypointEditableList();
for (int i = waypoints.size() - 1; i >= 0; --i)
{
......
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