[PATCH] Predator: don't report PPO2 unless in CC mode

Dirk Hohndel dirk at hohndel.org
Sat Feb 7 10:28:33 PST 2015


Sending this in OC mode is redundant and might confuse applications that
assume they only get PPO2 data in CC mode.

Signed-off-by: Dirk Hohndel <dirk at hohndel.org>
---
 src/shearwater_predator_parser.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/shearwater_predator_parser.c b/src/shearwater_predator_parser.c
index 32200f1ef552..eac3a3b21fe7 100644
--- a/src/shearwater_predator_parser.c
+++ b/src/shearwater_predator_parser.c
@@ -325,9 +325,11 @@ shearwater_predator_parser_samples_foreach (dc_parser_t *abstract, dc_sample_cal
 			sample.temperature = temperature;
 		if (callback) callback (DC_SAMPLE_TEMPERATURE, sample, userdata);
 
-		// PPO2
-		sample.ppo2 = data[offset + 6] / 100.0;
-		if (callback) callback (DC_SAMPLE_PPO2, sample, userdata);
+		// PPO2 -- only return PPO2 if we are in closed circuit mode
+		if (data[offset + 11] & 0x10 == 0) {
+			sample.ppo2 = data[offset + 6] / 100.0;
+			if (callback) callback (DC_SAMPLE_PPO2, sample, userdata);
+		}
 
 		// Gaschange.
 		unsigned int o2 = data[offset + 7];
-- 
1.8.0.rc0.18.gf84667d



More information about the devel mailing list