[PATCH] Set divemode to FREEDIVE now when we support that

Anton Lundin glance at acc.umu.se
Tue Jan 20 23:52:28 PST 2015


Previous code mapped all our free dive inputs to OC, but now when we
actually have a FREEDIVE divemode, we can do better.

Signed-off-by: Anton Lundin <glance at acc.umu.se>
---
 libdivecomputer.c | 2 ++
 parse-xml.c       | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/libdivecomputer.c b/libdivecomputer.c
index 41ec876..6a16eb1 100644
--- a/libdivecomputer.c
+++ b/libdivecomputer.c
@@ -552,6 +552,8 @@ static int dive_cb(const unsigned char *data, unsigned int size,
 	if (rc == DC_STATUS_SUCCESS)
 		switch(divemode) {
 		case DC_DIVEMODE_FREEDIVE:
+			dive->dc.divemode = FREEDIVE;
+			break;
 		case DC_DIVEMODE_GAUGE:
 		case DC_DIVEMODE_OC: /* Open circuit */
 			dive->dc.divemode = OC;
diff --git a/parse-xml.c b/parse-xml.c
index 92e470c..47b4fcc 100644
--- a/parse-xml.c
+++ b/parse-xml.c
@@ -2577,7 +2577,7 @@ int parse_dlf_buffer(unsigned char *buffer, size_t size)
 	else if (0xd8 <= ptr[15] && ptr[15] <= 0xdf)
 		cur_dc->divemode = CCR; // mCCR
 	else if (0xe0 <= ptr[15] && ptr[15] <= 0xe7)
-		cur_dc->divemode = OC; // Free diving
+		cur_dc->divemode = FREEDIVE;
 	else if (0xe8 <= ptr[15] && ptr[15] <= 0xef)
 		cur_dc->divemode = OC; // Gauge
 	else if (0xf0 <= ptr[15] && ptr[15] <= 0xf7)
-- 
2.1.0



More information about the subsurface mailing list