[PATCH 6/6] Cochran EMC: Removed EVENT_GASCHANGE code and replaced with SAMPLE_GASMIX.

John Van Ostrand john at vanostrand.com
Mon Jan 11 07:22:58 PST 2016


---
 src/cochran_commander_parser.c |  9 +++++++++
 src/cochran_commander_parser.h |  8 ++++----
 src/cochran_emc_parser.c       | 12 ++++++++++++
 3 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/src/cochran_commander_parser.c b/src/cochran_commander_parser.c
index bce3cad..da92995 100644
--- a/src/cochran_commander_parser.c
+++ b/src/cochran_commander_parser.c
@@ -208,6 +208,15 @@ cochran_commander_handle_event (dc_parser_t *abstract,
 			// Indicates to raise ceiling by 10 ft (shallower)
 			// Handled in calling function
 			break;
+		case 0xC0:	// Switched to FO2 21% mode (surface)
+			// Event seen upon surfacing
+			// handled in calling function
+			break;
+		case 0xCD:	// Switched to deco blend
+		case 0xEF:	// Switched to gas blend 2
+		case 0xF3:	// Switched to gas blend 1
+			// handled in calling function
+			break;
 		default:
 			// Don't send known events of type NONE
 			if (! event.type == SAMPLE_EVENT_NONE) {
diff --git a/src/cochran_commander_parser.h b/src/cochran_commander_parser.h
index 44340b5..06d5482 100644
--- a/src/cochran_commander_parser.h
+++ b/src/cochran_commander_parser.h
@@ -39,7 +39,7 @@ static cochran_events_t cochran_events[] = {
 	{ 0xBD, 1, "Switched to nomal PO2 setting",
 					SAMPLE_EVENT_NONE,				SAMPLE_FLAGS_NONE },
 	{ 0xC0, 1, "Switched to FO2 21% mode",
-					SAMPLE_EVENT_GASCHANGE,			SAMPLE_FLAGS_NONE },
+					SAMPLE_EVENT_NONE,				SAMPLE_FLAGS_NONE },
 	{ 0xC1, 1, "Ascent rate greater than limit",
 					SAMPLE_EVENT_ASCENT,			SAMPLE_FLAGS_BEGIN },
 	{ 0xC2, 1, "Low battery warning",
@@ -57,7 +57,7 @@ static cochran_events_t cochran_events[] = {
 	{ 0xCE, 1, "Non-decompression warning",
 					SAMPLE_EVENT_RBT,				SAMPLE_FLAGS_BEGIN },
 	{ 0xCD, 1, "Switched to deco blend",
-					SAMPLE_EVENT_NONE,				SAMPLE_FLAGS_BEGIN },
+					SAMPLE_EVENT_NONE,				SAMPLE_FLAGS_NONE },
 	{ 0xD0, 1, "Breathing rate alarm",
 					SAMPLE_EVENT_NONE,				SAMPLE_FLAGS_BEGIN },
 	{ 0xD3, 1, "Low gas 1 flow rate",
@@ -77,11 +77,11 @@ static cochran_events_t cochran_events[] = {
 	{ 0xEE, 1, "End non-decompresison warning",
 					SAMPLE_EVENT_RBT,				SAMPLE_FLAGS_END },
 	{ 0xEF, 1, "Switch to blend 2",
-					SAMPLE_EVENT_GASCHANGE2,		SAMPLE_FLAGS_NONE },
+					SAMPLE_EVENT_NONE,				SAMPLE_FLAGS_NONE },
 	{ 0xF0, 1, "Breathing rate alarm",
 					SAMPLE_EVENT_NONE,				SAMPLE_FLAGS_END },
 	{ 0xF3, 1, "Switch to blend 1",
-					SAMPLE_EVENT_GASCHANGE2,		SAMPLE_FLAGS_NONE },
+					SAMPLE_EVENT_NONE,				SAMPLE_FLAGS_NONE },
 	{ 0xF6, 1, "End Depth is less than ceiling",
 					SAMPLE_EVENT_CEILING,			SAMPLE_FLAGS_END },
 	{ 0x00, 1, NULL,
diff --git a/src/cochran_emc_parser.c b/src/cochran_emc_parser.c
index 5d430f4..884f8aa 100644
--- a/src/cochran_emc_parser.c
+++ b/src/cochran_emc_parser.c
@@ -232,6 +232,18 @@ cochran_emc_parser_samples_foreach (dc_parser_t *abstract,
 				sample.deco.time = (array_uint16_le(s + 3) + 1) * 60;
 				if (callback) callback(DC_SAMPLE_DECO, sample, userdata);
 				break;
+			case 0xC0:  // Switched to FO2 21% mode (surface)
+				// Event seen upon surfacing
+				break;
+			case 0xCD:  // Switched to deco blend
+			case 0xEF:  // Switched to gas blend 2
+				sample.gasmix = 1;
+				if (callback) callback(DC_SAMPLE_GASMIX, sample, userdata);
+				break;
+			case 0xF3:  // Switched to gas blend 1
+				sample.gasmix = 0;
+				if (callback) callback(DC_SAMPLE_GASMIX, sample, userdata);
+				break;
 			}
 
 			continue;
-- 
2.4.3



More information about the devel mailing list