From: Linus Torvalds <[email protected]> Date: Tue, 20 May 2014 14:01:40 +0900 Subject: [PATCH] Use the last 'diveid' when merging dives for one dive computer
When we merge two dives into the same dive because a divecomputer had incorrectly considered it two separate dives (due to surface time within the dive) we should pick the dive ID from the later dive to be the diveid of the resulting merged dive. Otherwise we might re-download the (now merged) partial dive. This is a rather unusual special case, but it actually hit me with the Uemis on my last dive in Palau: Chandelier Cave has multiple surface points where you can spend time admiring the cave above water, and the Uemis (but not my Suunto's) decided that the dive was actually four short dives back-to-back. Signed-off-by: Linus Torvalds <[email protected]> --- dive.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dive.c b/dive.c index 82d44b41b2d8..849756236ac4 100644 --- a/dive.c +++ b/dive.c @@ -1929,6 +1929,9 @@ static void interleave_dive_computers(struct divecomputer *res, if (match) { merge_events(res, a, match, offset); merge_samples(res, a, match, offset); + /* Use the diveid of the later dive! */ + if (offset > 0) + res->diveid = match->diveid; } else { res->sample = a->sample; res->samples = a->samples; -- 1.9.0 _______________________________________________ subsurface mailing list [email protected] http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface
