Aeris A300CS patches [V3]

Dirk Hohndel dirk at hohndel.org
Thu Oct 2 10:49:48 PDT 2014


And here is one more, this one detects how many cylinders the A300CS
thinks we used during a dive. This way no unused cylinders are reported
back to the downloading application.

/D

-------------- next part --------------
>From b98d836bd78e67e0471cdb13351f74ebb789eaed Mon Sep 17 00:00:00 2001
From: Dirk Hohndel <dirk at hohndel.org>
Date: Thu, 2 Oct 2014 10:47:57 -0700
Subject: [PATCH 6/6] Aeris A300CS: detect the number of cylinders used

The A300CS actually tells us how many of the cylinders it considers "in
use".

Signed-off-by: Dirk Hohndel <dirk at hohndel.org>
---
 src/oceanic_atom2_parser.c | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/src/oceanic_atom2_parser.c b/src/oceanic_atom2_parser.c
index 9e3f351aa2fd..baf137439a84 100644
--- a/src/oceanic_atom2_parser.c
+++ b/src/oceanic_atom2_parser.c
@@ -352,14 +352,33 @@ oceanic_atom2_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, uns
 				*((double *) value) = array_uint16_le (data + footer + 4) / 16.0 * FEET;
 			break;
 		case DC_FIELD_GASMIX_COUNT:
-			if (parser->model == DATAMASK || parser->model == COMPUMASK)
+			if (parser->model == DATAMASK || parser->model == COMPUMASK) {
 				*((unsigned int *) value) = 1;
-			else if (parser->model == VT4 || parser->model == VT41 || parser->model == OCI || parser->model == A300CS)
+			} else if (parser->model == VT4 || parser->model == VT41 || parser->model == OCI) {
 				*((unsigned int *) value) = 4;
-			else if (parser->model == TX1)
+			} else if (parser->model == TX1) {
 				*((unsigned int *) value) = 6;
-			else
+			} else if (parser->model == A300CS) {
+				switch(data[0x39] & 0x1C) {
+				case 0x04:
+				case 0x0C:
+				case 0x14:
+				case 0x1C:
+					*((unsigned int *) value) = 1;
+					break;
+				case 0x08:
+				case 0x18:
+					*((unsigned int *) value) = 2;
+					break;
+				case 0x10:
+					*((unsigned int *) value) = 3;
+					break;
+				default: /* 0x00 */
+					*((unsigned int *) value) = 4;
+				}
+			} else {
 				*((unsigned int *) value) = 3;
+			}
 			break;
 		case DC_FIELD_GASMIX:
 			if (parser->model == DATAMASK || parser->model == COMPUMASK) {
-- 
1.8.0.rc0.18.gf84667d



More information about the devel mailing list