summaryrefslogtreecommitdiffstats
path: root/core/dive.c
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2017-02-04 14:26:04 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-02-04 07:09:35 -0800
commit6518b0db4563839c0adccae32cc4b4f5e9fa27a8 (patch)
tree896d3620a9af67128131bfbb8dc352992a311e1d /core/dive.c
parent2516ae7e5f2a8912a394181fe451337a3a22c9ee (diff)
downloadsubsurface-6518b0db4563839c0adccae32cc4b4f5e9fa27a8.tar.gz
Treat gaschanges at 1s as inital gas use
When the first leg in the planner is not cylinder 0, a gaschange event at t=1s is inserted. In the profile, we should treat that as inital gas, so no pressure information is printed for cylinder 0 that is used nominally for one second. This fixes a problem reported by Willem. Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'core/dive.c')
-rw-r--r--core/dive.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/dive.c b/core/dive.c
index 3c2c2afde..945c13426 100644
--- a/core/dive.c
+++ b/core/dive.c
@@ -893,7 +893,7 @@ int explicit_first_cylinder(struct dive *dive, struct divecomputer *dc)
{
if (dc) {
struct event *ev = get_next_event(dc->events, "gaschange");
- if (ev && dc->sample && ev->time.seconds == dc->sample[0].time.seconds)
+ if (ev && ((dc->sample && ev->time.seconds == dc->sample[0].time.seconds) || ev->time.seconds <= 1))
return get_cylinder_index(dive, ev);
else if (dc->divemode == CCR)
return MAX(get_cylinder_idx_by_use(dive, DILUENT), 0);