[PATCH] Don't use surface sample data for cylinder beginning/end pressure

Linus Torvalds torvalds at linux-foundation.org
Sun Sep 27 19:30:49 PDT 2015


From: Linus Torvalds <torvalds at linux-foundation.org>
Date: Sun, 27 Sep 2015 22:26:03 -0400
Subject: [PATCH] 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 at linux-foundation.org>
---

This trivial patch fixes the equipment info (and SAC rate calculation) 
for me.

 dive.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/dive.c b/dive.c
index 0248888a3c47..9c70a121cc57 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;
-- 
2.4.2.387.gf86f31a



More information about the subsurface mailing list