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>
This commit is contained in:
Robert C. Helling 2017-02-04 14:26:04 +01:00 committed by Dirk Hohndel
parent 2516ae7e5f
commit 6518b0db45

View file

@ -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);