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>
This commit is contained in:
Jan Schubert 2013-01-14 23:53:38 +01:00 committed by Dirk Hohndel
parent 2e53a41525
commit 90d3c5614a
11 changed files with 51 additions and 48 deletions

4
deco.c
View file

@ -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;
}