[PATCH] Cleanup and correct CCR detection

Anton Lundin glance at acc.umu.se
Wed Oct 14 11:10:29 PDT 2015


== has precedence over & and would have needed some parenthesis.

Instead of that, this moves that code into the block below which
already contains a correct CCR check.

Signed-off-by: Anton Lundin <glance at acc.umu.se>
---
 src/shearwater_predator_parser.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/shearwater_predator_parser.c b/src/shearwater_predator_parser.c
index 81c7ba5..bcbd95b 100644
--- a/src/shearwater_predator_parser.c
+++ b/src/shearwater_predator_parser.c
@@ -487,13 +487,11 @@ shearwater_predator_parser_samples_foreach (dc_parser_t *abstract, dc_sample_cal
 		// Status flags.
 		unsigned int status = data[offset + 11];
 
-		// PPO2 -- only return PPO2 if we are in closed circuit mode
-		if (data[offset + 11] & 0x10 == 0) {
+		if ((status & OC) == 0) {
+			// PPO2 -- only return PPO2 if we are in closed circuit mode
 			sample.ppo2 = data[offset + 6] / 100.0;
 			if (callback) callback (DC_SAMPLE_PPO2, sample, userdata);
-		}
 
-		if ((status & OC) == 0) {
 			// Setpoint
 			if (parser->petrel) {
 				sample.setpoint = data[offset + 18] / 100.0;
-- 
2.1.4



More information about the subsurface mailing list