From f836e6a0252993f2594a4fbd03b229602725b6f0 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Wed, 19 Feb 2014 14:22:31 +0100 Subject: [PATCH 1/2] Add support for the Cressi Giotto. The communication protocol and memory layout of the Cressi Giotto appears to be identical to that of the Leonardo. The first byte seems to be the model number, with 0x01 for the Leonardo and 0x04 for the Giotto. --- src/cressi_leonardo.c | 2 +- src/descriptor.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cressi_leonardo.c b/src/cressi_leonardo.c index e18b496..3a69e9a 100644 --- a/src/cressi_leonardo.c +++ b/src/cressi_leonardo.c @@ -273,7 +273,7 @@ cressi_leonardo_device_foreach (dc_device_t *abstract, dc_dive_callback_t callba unsigned char *data = dc_buffer_get_data (buffer); dc_event_devinfo_t devinfo; - devinfo.model = 0; + devinfo.model = data[0]; devinfo.firmware = 0; devinfo.serial = array_uint32_le (data + 1); device_event_emit (abstract, DC_EVENT_DEVINFO, &devinfo); diff --git a/src/descriptor.c b/src/descriptor.c index 1340d65..aa8d0e1 100644 --- a/src/descriptor.c +++ b/src/descriptor.c @@ -200,7 +200,8 @@ static const dc_descriptor_t g_descriptors[] = { /* Cressi Edy */ {"Cressi", "Edy", DC_FAMILY_CRESSI_EDY, 0}, /* Cressi Leonardo */ - {"Cressi", "Leonardo", DC_FAMILY_CRESSI_LEONARDO, 0}, + {"Cressi", "Leonardo", DC_FAMILY_CRESSI_LEONARDO, 1}, + {"Cressi", "Giotto", DC_FAMILY_CRESSI_LEONARDO, 4}, /* Zeagle N2iTiON3 */ {"Zeagle", "N2iTiON3", DC_FAMILY_ZEAGLE_N2ITION3, 0}, {"Apeks", "Quantum X", DC_FAMILY_ZEAGLE_N2ITION3, 0}, From 2064c3d41050f15bca151ecbf1667733d25eb286 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Wed, 19 Feb 2014 14:24:52 +0100 Subject: [PATCH 2/2] Fix the parsing of the serial number. The serial number appears to be either a 24 or a 16 bit number, but certainly not a 32bit number. Whether it's 24 or 16 bit is hard to tell because the data we have available always contains a zero value in the third byte. --- src/cressi_leonardo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cressi_leonardo.c b/src/cressi_leonardo.c index 3a69e9a..b295098 100644 --- a/src/cressi_leonardo.c +++ b/src/cressi_leonardo.c @@ -275,7 +275,7 @@ cressi_leonardo_device_foreach (dc_device_t *abstract, dc_dive_callback_t callba dc_event_devinfo_t devinfo; devinfo.model = data[0]; devinfo.firmware = 0; - devinfo.serial = array_uint32_le (data + 1); + devinfo.serial = array_uint24_le (data + 1); device_event_emit (abstract, DC_EVENT_DEVINFO, &devinfo); rc = cressi_leonardo_extract_dives (abstract, dc_buffer_get_data (buffer),