summaryrefslogtreecommitdiffstats
path: root/deco.c
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2014-10-24 16:40:21 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-04 07:13:04 -0800
commit06ddfc01222879ee0463affe796dba05de33b368 (patch)
treef098f39a8ffb7321e3db08989960b9dd511a1b53 /deco.c
parentf31d34adfd9676d7ccb6544d4a2b50336295e917 (diff)
downloadsubsurface-06ddfc01222879ee0463affe796dba05de33b368.tar.gz
Prepare for PSCR calculations
Calculations for passive semi-closed rebreathers are pretty much like OC except the pO2 is lower bey a certain (SAC dependent) factor. This patch introduces the corresponding calculations in case dctype == PSCR which is so far never set and there is currently no UI for these calculations. As pO2 is SAC dependent it takes a certain attempt at getting it and drops to defaults from the prefs otherwise. As there is no UI at this point and I also don't have any dives, this has not received much testing, yet, but it compiles. At least. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'deco.c')
-rw-r--r--deco.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/deco.c b/deco.c
index 51c26eac6..c2d54d59c 100644
--- a/deco.c
+++ b/deco.c
@@ -18,6 +18,7 @@
#include <math.h>
#include <string.h>
#include "dive.h"
+#include <assert.h>
//! Option structure for Buehlmann decompression.
struct buehlmann_config {
@@ -184,12 +185,12 @@ double he_factor(int period_in_seconds, int ci)
}
/* add period_in_seconds at the given pressure and gas to the deco calculation */
-double add_segment(double pressure, const struct gasmix *gasmix, int period_in_seconds, int ccpo2, const struct dive *dive)
+double add_segment(double pressure, const struct gasmix *gasmix, int period_in_seconds, int ccpo2, const struct dive *dive, int sac)
{
int ci;
struct gas_pressures pressures;
- fill_pressures(&pressures, pressure - WV_PRESSURE, gasmix, (double) ccpo2 / 1000.0);
+ fill_pressures(&pressures, pressure - WV_PRESSURE, gasmix, (double) ccpo2 / 1000.0, ccpo2 ? CCR : OC, sac);
if (buehlmann_config.gf_low_at_maxdepth && pressure > gf_low_pressure_this_dive)
gf_low_pressure_this_dive = pressure;