From 6518b0db4563839c0adccae32cc4b4f5e9fa27a8 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Sat, 4 Feb 2017 14:26:04 +0100 Subject: 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 --- core/dive.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- cgit v1.2.3-70-g09d2