diff options
author | Robert C. Helling <helling@atdotde.de> | 2014-10-14 10:46:40 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-10-14 20:33:46 +0200 |
commit | 34bb461c3de7cd0b8d9d3eaf13b1bc45973c16d3 (patch) | |
tree | 004b027f32e7f1981704d20e0a01778bf132b60f /dive.c | |
parent | 4cdb80c4cd3836fdbacf50f62e9c76f0efca244b (diff) | |
download | subsurface-34bb461c3de7cd0b8d9d3eaf13b1bc45973c16d3.tar.gz |
Reshuffle CCR voting logic and minor clean ups
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.c')
-rw-r--r-- | dive.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -1537,12 +1537,14 @@ int gasmix_distance(const struct gasmix *a, const struct gasmix *b) extern void fill_pressures(struct gas_pressures *pressures, const double amb_pressure, const struct gasmix *mix, double po2) { if (po2) { // This is probably a CCR dive where pressures->o2 is defined - if (po2 >= amb_pressure || get_o2(mix) == 1000) + if (po2 >= amb_pressure || get_o2(mix) == 1000) { pressures->o2 = amb_pressure; - else + pressures->n2 = pressures->he = 0.0; + } else { pressures->o2 = po2; - pressures->he = (amb_pressure - pressures->o2) * (double)get_he(mix) / (1000 - get_o2(mix)); - pressures->n2 = amb_pressure - pressures->o2 - pressures->he; + pressures->he = (amb_pressure - pressures->o2) * (double)get_he(mix) / (1000 - get_o2(mix)); + pressures->n2 = amb_pressure - pressures->o2 - pressures->he; + } } else { // Open circuit dives: no gas pressure values available, they need to be calculated pressures->o2 = get_o2(mix) / 1000.0 * amb_pressure; // These calculations are also used if the CCR calculation above.. |