summaryrefslogtreecommitdiffstats
path: root/deco.c
diff options
context:
space:
mode:
authorGravatar Jan Schubert <Jan.Schubert@GMX.li>2013-01-14 23:53:38 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-14 20:12:40 -0800
commit90d3c5614a9c952a50e582e2dff6e21419c64729 (patch)
tree5298138cc67579e4e58f33e493c53a8dae05ad37 /deco.c
parent2e53a415257677fe6e5da7fcce373722269a9082 (diff)
downloadsubsurface-90d3c5614a9c952a50e582e2dff6e21419c64729.tar.gz
Centralising and redefining values as integers
This patch centralizes the definition for surface pressure, oxygen in air, (re)defines all such values as plain integers and adapts calculations. It eliminates 11 (!) occurrences of definitions for surface pressure and also a few for oxygen in air. It also rewrites the calculation for EAD, END and EADD using the new definitons, harmonizing it for OC and CC and fixes a bug for EADD OC calculation. And finally it removes the unneeded variable entry_ead in gtk-gui.c. Jan 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.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/deco.c b/deco.c
index 1a2d13ac7..70a3c303a 100644
--- a/deco.c
+++ b/deco.c
@@ -134,7 +134,7 @@ static double tissue_tolerance_calc(const struct dive *dive)
double add_segment(double pressure, struct gasmix *gasmix, int period_in_seconds, double ccpo2, const struct dive *dive)
{
int ci;
- int fo2 = gasmix->o2.permille ? gasmix->o2.permille : 209;
+ int fo2 = gasmix->o2.permille ? gasmix->o2.permille : O2_IN_AIR;
double ppn2 = (pressure - WV_PRESSURE) * (1000 - fo2 - gasmix->he.permille) / 1000.0;
double pphe = (pressure - WV_PRESSURE) * gasmix->he.permille / 1000.0;
@@ -206,7 +206,7 @@ void clear_deco(double surface_pressure)
{
int ci;
for (ci = 0; ci < 16; ci++) {
- tissue_n2_sat[ci] = (surface_pressure - WV_PRESSURE) * N2_IN_AIR;
+ tissue_n2_sat[ci] = (surface_pressure - WV_PRESSURE) * N2_IN_AIR / 1000;
tissue_he_sat[ci] = 0.0;
tissue_tolerated_ambient_pressure[ci] = 0.0;
}