Commit 1798f453 authored by Willian Galvani's avatar Willian Galvani

PositionManager.cpp: Add gcsHeading

parent 51a5c870
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
QGCPositionManager::QGCPositionManager(QGCApplication* app, QGCToolbox* toolbox) QGCPositionManager::QGCPositionManager(QGCApplication* app, QGCToolbox* toolbox)
: QGCTool (app, toolbox) : QGCTool (app, toolbox)
, _updateInterval (0) , _updateInterval (0)
, _gcsHeading (NAN)
, _currentSource (NULL) , _currentSource (NULL)
, _defaultSource (NULL) , _defaultSource (NULL)
, _nmeaSource (NULL) , _nmeaSource (NULL)
...@@ -60,6 +61,7 @@ void QGCPositionManager::setNmeaSourceDevice(QIODevice* device) ...@@ -60,6 +61,7 @@ void QGCPositionManager::setNmeaSourceDevice(QIODevice* device)
void QGCPositionManager::_positionUpdated(const QGeoPositionInfo &update) void QGCPositionManager::_positionUpdated(const QGeoPositionInfo &update)
{ {
QGeoCoordinate newGCSPosition = QGeoCoordinate(); QGeoCoordinate newGCSPosition = QGeoCoordinate();
qreal newGCSHeading = update.attribute(QGeoPositionInfo::Direction);
if (update.isValid()) { if (update.isValid()) {
// Note that gcsPosition filters out possible crap values // Note that gcsPosition filters out possible crap values
...@@ -71,6 +73,10 @@ void QGCPositionManager::_positionUpdated(const QGeoPositionInfo &update) ...@@ -71,6 +73,10 @@ void QGCPositionManager::_positionUpdated(const QGeoPositionInfo &update)
_gcsPosition = newGCSPosition; _gcsPosition = newGCSPosition;
emit gcsPositionChanged(_gcsPosition); emit gcsPositionChanged(_gcsPosition);
} }
if (newGCSHeading != _gcsHeading) {
_gcsHeading = newGCSHeading;
emit gcsHeadingChanged(_gcsHeading);
}
emit positionInfoUpdated(update); emit positionInfoUpdated(update);
} }
......
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