mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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 <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
176d49c591
commit
7821b87983
1 changed files with 3 additions and 0 deletions
3
dive.c
3
dive.c
|
@ -1926,6 +1926,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;
|
||||
|
|
Loading…
Add table
Reference in a new issue