mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
mobile/GPS: fix two errors in the GPS handling
First, the time zone adjustment was wrong - this as written could only ever have worked in UTC or by pure chance. Second, the order of alerting the UI of the availability of a GPS fix was also incorrect creating a race between the UI and our data structures. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
4454cf0381
commit
702d09df9f
3 changed files with 5 additions and 4 deletions
|
@ -2,6 +2,7 @@
|
||||||
- undo: reset dive-mode on undo of set-point addition
|
- undo: reset dive-mode on undo of set-point addition
|
||||||
- desktop: complete rewrite of the statistics code, significantly expanding capabilities
|
- desktop: complete rewrite of the statistics code, significantly expanding capabilities
|
||||||
- desktop: add preferences option to disable default cylinder types
|
- desktop: add preferences option to disable default cylinder types
|
||||||
|
- mobile: fix broken 'use current location' in dive edit
|
||||||
- mobile: add ability to show fundamentally the same statistics as on the desktop
|
- mobile: add ability to show fundamentally the same statistics as on the desktop
|
||||||
- mobile: add settings for DC and calculated ceilings and show calculated ceilings
|
- mobile: add settings for DC and calculated ceilings and show calculated ceilings
|
||||||
- mobile: switch to newer version of Kirigami
|
- mobile: switch to newer version of Kirigami
|
||||||
|
|
|
@ -126,7 +126,7 @@ QString GpsLocation::currentPosition()
|
||||||
if (!hasLocationsSource())
|
if (!hasLocationsSource())
|
||||||
return tr("Unknown GPS location (no GPS source)");
|
return tr("Unknown GPS location (no GPS source)");
|
||||||
if (m_trackers.count()) {
|
if (m_trackers.count()) {
|
||||||
QDateTime lastFixTime = timestampToDateTime(m_trackers.lastKey() + gettimezoneoffset());
|
QDateTime lastFixTime = timestampToDateTime(m_trackers.lastKey() - gettimezoneoffset());
|
||||||
QDateTime now = QDateTime::currentDateTime();
|
QDateTime now = QDateTime::currentDateTime();
|
||||||
int delta = lastFixTime.secsTo(now);
|
int delta = lastFixTime.secsTo(now);
|
||||||
qDebug() << "lastFixTime" << lastFixTime.toString() << "now" << now.toString() << "delta" << delta;
|
qDebug() << "lastFixTime" << lastFixTime.toString() << "now" << now.toString() << "delta" << delta;
|
||||||
|
@ -168,14 +168,13 @@ void GpsLocation::newPosition(QGeoPositionInfo pos)
|
||||||
lastCoord.distanceTo(pos.coordinate()) > prefs.distance_threshold) {
|
lastCoord.distanceTo(pos.coordinate()) > prefs.distance_threshold) {
|
||||||
QString msg = QStringLiteral("received new position %1 after delta %2 threshold %3 (now %4 last %5)");
|
QString msg = QStringLiteral("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(timestampToDateTime(lastTime).toString())));
|
status(qPrintable(msg.arg(pos.coordinate().toString()).arg(delta).arg(prefs.time_threshold).arg(pos.timestamp().toString()).arg(timestampToDateTime(lastTime).toString())));
|
||||||
waitingForPosition = false;
|
|
||||||
acquiredPosition();
|
|
||||||
gpsTracker gt;
|
gpsTracker gt;
|
||||||
gt.when = thisTime;
|
gt.when = thisTime;
|
||||||
gt.location = create_location(pos.coordinate().latitude(), pos.coordinate().longitude());
|
gt.location = create_location(pos.coordinate().latitude(), pos.coordinate().longitude());
|
||||||
addFixToStorage(gt);
|
addFixToStorage(gt);
|
||||||
gpsTracker gtNew = m_trackers.last();
|
gpsTracker gtNew = m_trackers.last();
|
||||||
qDebug() << "newest fix is now at" << timestampToDateTime(gtNew.when - gettimezoneoffset()).toString();
|
waitingForPosition = false;
|
||||||
|
acquiredPosition();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -204,6 +204,7 @@ Item {
|
||||||
target: manager
|
target: manager
|
||||||
onWaitingForPositionChanged: {
|
onWaitingForPositionChanged: {
|
||||||
gpsText = manager.getCurrentPosition()
|
gpsText = manager.getCurrentPosition()
|
||||||
|
manager.appendTextToLog("received updated position info " + gpsText)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue