summaryrefslogtreecommitdiffstats
path: root/profile.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2013-02-04 16:21:33 +1100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-02-04 06:48:34 +1100
commitf507b05927fccc228951c6aa06df1f2a4a01de0a (patch)
tree52f964dd47e2e4f596e1dcdf38fc564be5bfd742 /profile.c
parent91ba78f8ac40f02d7161e5f82644557279f3c92b (diff)
downloadsubsurface-f507b05927fccc228951c6aa06df1f2a4a01de0a.tar.gz
Get rid of dive->{start,end}
We had this special logic to not show the end of a dive when a dive computer shows a series of very shallow samples (basically snorkeling back to shore after the dive ended). However, that logic ended up being global per dive, which is very annoying when you have two or more dive computers, and it decides to cut off the second one because the first one surfaces. So get rid of this per-dive state, and just use the plot-info 'maxtime' field for this (we never used the 'start' case anyway). That way we will properly cut off boring surface entries only when they are past the end of the interesting entries of *all* dive computers, and we won't be cutting things short. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'profile.c')
-rw-r--r--profile.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/profile.c b/profile.c
index 123f25479..f81d4aba3 100644
--- a/profile.c
+++ b/profile.c
@@ -1577,7 +1577,8 @@ static void calculate_max_limits(struct dive *dive, struct divecomputer *dc, str
if (depth > maxdepth)
maxdepth = s->depth.mm;
- if ((depth || lastdepth) && s->time.seconds > maxtime)
+ if ((depth > SURFACE_THRESHOLD || lastdepth > SURFACE_THRESHOLD) &&
+ s->time.seconds > maxtime)
maxtime = s->time.seconds;
lastdepth = depth;
s++;
@@ -1601,9 +1602,7 @@ static struct plot_data *populate_plot_entries(struct dive *dive, struct divecom
int lastdepth, lasttime;
struct plot_data *plot_data;
- maxtime = get_maxtime(pi);
- if (dive->end > 0)
- maxtime = dive->end;
+ maxtime = pi->maxtime;
/*
* We want to have a plot_info event at least every 10s (so "maxtime/10+1"),