[PATCH 1/2] Do not zero setpoint value when duplicate

Miika Turkia miika.turkia at gmail.com
Mon Oct 27 09:19:53 PDT 2014


We cannot zero setpoint value upon import if the current and previous
values are zero. This is because on setpoint context a value of 0 means
open circuit.

Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
---
 dive.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/dive.c b/dive.c
index 92637fe..9395c93 100644
--- a/dive.c
+++ b/dive.c
@@ -1092,7 +1092,7 @@ static void fixup_dive_dc(struct dive *dive, struct divecomputer *dc)
 	int maxdepth = dc->maxdepth.mm;
 	int mintemp = 0;
 	int lastdepth = 0;
-	int lasto2val[3] = { 0, 0, 0 }, lasto2setpoint = 0;
+	int lasto2val[3] = { 0, 0, 0 };
 	int lasttemp = 0, lastpressure = 0, lastdiluentpressure = 0;
 	int pressure_delta[MAX_CYLINDERS] = { INT_MAX, };
 
@@ -1166,15 +1166,6 @@ static void fixup_dive_dc(struct dive *dive, struct divecomputer *dc)
 			}
 		}
 
-		// If there are consecutive identical CCR O2 setpoint readings, throw away the redundant ones.
-		o2val = sample->setpoint.mbar;
-		if (o2val) {
-			if (lasto2setpoint == o2val)
-				sample->setpoint.mbar = 0;
-			else
-				lasto2setpoint = o2val;
-		}
-
 		update_min_max_temperatures(dive, sample->temperature);
 
 		depthtime += (time - lasttime) * (lastdepth + depth) / 2;
-- 
1.9.1



More information about the subsurface mailing list