diff options
author | Robert C. Helling <helling@atdotde.de> | 2015-10-12 22:34:15 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-10-12 15:29:14 -0700 |
commit | f1550c1a86cee2cd69d9cfda10e035e6529413c8 (patch) | |
tree | 1e632003ceac689cc6f7d43052543f5cc925d274 | |
parent | 1c7bc14af9a2ce29cb0f4bebbe3755ce46f31ef4 (diff) | |
download | subsurface-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>
-rw-r--r-- | profile.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -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); |