summaryrefslogtreecommitdiffstats
path: root/profile.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-02 23:22:07 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-03 20:44:37 -0800
commit5ba250bd48500c9f7aa206324272d40fd3064069 (patch)
treea2eed434b80d9de6f3edd2a6af41a497597b886a /profile.c
parentaab67e2a5bb9c74fcc60af4ade0192d31263ebc7 (diff)
downloadsubsurface-5ba250bd48500c9f7aa206324272d40fd3064069.tar.gz
Use gradient factors in deco calculation
Usually dive computers show the ceiling in terms of the next deco stop - and those are in 3m increments. This commit also adds the ability to chose either the typical 3m increments or the smooth ceiling that the Bühlmann algorithm actually calculates. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'profile.c')
-rw-r--r--profile.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/profile.c b/profile.c
index 6cc8ce074..656e286bd 100644
--- a/profile.c
+++ b/profile.c
@@ -1560,7 +1560,7 @@ static struct plot_info *create_plot_info(struct dive *dive, struct divecomputer
struct plot_data *entry = NULL;
struct event *ev;
double amb_pressure, po2;
- int surface_pressure = dive->surface_pressure.mbar ? dive->surface_pressure.mbar : 1013;
+ double surface_pressure = (dive->surface_pressure.mbar ? dive->surface_pressure.mbar : 1013) / 1000.0;
/* The plot-info is embedded in the graphics context */
pi = &gc->pi;
@@ -1760,11 +1760,7 @@ static struct plot_info *create_plot_info(struct dive *dive, struct divecomputer
if (min_pressure > ceiling_pressure)
ceiling_pressure = min_pressure;
}
- ceiling_pressure = ceiling_pressure * 1000.0 + 0.5;
- if (ceiling_pressure > surface_pressure)
- entry->ceiling = rel_mbar_to_depth(ceiling_pressure - surface_pressure, dive);
- else
- entry->ceiling = 0;
+ entry->ceiling = deco_allowed_depth(ceiling_pressure, surface_pressure, dive, !prefs.calc_ceiling_3m_incr);
}
}