summaryrefslogtreecommitdiffstats
path: root/divelist.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-03 23:56:10 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-04 11:13:14 -0800
commit6dc247ff784d5fae6ba5721ff4c9683c1749999a (patch)
tree35b82513bbe864ee720d9ad94e0a54ba5eda38cc /divelist.c
parent75b970f7accc2498289ea646b16d6f412efd1912 (diff)
downloadsubsurface-6dc247ff784d5fae6ba5721ff4c9683c1749999a.tar.gz
Fix deco calculations to correctly use GF values and add CC support
The old implementation was broken in several ways. For one thing the GF values are percentages, so they should normally be 0 < GF < 1 (well, some crazy people like to go above that). With this most of the Bühlmann config constants were wrong. Furthermore, after we adjust the pressure tolerance based on the gradient factors, we need to convert this back into a depth (instead of passing back the unmodified depth - oops). Finally, this commit adds closed circuit support to the deco calculations. Major progress and much more useful at this stage. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'divelist.c')
-rw-r--r--divelist.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/divelist.c b/divelist.c
index f2e678181..88aff9a49 100644
--- a/divelist.c
+++ b/divelist.c
@@ -834,8 +834,10 @@ static void add_dive_to_deco(struct dive *dive)
int j;
for (j = t0; j < t1; j++) {
- int depth = 0.5 + psample->depth.mm + (j - t0) * (sample->depth.mm - psample->depth.mm) / (t1 - t0);
- (void) add_segment(depth_to_mbar(depth, dive) / 1000.0, &dive->cylinder[sample->sensor].gasmix, 1);
+ int depth = 0.5 + psample->depth.mm + (j - t0) *
+ (sample->depth.mm - psample->depth.mm) / (t1 - t0);
+ (void) add_segment(depth_to_mbar(depth, dive) / 1000.0,
+ &dive->cylinder[sample->sensor].gasmix, 1, sample->po2 / 1000.0);
}
}
}
@@ -879,7 +881,7 @@ void init_decompression(struct dive *dive)
printf("added dive #%d\n", pdive->number);
dump_tissues();
#endif
- add_segment(surface_pressure, &air, surface_time);
+ add_segment(surface_pressure, &air, surface_time, 0.0);
#if DEBUG & 16
printf("after surface intervall of %d:%02u\n", FRACTION(surface_time,60));
dump_tissues();