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>
This commit is contained in:
Dirk Hohndel 2013-01-02 23:22:07 -08:00
parent aab67e2a5b
commit 5ba250bd48
5 changed files with 86 additions and 13 deletions

View file

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