summaryrefslogtreecommitdiffstats
path: root/dive.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2015-09-27 22:26:03 -0400
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-09-27 22:53:43 -0400
commit2c0123c6772dcabd05156f3d2533267f4676ebde (patch)
tree8de5450eec7f84caec42e6abf623550019537b3d /dive.c
parentcbf29653d7e9d92660295c7c5ffbbdbaba1886fb (diff)
downloadsubsurface-2c0123c6772dcabd05156f3d2533267f4676ebde.tar.gz
Don't use surface sample data for cylinder beginning/end
pressure At the beginning of the dive, let the cylinder cool down if the diver starts off at the surface. And at the end of the dive, there may be surface pressures where the diver has already turned off the air supply (especially for computers like the Uemis Zurich that end up saving quite a bit of samples after the dive has ended). So just don't use surface samples to populate the beginning/ending cylinder pressure data. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.c')
-rw-r--r--dive.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/dive.c b/dive.c
index 0248888a3..9c70a121c 100644
--- a/dive.c
+++ b/dive.c
@@ -800,6 +800,19 @@ static void fixup_pressure(struct dive *dive, struct sample *sample, enum cylind
if (!pressure)
return;
+ /*
+ * Ignore surface samples for tank pressure information.
+ *
+ * At the beginning of the dive, let the cylinder cool down
+ * if the diver starts off at the surface. And at the end
+ * of the dive, there may be surface pressures where the
+ * diver has already turned off the air supply (especially
+ * for computers like the Uemis Zurich that end up saving
+ * quite a bit of samples after the dive has ended).
+ */
+ if (sample->depth.mm < SURFACE_THRESHOLD)
+ return;
+
/* FIXME! sensor -> cylinder mapping? */
if (index >= MAX_CYLINDERS)
return;