From 3287e3bd5de82caa2edfee6fa3c8c49c2f07e8c2 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Thu, 14 Feb 2019 22:15:46 +0100 Subject: [PATCH] Update the list of the Ratio dive computers There were quite a few models missing in the list. And because the lowest iX3M model number has changed, the iX3M detection needed to be updated as well. --- src/descriptor.c | 14 +++++++++++++- src/divesystem_idive.c | 9 +++------ src/divesystem_idive_parser.c | 13 +++++-------- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/descriptor.c b/src/descriptor.c index 1c533db..545dcf7 100644 --- a/src/descriptor.c +++ b/src/descriptor.c @@ -313,20 +313,32 @@ static const dc_descriptor_t g_descriptors[] = { {"DiveSystem", "iDive Easy", DC_FAMILY_DIVESYSTEM_IDIVE, 0x09, DC_TRANSPORT_SERIAL, NULL}, {"DiveSystem", "iDive X3M", DC_FAMILY_DIVESYSTEM_IDIVE, 0x0A, DC_TRANSPORT_SERIAL, NULL}, {"DiveSystem", "iDive Deep", DC_FAMILY_DIVESYSTEM_IDIVE, 0x0B, DC_TRANSPORT_SERIAL, NULL}, + {"Ratio", "iX3M Pro ", DC_FAMILY_DIVESYSTEM_IDIVE, 0x21, DC_TRANSPORT_SERIAL, NULL}, {"Ratio", "iX3M Easy", DC_FAMILY_DIVESYSTEM_IDIVE, 0x22, DC_TRANSPORT_SERIAL, NULL}, {"Ratio", "iX3M Deep", DC_FAMILY_DIVESYSTEM_IDIVE, 0x23, DC_TRANSPORT_SERIAL, NULL}, {"Ratio", "iX3M Tech+", DC_FAMILY_DIVESYSTEM_IDIVE, 0x24, DC_TRANSPORT_SERIAL, NULL}, {"Ratio", "iX3M Reb", DC_FAMILY_DIVESYSTEM_IDIVE, 0x25, DC_TRANSPORT_SERIAL, NULL}, + {"Ratio", "iX3M Fancy", DC_FAMILY_DIVESYSTEM_IDIVE, 0x26, DC_TRANSPORT_SERIAL, NULL}, + {"Ratio", "iX3M Pro Fancy",DC_FAMILY_DIVESYSTEM_IDIVE, 0x31, DC_TRANSPORT_SERIAL, NULL}, {"Ratio", "iX3M Pro Easy", DC_FAMILY_DIVESYSTEM_IDIVE, 0x32, DC_TRANSPORT_SERIAL, NULL}, + {"Ratio", "iX3M Pro Pro", DC_FAMILY_DIVESYSTEM_IDIVE, 0x33, DC_TRANSPORT_SERIAL, NULL}, {"Ratio", "iX3M Pro Deep", DC_FAMILY_DIVESYSTEM_IDIVE, 0x34, DC_TRANSPORT_SERIAL, NULL}, {"Ratio", "iX3M Pro Tech+",DC_FAMILY_DIVESYSTEM_IDIVE, 0x35, DC_TRANSPORT_SERIAL, NULL}, + {"Ratio", "iX3M Pro Reb", DC_FAMILY_DIVESYSTEM_IDIVE, 0x36, DC_TRANSPORT_SERIAL, NULL}, {"Ratio", "iDive Free", DC_FAMILY_DIVESYSTEM_IDIVE, 0x40, DC_TRANSPORT_SERIAL, NULL}, + {"Ratio", "iDive Fancy", DC_FAMILY_DIVESYSTEM_IDIVE, 0x41, DC_TRANSPORT_SERIAL, NULL}, {"Ratio", "iDive Easy", DC_FAMILY_DIVESYSTEM_IDIVE, 0x42, DC_TRANSPORT_SERIAL, NULL}, + {"Ratio", "iDive Pro", DC_FAMILY_DIVESYSTEM_IDIVE, 0x43, DC_TRANSPORT_SERIAL, NULL}, {"Ratio", "iDive Deep", DC_FAMILY_DIVESYSTEM_IDIVE, 0x44, DC_TRANSPORT_SERIAL, NULL}, {"Ratio", "iDive Tech+", DC_FAMILY_DIVESYSTEM_IDIVE, 0x45, DC_TRANSPORT_SERIAL, NULL}, + {"Ratio", "iDive Reb", DC_FAMILY_DIVESYSTEM_IDIVE, 0x46, DC_TRANSPORT_SERIAL, NULL}, + {"Ratio", "iDive Color Free", DC_FAMILY_DIVESYSTEM_IDIVE, 0x50, DC_TRANSPORT_SERIAL, NULL}, + {"Ratio", "iDive Color Fancy",DC_FAMILY_DIVESYSTEM_IDIVE, 0x51, DC_TRANSPORT_SERIAL, NULL}, {"Ratio", "iDive Color Easy", DC_FAMILY_DIVESYSTEM_IDIVE, 0x52, DC_TRANSPORT_SERIAL, NULL}, + {"Ratio", "iDive Color Pro", DC_FAMILY_DIVESYSTEM_IDIVE, 0x53, DC_TRANSPORT_SERIAL, NULL}, {"Ratio", "iDive Color Deep", DC_FAMILY_DIVESYSTEM_IDIVE, 0x54, DC_TRANSPORT_SERIAL, NULL}, - {"Ratio", "iDive Color Tech", DC_FAMILY_DIVESYSTEM_IDIVE, 0x55, DC_TRANSPORT_SERIAL, NULL}, + {"Ratio", "iDive Color Tech+",DC_FAMILY_DIVESYSTEM_IDIVE, 0x55, DC_TRANSPORT_SERIAL, NULL}, + {"Ratio", "iDive Color Reb", DC_FAMILY_DIVESYSTEM_IDIVE, 0x56, DC_TRANSPORT_SERIAL, NULL}, {"Seac", "Jack", DC_FAMILY_DIVESYSTEM_IDIVE, 0x1000, DC_TRANSPORT_SERIAL, NULL}, {"Seac", "Guru", DC_FAMILY_DIVESYSTEM_IDIVE, 0x1002, DC_TRANSPORT_SERIAL, NULL}, /* Cochran Commander */ diff --git a/src/divesystem_idive.c b/src/divesystem_idive.c index f827b52..2303186 100644 --- a/src/divesystem_idive.c +++ b/src/divesystem_idive.c @@ -30,10 +30,7 @@ #define ISINSTANCE(device) dc_device_isinstance((device), &divesystem_idive_device_vtable) -#define IX3M_EASY 0x22 -#define IX3M_DEEP 0x23 -#define IX3M_TEC 0x24 -#define IX3M_REB 0x25 +#define ISIX3M(model) ((model) >= 0x21) #define MAXRETRIES 9 @@ -374,7 +371,7 @@ divesystem_idive_device_foreach (dc_device_t *abstract, dc_dive_callback_t callb unsigned int errcode = 0; const divesystem_idive_commands_t *commands = &idive; - if (device->model >= IX3M_EASY) { + if (ISIX3M(device->model)) { commands = &ix3m; } @@ -400,7 +397,7 @@ divesystem_idive_device_foreach (dc_device_t *abstract, dc_dive_callback_t callb vendor.size = commands->id.size; device_event_emit (abstract, DC_EVENT_VENDOR, &vendor); - if (device->model >= IX3M_EASY) { + if (ISIX3M(device->model)) { // Detect the APOS4 firmware. unsigned int apos4 = (devinfo.firmware / 10000000) >= 4; if (apos4) { diff --git a/src/divesystem_idive_parser.c b/src/divesystem_idive_parser.c index adfb48a..66f77dc 100644 --- a/src/divesystem_idive_parser.c +++ b/src/divesystem_idive_parser.c @@ -30,10 +30,7 @@ #define ISINSTANCE(parser) dc_device_isinstance((parser), &divesystem_idive_parser_vtable) -#define IX3M_EASY 0x22 -#define IX3M_DEEP 0x23 -#define IX3M_TEC 0x24 -#define IX3M_REB 0x25 +#define ISIX3M(model) ((model) >= 0x21) #define SZ_HEADER_IDIVE 0x32 #define SZ_SAMPLE_IDIVE 0x2A @@ -103,7 +100,7 @@ divesystem_idive_parser_create (dc_parser_t **out, dc_context_t *context, unsign // Set the default values. parser->model = model; - if (model >= IX3M_EASY) { + if (ISIX3M(model)) { parser->headersize = SZ_HEADER_IX3M; } else { parser->headersize = SZ_HEADER_IDIVE; @@ -206,7 +203,7 @@ divesystem_idive_parser_get_datetime (dc_parser_t *abstract, dc_datetime_t *date // Detect the APOS4 firmware. unsigned int firmware = 0; unsigned int apos4 = 0; - if (parser->model >= IX3M_EASY) { + if (ISIX3M(parser->model)) { firmware = array_uint32_le(abstract->data + 0x2A); apos4 = (firmware / 10000000) >= 4; } else { @@ -297,7 +294,7 @@ divesystem_idive_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, tank->gasmix = DC_GASMIX_UNKNOWN; break; case DC_FIELD_ATMOSPHERIC: - if (parser->model >= IX3M_EASY) { + if (ISIX3M(parser->model)) { *((double *) value) = array_uint16_le (data + 11) / 10000.0; } else { *((double *) value) = array_uint16_le (data + 11) / 1000.0; @@ -363,7 +360,7 @@ divesystem_idive_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callba unsigned int apos4 = 0; unsigned int nsamples = array_uint16_le (data + 1); unsigned int samplesize = SZ_SAMPLE_IDIVE; - if (parser->model >= IX3M_EASY) { + if (ISIX3M(parser->model)) { // Detect the APOS4 firmware. firmware = array_uint32_le(data + 0x2A); apos4 = (firmware / 10000000) >= 4;