summaryrefslogtreecommitdiffstats
path: root/divelist.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2013-02-09 11:15:18 +1100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-02-08 18:22:30 -0800
commit926fcef2a1e83b58c37c948a3f1a904aa0be0d0e (patch)
tree7f759284b78c77beecb2a11bae25649122f2690a /divelist.c
parentb286ea638c8ce468cf9c1a1b5037867acb5d6fe4 (diff)
downloadsubsurface-926fcef2a1e83b58c37c948a3f1a904aa0be0d0e.tar.gz
Do more dive fixup for each dive computer
In commit b6c9301e5847 ("Move more dive computer filled data to the divecomputer structure") we moved the fields that get filled in by the dive computers to be per-divecomputer data structures. This patch re-creates some of those fields back in the "struct dive", but now the fields are initialized to be a reasonable average from the dive computer data. We already did some of this for the temperature min/max fields for the statistics, so this just continues that trend. The goal is to make it easy to look at "dive values" without having to iterate over dive computers every time you do. Just do it once in "fixup_dive()" instead. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'divelist.c')
-rw-r--r--divelist.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/divelist.c b/divelist.c
index 97981a0f2..417cb1b77 100644
--- a/divelist.c
+++ b/divelist.c
@@ -655,7 +655,7 @@ static int calculate_otu(struct dive *dive)
po2 = sample->po2;
} else {
int o2 = active_o2(dive, dc, sample->time);
- po2 = o2 / 1000.0 * depth_to_mbar(sample->depth.mm, dive, &dive->dc);
+ po2 = o2 / 1000.0 * depth_to_mbar(sample->depth.mm, dive);
}
if (po2 >= 500)
otu += pow((po2 - 500) / 1000.0, 0.83) * t / 30.0;
@@ -720,7 +720,7 @@ static int calculate_sac(struct dive *dive)
}
}
/* Mean pressure in bar (SAC calculations are in bar*l/min) */
- pressure = depth_to_mbar(dive->dc.meandepth.mm, dive, &dive->dc) / 1000.0;
+ pressure = depth_to_mbar(dive->dc.meandepth.mm, dive) / 1000.0;
sac = airuse / pressure * 60 / duration;
/* milliliters per minute.. */
@@ -744,7 +744,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, &dive->dc) / 1000.0,
+ (void) add_segment(depth_to_mbar(depth, dive) / 1000.0,
&dive->cylinder[sample->sensor].gasmix, 1, sample->po2, dive);
}
}