diff options
author | Robert C. Helling <helling@atdotde.de> | 2014-12-12 14:30:13 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-12-17 08:05:02 -0800 |
commit | d67cce2af849209bd3222f7ee030b30c4686d666 (patch) | |
tree | dd4f51257262203137c6f8b7d915ca12ccdeeca5 /profile.c | |
parent | 8400776595f6865d6c84142fba5bf95f39fc0b7e (diff) | |
download | subsurface-d67cce2af849209bd3222f7ee030b30c4686d666.tar.gz |
Recording average depth data
This is the calculation that is needed to display a running average in the
profile.
It adds a new member plot_data.running_sum which can be turned into the
running average by dividing by plot_data.time.
Right now this isn't used by the UI.
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.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -597,6 +597,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->stopdepth = sample->stopdepth.mm; entry->stoptime = sample->stoptime.seconds; entry->ndl = sample->ndl.seconds; |