summaryrefslogtreecommitdiffstats
path: root/deco.c
diff options
context:
space:
mode:
authorGravatar Jan Schubert <Jan.Schubert@GMX.li>2013-02-02 19:38:51 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-02-03 07:07:12 +1100
commit99dbd667bf2a40f2ea8444780310114e353f4557 (patch)
tree4a9e686e515cf9124b62932df7c26a19f7bfd418 /deco.c
parent59cfa5c427da640ce15fe60c0d271532b26b14e4 (diff)
downloadsubsurface-99dbd667bf2a40f2ea8444780310114e353f4557.tar.gz
Fixing SP handling in planner, adding event
This moves some double/floating handling for po2 to plain integer. There are still non int values around (also for phe and po2) in the plot area. Signed-off-by: Jan Schubert <Jan.Schubert@GMX.li> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'deco.c')
-rw-r--r--deco.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/deco.c b/deco.c
index 42222378e..6e73c50cb 100644
--- a/deco.c
+++ b/deco.c
@@ -72,7 +72,7 @@ const double buehlmann_He_factor_expositon_one_second[] = {
2.80360036664540E-004, 2.09299583354805E-004, 1.63410794820518E-004, 1.27869320250551E-004,
1.00198406028040E-004, 7.83611475491108E-005, 6.13689891868496E-005, 4.81280465299827E-005};
-#define WV_PRESSURE 0.0627 /* water vapor pressure */
+#define WV_PRESSURE 0.0627 // water vapor pressure in bar
#define DECO_STOPS_MULTIPLIER_MM 3000.0
#define GF_LOW_AT_MAXDEPTH 0
@@ -126,7 +126,7 @@ static double tissue_tolerance_calc(const struct dive *dive)
}
/* add period_in_seconds at the given pressure and gas to the deco calculation */
-double add_segment(double pressure, struct gasmix *gasmix, int period_in_seconds, double ccpo2, const struct dive *dive)
+double add_segment(double pressure, struct gasmix *gasmix, int period_in_seconds, int ccpo2, const struct dive *dive)
{
int ci;
int fo2 = gasmix->o2.permille ? gasmix->o2.permille : O2_IN_AIR;
@@ -138,9 +138,9 @@ double add_segment(double pressure, struct gasmix *gasmix, int period_in_seconds
gf_low_pressure_this_dive = pressure;
#endif
- if (ccpo2 > 0.0) { /* CC */
+ if (ccpo2) { /* CC */
double rel_o2_amb, f_dilutent;
- rel_o2_amb = ccpo2 / pressure;
+ rel_o2_amb = ccpo2 / pressure / 1000;
f_dilutent = (1 - rel_o2_amb) / (1 - fo2 / 1000.0);
if (f_dilutent < 0) { /* setpoint is higher than ambient pressure -> pure O2 */
ppn2 = 0.0;