Skip to content

Commit

Permalink
Fix clang warning
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 14, 2022
1 parent 455b425 commit 3e532a3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
1 change: 0 additions & 1 deletion python/core/auto_generated/gps/qgsgpslogger.sip.in
Expand Up @@ -11,7 +11,6 @@


typedef struct _nmeaPOS nmeaPOS;
typedef struct _nmeaTIME nmeaTIME;

class QgsGpsLogger : QObject
{
Expand Down
13 changes: 5 additions & 8 deletions src/core/gps/qgsgpslogger.cpp
Expand Up @@ -16,7 +16,6 @@
#include "qgsgpslogger.h"
#include "qgsgpsconnection.h"
#include "gmath.h"
#include "info.h"

#include <QTimer>
#include <QTimeZone>
Expand All @@ -27,9 +26,8 @@ QgsGpsLogger::QgsGpsLogger( QgsGpsConnection *connection, QObject *parent )
{
setConnection( connection );

mLastNmeaPosition = std::make_unique< nmeaPOS >();
mLastNmeaPosition->lat = nmea_degree2radian( 0.0 );
mLastNmeaPosition->lon = nmea_degree2radian( 0.0 );
mLastNmeaPosition.lat = nmea_degree2radian( 0.0 );
mLastNmeaPosition.lon = nmea_degree2radian( 0.0 );

mAcquisitionTimer = std::unique_ptr<QTimer>( new QTimer( this ) );
mAcquisitionTimer->setSingleShot( true );
Expand Down Expand Up @@ -200,11 +198,10 @@ void QgsGpsLogger::gpsStateChanged( const QgsGpsInformation &info )
else
{
newLocationWgs84 = mLastGpsPositionWgs84;
if ( mLastNmeaPosition )
newNmeaPosition = *mLastNmeaPosition;
newNmeaPosition = mLastNmeaPosition;
newAlt = mLastElevation;
}
if ( !mAcquisitionEnabled || !mLastNmeaPosition || ( nmea_distance( &newNmeaPosition, mLastNmeaPosition.get() ) < mDistanceThreshold ) )
if ( !mAcquisitionEnabled || ( nmea_distance( &newNmeaPosition, &mLastNmeaPosition ) < mDistanceThreshold ) )
{
// do not update position if update is disabled by timer or distance is under threshold
newLocationWgs84 = mLastGpsPositionWgs84;
Expand All @@ -220,7 +217,7 @@ void QgsGpsLogger::gpsStateChanged( const QgsGpsInformation &info )
if ( mLastGpsPositionWgs84 != newLocationWgs84 )
{
mLastGpsPositionWgs84 = newLocationWgs84;
mLastNmeaPosition = std::make_unique< nmeaPOS>( newNmeaPosition );
mLastNmeaPosition = newNmeaPosition;
mLastElevation = newAlt;

if ( mAutomaticallyAddTrackVertices )
Expand Down
5 changes: 2 additions & 3 deletions src/core/gps/qgsgpslogger.h
Expand Up @@ -26,13 +26,12 @@
#include <QObject>
#include <QPointer>
#include <QDateTime>
#include "info.h"

class QgsGpsConnection;
class QTimer;
class QgsGpsInformation;

typedef struct _nmeaPOS nmeaPOS;
typedef struct _nmeaTIME nmeaTIME;

/**
* \ingroup core
Expand Down Expand Up @@ -214,7 +213,7 @@ class CORE_EXPORT QgsGpsLogger : public QObject
QgsPointXY mLastGpsPositionWgs84;
double mLastElevation = 0.0;

std::unique_ptr< nmeaPOS > mLastNmeaPosition;
nmeaPOS mLastNmeaPosition;
QDateTime mLastTime;

QDateTime mTrackStartTime;
Expand Down

0 comments on commit 3e532a3

Please sign in to comment.