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>
This commit is contained in:
Robert C. Helling 2014-12-12 14:30:13 +01:00 committed by Dirk Hohndel
parent 8400776595
commit d67cce2af8
2 changed files with 2 additions and 0 deletions

View file

@ -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;