mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
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>
This commit is contained in:
parent
9a4cafd0f1
commit
4f17cd860f
1 changed files with 2 additions and 1 deletions
|
@ -523,6 +523,7 @@ struct plot_info calculate_max_limits_new(struct dive *dive, struct divecomputer
|
||||||
*entry = entry[-1]; \
|
*entry = entry[-1]; \
|
||||||
entry->sec = _time; \
|
entry->sec = _time; \
|
||||||
entry->depth = _depth; \
|
entry->depth = _depth; \
|
||||||
|
entry->running_sum = (entry - 1)->running_sum + (_time - (entry - 1)->sec) * (_depth + (entry - 1)->depth) / 2; \
|
||||||
SENSOR_PRESSURE(entry) = 0; \
|
SENSOR_PRESSURE(entry) = 0; \
|
||||||
entry++; \
|
entry++; \
|
||||||
idx++
|
idx++
|
||||||
|
@ -599,7 +600,7 @@ struct plot_data *populate_plot_entries(struct dive *dive, struct divecomputer *
|
||||||
entry->sec = time;
|
entry->sec = time;
|
||||||
entry->depth = depth;
|
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->stopdepth = sample->stopdepth.mm;
|
||||||
entry->stoptime = sample->stoptime.seconds;
|
entry->stoptime = sample->stoptime.seconds;
|
||||||
entry->ndl = sample->ndl.seconds;
|
entry->ndl = sample->ndl.seconds;
|
||||||
|
|
Loading…
Reference in a new issue