summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2018-04-14 11:06:18 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-04-14 13:37:44 -0700
commit82a3d2be954cedae9cb9d9b20e3b97facdd7a3b0 (patch)
treeae2fb4a65d9187daf158185b49d08c21becfb121 /core
parent0df43252bef7d6aa8733de0c4c3ab8698636dc8e (diff)
downloadsubsurface-82a3d2be954cedae9cb9d9b20e3b97facdd7a3b0.tar.gz
QML UI: better debug messages for getting current location
Also, show GPS refresh interval in seconds; it's confusing if this is reported in ms. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core')
-rw-r--r--core/gpslocation.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/core/gpslocation.cpp b/core/gpslocation.cpp
index affe62c3b..30913168c 100644
--- a/core/gpslocation.cpp
+++ b/core/gpslocation.cpp
@@ -60,7 +60,7 @@ void GpsLocation::setGpsTimeThreshold(int seconds)
{
if (m_GpsSource) {
m_GpsSource->setUpdateInterval(seconds * 1000);
- status(QString("Set GPS service update interval to %1").arg(m_GpsSource->updateInterval()));
+ status(QString("Set GPS service update interval to %1 s").arg(m_GpsSource->updateInterval() / 1000));
}
}
@@ -131,14 +131,17 @@ void GpsLocation::serviceEnable(bool toggle)
QString GpsLocation::currentPosition()
{
+ qDebug() << "current position requested";
if (!hasLocationsSource())
- return tr("Unknown GPS location");
+ return tr("Unknown GPS location (no GPS source)");
if (m_trackers.count() && m_trackers.lastKey() + 300 >= QDateTime::currentMSecsSinceEpoch() / 1000) {
// we can simply use the last position that we tracked
gpsTracker gt = m_trackers.last();
QString gpsString = printGPSCoords(gt.latitude.udeg, gt.longitude.udeg);
qDebug() << "returning last position" << gpsString;
return gpsString;
+ } else {
+ qDebug() << "last position saved was too old" << QDateTime().fromMSecsSinceEpoch(m_trackers.lastKey() * 1000).toString();
}
qDebug() << "requesting new GPS position";
m_GpsSource->requestUpdate();
@@ -165,8 +168,8 @@ void GpsLocation::newPosition(QGeoPositionInfo pos)
int64_t delta = (int64_t)pos.timestamp().toTime_t() + gettimezoneoffset() - lastTime;
if (!nr || waitingForPosition || delta > prefs.time_threshold ||
lastCoord.distanceTo(pos.coordinate()) > prefs.distance_threshold) {
- QString msg("received new position %1 after delta %2 threshold %3");
- status(qPrintable(msg.arg(pos.coordinate().toString()).arg(delta).arg(prefs.time_threshold)));
+ QString msg("received new position %1 after delta %2 threshold %3 (now %4 last %5)");
+ status(qPrintable(msg.arg(pos.coordinate().toString()).arg(delta).arg(prefs.time_threshold).arg(pos.timestamp().toString()).arg(QDateTime().fromSecsSinceEpoch(lastTime).toString())));
waitingForPosition = false;
gpsTracker gt;
gt.when = pos.timestamp().toTime_t();
@@ -174,6 +177,8 @@ void GpsLocation::newPosition(QGeoPositionInfo pos)
gt.latitude.udeg = lrint(pos.coordinate().latitude() * 1000000);
gt.longitude.udeg = lrint(pos.coordinate().longitude() * 1000000);
addFixToStorage(gt);
+ gpsTracker gtNew = m_trackers.last();
+ qDebug() << "newest fix is now at" << QDateTime().fromSecsSinceEpoch(gtNew.when).toString();
}
}