summaryrefslogtreecommitdiffstats
path: root/dive.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2012-11-11 10:36:46 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-11-11 10:36:46 +0100
commit7c09991876ef8b34bda6f5615a37f99e1b476b18 (patch)
treecea814dea546805424406cc2f9525f5b287c6bf2 /dive.c
parent4c3dfee446eda061f862e1fdcce93b54a066feff (diff)
downloadsubsurface-7c09991876ef8b34bda6f5615a37f99e1b476b18.tar.gz
Trim the dive to exclude surface time at beginning and end
We don't change any of the samples, we just don't plot (or consider for dive time / mean calculations) the samples at the beginning or end of the dive that are less than a certain threshold under water. Right now that's an arbitrary 75cm which seems to Do The Right Thing(tm) for the dives I tried this with - but I'm happy to look at other values if this causes problems for people with dive computers I do not have access to. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.c')
-rw-r--r--dive.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/dive.c b/dive.c
index 65cfc4d53..384b8dcad 100644
--- a/dive.c
+++ b/dive.c
@@ -449,10 +449,10 @@ struct dive *fixup_dive(struct dive *dive)
lastindex = index;
lastpressure = pressure;
- if (lastdepth)
+ if (lastdepth > SURFACE_THRESHOLD)
end = time;
- if (depth) {
+ if (depth > SURFACE_THRESHOLD) {
if (start < 0)
start = lasttime;
if (depth > maxdepth)
@@ -479,6 +479,8 @@ struct dive *fixup_dive(struct dive *dive)
lastdepth = depth;
lasttime = time;
}
+ dive->start = start;
+ dive->end = end;
/* if all the samples for a cylinder have pressure data that
* is basically equidistant throw out the sample cylinder pressure
* information but make sure we still have a valid start and end