diff options
author | Anton Lundin <glance@acc.umu.se> | 2013-06-19 18:53:58 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-06-21 08:09:52 -0700 |
commit | 03657ce6a93a5db746a0de948b87eda0bd76d842 (patch) | |
tree | 908641531a211e0c92989dc57d04267e9c007792 | |
parent | 09ee8ece5cf057578b797b78ae023381e853ad58 (diff) | |
download | subsurface-03657ce6a93a5db746a0de948b87eda0bd76d842.tar.gz |
Use the gasmix straight off
In calculate_deco_information we compute the ppo2 so we can graph it,
but if we send that ppo2 on to add_segment it will just reverse the
computation and introduce errors.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | profile.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -989,12 +989,14 @@ static void calculate_deco_information(struct dive *dive, struct divecomputer *d fo2 = get_o2(&dive->cylinder[cylinderindex].gasmix); fhe = get_he(&dive->cylinder[cylinderindex].gasmix); double ratio = (double)fhe / (1000.0 - fo2); + int ccrdive = 0; if (entry->po2) { /* we have an O2 partial pressure in the sample - so this * is likely a CC dive... use that instead of the value * from the cylinder info */ double po2 = entry->po2 > amb_pressure ? amb_pressure : entry->po2; + ccrdive = 1; entry->po2 = po2; entry->phe = (amb_pressure - po2) * ratio; entry->pn2 = amb_pressure - po2 - entry->phe; @@ -1040,7 +1042,7 @@ static void calculate_deco_information(struct dive *dive, struct divecomputer *d for (j = t0+1; j <= t1; j++) { int depth = interpolate(entry[-1].depth, entry[0].depth, j - t0, t1 - t0); double min_pressure = add_segment(depth_to_mbar(depth, dive) / 1000.0, - &dive->cylinder[cylinderindex].gasmix, 1, entry->po2 * 1000, dive); + &dive->cylinder[cylinderindex].gasmix, 1, ccrdive ? entry->po2 * 1000 : 0, dive); tissue_tolerance = min_pressure; } if (t0 == t1) |