Make planner work again for CCR dives

The latest CCR patches had rendered the planner not usable for CCR dives.
This patch corrects this (and reenables the CCR set point column for
segments). The problem was that a new member setpoint of struct divepoint
had been introduced, but there was already po2 which had the same meaning.
This patch merges the two and renames them setpoint to prevent future
confusion.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Robert C. Helling 2014-10-19 07:07:07 -07:00 committed by Dirk Hohndel
parent 839bcaaf70
commit 5f44fdd9cf
11 changed files with 53 additions and 52 deletions

View file

@ -171,8 +171,8 @@ static int calculate_otu(struct dive *dive)
struct sample *sample = dc->sample + i;
struct sample *psample = sample - 1;
t = sample->time.seconds - psample->time.seconds;
if (sample->po2.mbar) {
po2 = sample->po2.mbar;
if (sample->setpoint.mbar) {
po2 = sample->setpoint.mbar;
} else {
int o2 = active_o2(dive, dc, sample->time);
po2 = o2 * depth_to_atm(sample->depth.mm, dive);
@ -235,8 +235,8 @@ static int calculate_cns(struct dive *dive)
struct sample *sample = dc->sample + i;
struct sample *psample = sample - 1;
t = sample->time.seconds - psample->time.seconds;
if (sample->po2.mbar) {
po2 = sample->po2.mbar;
if (sample->setpoint.mbar) {
po2 = sample->setpoint.mbar;
} else {
int o2 = active_o2(dive, dc, sample->time);
po2 = o2 * depth_to_atm(sample->depth.mm, dive);
@ -322,7 +322,7 @@ static void add_dive_to_deco(struct dive *dive)
for (j = t0; j < t1; j++) {
int depth = interpolate(psample->depth.mm, sample->depth.mm, j - t0, t1 - t0);
(void)add_segment(depth_to_mbar(depth, dive) / 1000.0,
&dive->cylinder[sample->sensor].gasmix, 1, sample->po2.mbar, dive);
&dive->cylinder[sample->sensor].gasmix, 1, sample->setpoint.mbar, dive);
}
}
}