summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-11-13 17:17:18 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-11-13 17:17:47 -0800
commitfcbc013cb4e1528aa3a350320ac578d47de0b471 (patch)
tree86d7f9c3ad483126b585b242e384c9b758bed964
parentd65b756c4ff3cf929114d2a48d1a0aa22f481ed9 (diff)
downloadsubsurface-fcbc013cb4e1528aa3a350320ac578d47de0b471.tar.gz
Location service: Correctly access the last stored GPS fix
Now only storing fixes after a certain time / distance actually works. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-mobile/gpslocation.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/qt-mobile/gpslocation.cpp b/qt-mobile/gpslocation.cpp
index 7cba1a199..3139a4315 100644
--- a/qt-mobile/gpslocation.cpp
+++ b/qt-mobile/gpslocation.cpp
@@ -51,9 +51,9 @@ void GpsLocation::newPosition(QGeoPositionInfo pos)
status(qPrintable(msg.arg(pos.coordinate().toString())));
int nr = geoSettings->value("count", 0).toInt();
if (nr) {
- lastCoord.setLatitude(geoSettings->value(QString("gpsFix%1_lat").arg(nr)).toInt() / 1000000.0);
- lastCoord.setLongitude(geoSettings->value(QString("gpsFix%1_lon").arg(nr)).toInt() / 1000000.0);
- time_t lastTime = geoSettings->value(QString("gpsFix%1_time").arg(nr)).toULongLong();
+ lastCoord.setLatitude(geoSettings->value(QString("gpsFix%1_lat").arg(nr - 1)).toInt() / 1000000.0);
+ lastCoord.setLongitude(geoSettings->value(QString("gpsFix%1_lon").arg(nr - 1)).toInt() / 1000000.0);
+ lastTime = geoSettings->value(QString("gpsFix%1_time").arg(nr - 1)).toULongLong();
}
// if we have no record stored or if at least the configured minimum
// time has passed or we moved at least the configured minimum distance