From 344a429e4811c60b9b12ef225c2b5b8d31d8534b Mon Sep 17 00:00:00 2001 From: Robert Helling Date: Thu, 30 May 2013 20:56:00 +0200 Subject: Show ceilings for individual tissues I think that displaying tissue loadings either as pressure or as percentages is not very intuitive but that it makes much more sense when translated to ceiling depths. This change enables just that for the 16 tissues in our calculated ceiling and visualizes this in the profile graph. There is a checkbox in the preferences to turn this on. If enabled, all tissues having non-trivial ceilings are also shown in the info box. Signed-off-by: Robert C. Helling Signed-off-by: Dirk Hohndel --- profile.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'profile.c') diff --git a/profile.c b/profile.c index e6ba6ad8d..c502cf669 100644 --- a/profile.c +++ b/profile.c @@ -12,6 +12,7 @@ #include "divelist.h" #include "profile.h" +#include "deco.h" #include "libdivecomputer/parser.h" #include "libdivecomputer/version.h" @@ -971,7 +972,7 @@ static void calculate_deco_information(struct dive *dive, struct divecomputer *d double surface_pressure = (dc->surface_pressure.mbar ? dc->surface_pressure.mbar : get_surface_pressure_in_mbar(dive, TRUE)) / 1000.0; for (i = 1; i < pi->nr; i++) { - int fo2, fhe, j, t0, t1; + int fo2, fhe, j, k, t0, t1; double tissue_tolerance; struct plot_data *entry = pi->entry + i; int cylinderindex = entry->cylinderindex; @@ -1038,6 +1039,8 @@ static void calculate_deco_information(struct dive *dive, struct divecomputer *d entry->ceiling = (entry - 1)->ceiling; else entry->ceiling = deco_allowed_depth(tissue_tolerance, surface_pressure, dive, !prefs.calc_ceiling_3m_incr); + for (k=0; k<16; k++) + entry->ceilings[k] = deco_allowed_depth(tolerated_by_tissue[k], surface_pressure, dive, 1); } #if DECO_CALC_DEBUG & 1 @@ -1137,6 +1140,16 @@ static void plot_string(struct plot_data *entry, char *buf, int bufsize, depthvalue = get_depth_units(entry->ceiling, NULL, &depth_unit); memcpy(buf2, buf, bufsize); snprintf(buf, bufsize, _("%s\nCalculated ceiling %.0f %s"), buf2, depthvalue, depth_unit); + if (prefs.calc_all_tissues){ + int k; + for (k=0; k<16; k++){ + if (entry->ceilings[k]){ + depthvalue = get_depth_units(entry->ceilings[k], NULL, &depth_unit); + memcpy(buf2, buf, bufsize); + snprintf(buf, bufsize, _("%s\nTissue %.0fmin: %.0f %s"), buf2, buehlmann_N2_t_halflife[k], depthvalue, depth_unit); + } + } + } } if (entry->stopdepth) { depthvalue = get_depth_units(entry->stopdepth, NULL, &depth_unit); -- cgit v1.2.3-70-g09d2