Do not prefer gps fixes just for being into dive time

ATM we were giving preference to a gps fix taken during dive time over
another taken before dive start time (proven both in predefined
SAME_GROUP 6 hours range).
While this logic is right for a static boat or a shore dive - as it
ensures a correct position - will fail for drift dives or dives where
boat changes its position during dive time.

Instead, will choose the gps fix closer to the dive start time.

fixes issue #666

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Salvador Cuñat 2017-12-02 09:12:35 +01:00 committed by Dirk Hohndel
parent c3c5256dc4
commit 6f42ab46da

View file

@ -91,15 +91,6 @@ static bool merge_locations_into_dives(void)
time_during_dive_with_offset(dive, nextgpsfix->when, SAME_GROUP)) {
if (verbose)
qDebug() << "look at the next gps fix @" << get_dive_date_string(nextgpsfix->when);
/* first let's test if this one is during the dive */
if (time_during_dive_with_offset(dive, nextgpsfix->when, 0)) {
if (verbose)
qDebug() << "which is during the dive, pick that one";
copy_gps_location(nextgpsfix, dive);
changed++;
tracer = j + 1;
break;
}
/* we know the gps fixes are sorted; if they are both before the dive, ignore the first,
* if theay are both after the dive, take the first,
* if the first is before and the second is after, take the closer one */