diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2015-01-03 09:36:41 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-01-03 09:45:25 -0800 |
commit | 4f17cd860f09feee8495d97dd5f5af9996551dfd (patch) | |
tree | eb581da6dc3dca6dc9a191d61021fe42eb9ed45f /profile.c | |
parent | 9a4cafd0f10b36fd25bda6ce67106557f389dcff (diff) | |
download | subsurface-4f17cd860f09feee8495d97dd5f5af9996551dfd.tar.gz |
Interpolate running depth when necessary
The running depth must be interpolated when sample interval is more than
10 seconds.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'profile.c')
-rw-r--r-- | profile.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -523,6 +523,7 @@ struct plot_info calculate_max_limits_new(struct dive *dive, struct divecomputer *entry = entry[-1]; \ entry->sec = _time; \ entry->depth = _depth; \ + entry->running_sum = (entry - 1)->running_sum + (_time - (entry - 1)->sec) * (_depth + (entry - 1)->depth) / 2; \ SENSOR_PRESSURE(entry) = 0; \ entry++; \ idx++ @@ -599,7 +600,7 @@ struct plot_data *populate_plot_entries(struct dive *dive, struct divecomputer * entry->sec = time; entry->depth = depth; - entry->running_sum = (entry - 1)->running_sum + (time - lasttime) * (depth + lastdepth) / 2; + entry->running_sum = (entry - 1)->running_sum + (time - (entry - 1)->sec) * (depth + (entry - 1)->depth) / 2; entry->stopdepth = sample->stopdepth.mm; entry->stoptime = sample->stoptime.seconds; entry->ndl = sample->ndl.seconds; |