summaryrefslogtreecommitdiffstats
path: root/profile.c
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2015-10-12 22:34:15 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-10-12 15:29:14 -0700
commitf1550c1a86cee2cd69d9cfda10e035e6529413c8 (patch)
tree1e632003ceac689cc6f7d43052543f5cc925d274 /profile.c
parent1c7bc14af9a2ce29cb0f4bebbe3755ce46f31ef4 (diff)
downloadsubsurface-f1550c1a86cee2cd69d9cfda10e035e6529413c8.tar.gz
Break out of TTS calculation for deco longer than 2h
If you have a serious deco obligation TTS is not meaningful anyhow so don't compute it for the profile. In particular not without gas changes. 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.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/profile.c b/profile.c
index cad768728..ef5471886 100644
--- a/profile.c
+++ b/profile.c
@@ -19,6 +19,9 @@
//#define DEBUG_GAS 1
+#define MAX_PROFILE_DECO 7200
+
+
int selected_dive = -1; /* careful: 0 is a valid value */
unsigned int dc_number = 0;
@@ -778,18 +781,17 @@ static void calculate_ndl_tts(struct plot_data *entry, struct dive *dive, double
surface_pressure, dive, 1), deco_stepsize);
int ascent_depth = entry->depth;
/* at what time should we give up and say that we got enuff NDL? */
- const int max_ndl = 7200;
int cylinderindex = entry->cylinderindex;
/* If we don't have a ceiling yet, calculate ndl. Don't try to calculate
* a ndl for lower values than 3m it would take forever */
if (next_stop == 0) {
if (entry->depth < 3000) {
- entry->ndl = max_ndl;
+ entry->ndl = MAX_PROFILE_DECO;
return;
}
/* stop if the ndl is above max_ndl seconds, and call it plenty of time */
- while (entry->ndl_calc < max_ndl && deco_allowed_depth(tissue_tolerance_calc(dive, depth_to_bar(entry->depth, dive)), surface_pressure, dive, 1) <= 0) {
+ while (entry->ndl_calc < MAX_PROFILE_DECO && deco_allowed_depth(tissue_tolerance_calc(dive, depth_to_bar(entry->depth, dive)), surface_pressure, dive, 1) <= 0) {
entry->ndl_calc += time_stepsize;
add_segment(depth_to_bar(entry->depth, dive),
&dive->cylinder[cylinderindex].gasmix, time_stepsize, entry->o2pressure.mbar, dive, prefs.bottomsac);
@@ -821,6 +823,8 @@ static void calculate_ndl_tts(struct plot_data *entry, struct dive *dive, double
entry->stoptime_calc += time_stepsize;
entry->tts_calc += time_stepsize;
+ if (entry->tts_calc > MAX_PROFILE_DECO)
+ break;
add_segment(depth_to_bar(ascent_depth, dive),
&dive->cylinder[cylinderindex].gasmix, time_stepsize, entry->o2pressure.mbar, dive, prefs.decosac);