Planner: Correctly compute CNS and OTU for bailout segments

For dives with mixed divemode, one needs to check sample.setpoint
to figure out if the segment is an OC segment and the po2 needs
to be computed from the gasmix and ambient pressure.

This fixes #3310

Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
Robert C. Helling 2021-08-18 23:38:15 +02:00 committed by Dirk Hohndel
parent edce243147
commit c634a07e38
3 changed files with 44 additions and 33 deletions

View file

@ -284,6 +284,8 @@ static void create_dive_from_plan(struct diveplan *diveplan, struct dive *dive,
}
sample = prepare_sample(dc);
sample[-1].setpoint.mbar = po2;
if (po2)
sample[-1].o2sensor[0].mbar = po2;
sample->time.seconds = lasttime + 1;
sample->depth = lastdepth;
sample->manually_entered = dp->entered;