[PATCH 4/4] Divinglog import: update O2sensors and dive mode

Miika Turkia miika.turkia at gmail.com
Fri Jul 17 07:04:52 PDT 2015


This is my best guess, and I have no sample logs that would prove my
assumption.

Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
---
 parse-xml.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/parse-xml.c b/parse-xml.c
index 5c6af49..3d0c6a1 100644
--- a/parse-xml.c
+++ b/parse-xml.c
@@ -3006,6 +3006,20 @@ extern int divinglog_profile(void *handle, int columns, char **data, char **colu
 
 		}
 
+		/*
+		 * My best guess is that if we have o2sensors, then it
+		 * is either CCR or PSCR dive. And the first time we
+		 * have O2 sensor readings, we can count them to get
+		 * the amount O2 sensors.
+		 */
+
+		if (!cur_dive->dc.no_o2sensors) {
+			cur_dive->dc.no_o2sensors = cur_sample->o2sensor[0].mbar ? 1 : 0 +
+				 cur_sample->o2sensor[1].mbar ? 1 : 0 +
+				 cur_sample->o2sensor[2].mbar ? 1 : 0;
+			cur_dive->dc.divemode = CCR;
+		}
+
 		ptr += 12;
 		sample_end();
 	}
-- 
2.1.4



More information about the subsurface mailing list