From 47874037ea6b5242db62e8bd8393083d90c74594 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Sat, 18 Apr 2015 20:17:52 +0200 Subject: [PATCH] Disable gas change events except for the intial mix. For the IQ-700, the existing code for the active gas mix always results in an out-of-range gas mix index. The index of the active gas mix is probably stored in another bit. As a temporary workaround, we simply assume the active gas mix is always the first gas mix. This should already produce correct results for dives with only single gas mix. --- src/cressi_edy_parser.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cressi_edy_parser.c b/src/cressi_edy_parser.c index 0c4d143..e6661d1 100644 --- a/src/cressi_edy_parser.c +++ b/src/cressi_edy_parser.c @@ -217,8 +217,12 @@ cressi_edy_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t c // Current gasmix if (ngasmixes) { unsigned int idx = (data[offset + 0] & 0x60) >> 5; - if (idx >= ngasmixes) + if (parser->model == IQ700) + idx = 0; /* FIXME */ + if (idx >= ngasmixes) { + ERROR (abstract->context, "Invalid gas mix index."); return DC_STATUS_DATAFORMAT; + } if (idx != gasmix) { sample.event.type = SAMPLE_EVENT_GASCHANGE; sample.event.time = 0;