Browse Source

Compile fixes, added warning for log replay

QGC4.4
Lorenz Meier 12 years ago
parent
commit
d87add18f1
  1. 17
      src/ui/QGCMAVLinkLogPlayer.cc
  2. 17
      src/ui/QGCToolBar.cc
  3. 4
      src/ui/QGCToolBar.h
  4. 8
      src/ui/map3D/Pixhawk3DWidget.cc

17
src/ui/QGCMAVLinkLogPlayer.cc

@ -3,6 +3,7 @@ @@ -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) @@ -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;
}
}

17
src/ui/QGCToolBar.cc

@ -46,6 +46,16 @@ QGCToolBar::QGCToolBar(QWidget *parent) : @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) {

4
src/ui/QGCToolBar.h

@ -74,6 +74,8 @@ public slots: @@ -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: @@ -106,6 +108,8 @@ protected:
float batteryVoltage;
int wpId;
double wpDistance;
float altitudeMSL;
float altitudeRel;
QString state;
QString mode;
QString systemName;

8
src/ui/map3D/Pixhawk3DWidget.cc

@ -834,7 +834,7 @@ Pixhawk3DWidget::moveWaypointPosition(void) @@ -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) @@ -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) @@ -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) @@ -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)
{

Loading…
Cancel
Save