From 3d3b140b92b103809abd8d79ad421445dfdf0978 Mon Sep 17 00:00:00 2001
From: "Robert C. Helling" <helling@atdotde.de>
Date: Tue, 21 Oct 2014 20:26:30 +0200
Subject: [PATCH] Set the divetype to CCR when reading a setpoint

Signed-off-by: Robert C. Helling <helling@atdotde.de>
---
 parse-xml.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/parse-xml.c b/parse-xml.c
index e88c9b9..40bdb94 100644
--- a/parse-xml.c
+++ b/parse-xml.c
@@ -895,10 +895,14 @@ static void try_to_fill_sample(struct sample *sample, const char *name, char *bu
 		return;
 	if (MATCH("sensor3.sample", double_to_o2pressure, &sample->o2sensor[2])) // up to 3 CCR sensors
 		return;
-	if (MATCH("setpoint.sample", double_to_o2pressure, &sample->o2setpoint))
+    if (MATCH("setpoint.sample", double_to_o2pressure, &sample->o2setpoint)) {
+        cur_dive->dc.dctype = CCR;
 		return;
-	if (MATCH("po2.sample", double_to_o2pressure, &sample->po2))
+    }
+    if (MATCH("po2.sample", double_to_o2pressure, &sample->o2setpoint)) {
+        cur_dive->dc.dctype = CCR;
 		return;
+    }
 	if (MATCH("heartbeat", get_uint8, &sample->heartbeat))
 		return;
 	if (MATCH("bearing", get_bearing, &sample->bearing))
@@ -2029,8 +2033,10 @@ extern int shearwater_profile_sample(void *handle, int columns, char **data, cha
 		cur_sample->depth.mm = metric ? atof(data[1]) * 1000 : feet_to_mm(atof(data[1]));
 	if (data[2])
 		cur_sample->temperature.mkelvin = metric ? C_to_mkelvin(atof(data[2])) : F_to_mkelvin(atof(data[2]));
-	if (data[3])
-		cur_sample->po2.mbar = atof(data[3]) * 1000;
+    if (data[3]) {
+        cur_sample->o2setpoint.mbar = atof(data[3]) * 1000;
+        current_dive->dc.dctype = CCR;
+    }
 	if (data[4])
 		cur_sample->ndl.seconds = atoi(data[4]) * 60;
 	if (data[5])
-- 
1.9.3 (Apple Git-50)

