summaryrefslogtreecommitdiffstats
path: root/profile.c
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2014-01-29 13:38:59 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-04 13:44:08 -0700
commitf34e6218a03dd91e831a240da3debb7d861e8603 (patch)
tree09234ec3aea8757942ef1b0d95dfe869020bb3d1 /profile.c
parent9874a97ed561459a2a290e1dbbe2b9c9d1bed4da (diff)
downloadsubsurface-f34e6218a03dd91e831a240da3debb7d861e8603.tar.gz
More tweaks to TTS calculations
Add a lager step value when walking the calculations forward. [Dirk Hohndel: this was sent ages ago and in all the discussions about the implications I apparently never applied this] Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'profile.c')
-rw-r--r--profile.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/profile.c b/profile.c
index b5df7c6cd..38e19a07d 100644
--- a/profile.c
+++ b/profile.c
@@ -1091,11 +1091,16 @@ void calculate_deco_information(struct dive *dive, struct divecomputer *dc, stru
for (i = 1; i < pi->nr; i++) {
struct plot_data *entry = pi->entry + i;
int j, t0 = (entry - 1)->sec, t1 = entry->sec;
- for (j = t0 + 1; j <= t1; j++) {
+ int time_stepsize = 20;
+ if (t0 != t1 && t1 - t0 < time_stepsize)
+ time_stepsize = t1 - t0;
+ for (j = t0 + time_stepsize; j <= t1; j += time_stepsize) {
int depth = interpolate(entry[-1].depth, entry[0].depth, j - t0, t1 - t0);
double min_pressure = add_segment(depth_to_mbar(depth, dive) / 1000.0,
- &dive->cylinder[entry->cylinderindex].gasmix, 1, entry->po2 * 1000, dive);
+ &dive->cylinder[entry->cylinderindex].gasmix, time_stepsize, entry->po2 * 1000, dive);
tissue_tolerance = min_pressure;
+ if (j - t0 < time_stepsize)
+ time_stepsize = j - t0;
}
if (t0 == t1)
entry->ceiling = (entry - 1)->ceiling;