mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
In free dive mode split dives with only a 10 second surface interval
If the dive computer tells us that this was free diving we should be a lot more aggressive splitting dives. For scuba dives a minute seems more reasonable (to avoid splitting dives when you pop to the surface to get the bearing and continue the dive after a few second). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
76b31aa76a
commit
a39038a902
1 changed files with 10 additions and 1 deletions
11
dive.c
11
dive.c
|
@ -2941,6 +2941,15 @@ static int split_dive_at(struct dive *dive, int a, int b)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* in freedive mode we split for as little as 10 seconds on the surface,
|
||||||
|
* otherwise we use a minute */
|
||||||
|
static bool should_split(struct divecomputer *dc, int t1, int t2)
|
||||||
|
{
|
||||||
|
int threshold = dc->divemode == FREEDIVE ? 10 : 60;
|
||||||
|
|
||||||
|
return t2 - t1 >= threshold;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Try to split a dive into multiple dives at a surface interval point.
|
* Try to split a dive into multiple dives at a surface interval point.
|
||||||
*
|
*
|
||||||
|
@ -2983,7 +2992,7 @@ int split_dive(struct dive *dive)
|
||||||
// the surface start.
|
// the surface start.
|
||||||
if (!surface_start)
|
if (!surface_start)
|
||||||
continue;
|
continue;
|
||||||
if (sample->time.seconds - dc->sample[surface_start].time.seconds < 60)
|
if (!should_split(dc, dc->sample[surface_start].time.seconds, sample[i - 1].time.seconds))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
return split_dive_at(dive, surface_start, i-1);
|
return split_dive_at(dive, surface_start, i-1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue