diff --git a/src/mares_iconhd.c b/src/mares_iconhd.c index 2a70be3..21f88fa 100644 --- a/src/mares_iconhd.c +++ b/src/mares_iconhd.c @@ -790,9 +790,15 @@ mares_iconhd_device_foreach_raw (dc_device_t *abstract, dc_dive_callback_t callb samplesize = 14; fingerprint = 0x40; } else if (model == SMARTAIR) { - headersize = 0x84; - samplesize = 12; - fingerprint = 2; + if (mode == FREEDIVE) { + headersize = 0x30; + samplesize = 6; + fingerprint = 0x22; + } else { + headersize = 0x84; + samplesize = 12; + fingerprint = 2; + } } if (offset < headersize) break; @@ -811,7 +817,7 @@ mares_iconhd_device_foreach_raw (dc_device_t *abstract, dc_dive_callback_t callb // end of the ringbuffer. The current dive is incomplete (partially // overwritten with newer data), and processing should stop. unsigned int nbytes = 4 + headersize + nsamples * samplesize; - if (model == ICONHDNET || model == QUADAIR || model == SMARTAIR) { + if (model == ICONHDNET || model == QUADAIR || (model == SMARTAIR && mode != FREEDIVE)) { nbytes += (nsamples / 4) * 8; } else if (model == SMARTAPNEA) { unsigned int settings = array_uint16_le (buffer + offset - headersize + 0x1C); diff --git a/src/mares_iconhd_parser.c b/src/mares_iconhd_parser.c index 917e44e..93cc5f2 100644 --- a/src/mares_iconhd_parser.c +++ b/src/mares_iconhd_parser.c @@ -228,6 +228,18 @@ static const mares_iconhd_layout_t smart_freedive = { UNSUPPORTED, /* tanks */ }; +static const mares_iconhd_layout_t smartair_freedive = { + 0x08, /* settings */ + 0x22, /* datetime */ + 0x0E, /* divetime */ + 0x1C, /* maxdepth */ + 0x1A, 1, /* atmospheric */ + 0x20, /* temperature_min */ + 0x1E, /* temperature_max */ + UNSUPPORTED, /* gasmixes */ + UNSUPPORTED, /* tanks */ +}; + static const mares_iconhd_layout_t genius = { 0x0C, /* settings */ 0x08, /* datetime */ @@ -338,7 +350,7 @@ mares_iconhd_cache (mares_iconhd_parser_t *parser) headersize = 0x80; samplesize = 12; layout = &iconhdnet; - } else if (parser->model == QUADAIR || parser->model == SMARTAIR) { + } else if (parser->model == QUADAIR) { headersize = 0x84; samplesize = 12; layout = &smartair; @@ -356,6 +368,16 @@ mares_iconhd_cache (mares_iconhd_parser_t *parser) headersize = 0x50; samplesize = 14; layout = &smartapnea; + } else if (parser->model == SMARTAIR) { + if (mode == ICONHD_FREEDIVE) { + headersize = 0x30; + samplesize = 6; + layout = &smartair_freedive; + } else { + headersize = 0x84; + samplesize = 12; + layout = &smartair; + } } if (length < 4 + headersize) {