diff options
author | Robert Helling <helling@atdotde.de> | 2013-05-30 20:56:00 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-05-31 05:18:25 +0900 |
commit | 344a429e4811c60b9b12ef225c2b5b8d31d8534b (patch) | |
tree | a5fd22433415c35ab3495bbc2e3c823099fd546c /profile.c | |
parent | 77880b7a0797cef0fac0650ce0321e3aa8b702f4 (diff) | |
download | subsurface-344a429e4811c60b9b12ef225c2b5b8d31d8534b.tar.gz |
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 <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'profile.c')
-rw-r--r-- | profile.c | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -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); |