From 633e8423dc337e440cec563426fe0e510571c325 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Sun, 23 Dec 2012 12:48:49 +0100 Subject: [PATCH 1/4] Add a small delay before retrying a packet. If the first attempt fails, that might indicate the device isn't ready yet to service requests. In that case immediately retrying again isn't the right solution. Adding a small delay seems to increase the success rate, so it's a good idea anyway, regardless of the underlying reason. --- src/mares_common.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mares_common.c b/src/mares_common.c index 419b09a..6e79ae2 100644 --- a/src/mares_common.c +++ b/src/mares_common.c @@ -201,6 +201,7 @@ mares_common_transfer (mares_common_device_t *device, const unsigned char comman return rc; // Discard any garbage bytes. + serial_sleep (device->port, 100); serial_flush (device->port, SERIAL_QUEUE_INPUT); } From 173390ed0556b039a1d5cefa59160a7d1d1ba46a Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Sun, 6 Jan 2013 08:05:02 +0100 Subject: [PATCH 2/4] Decode the serial number as a 32 bit number. Apparantly there are also two different type of serial numbers present, and their interpretation depends on the application. The Windows Dive Organizer application shows both a serial number (byte offset 0x04) and a warranty number (byte offset 0x0C). However, the Mac OS X Divers' Diary application shows the number at byte offset 0x0C as the serial number. Very confusing. For now, we just stick to the number at byte offset 0x0C, because that's the number that is shown by the device itself. --- src/mares_iconhd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mares_iconhd.c b/src/mares_iconhd.c index 05b2ef7..d5035da 100644 --- a/src/mares_iconhd.c +++ b/src/mares_iconhd.c @@ -364,7 +364,7 @@ mares_iconhd_device_foreach (dc_device_t *abstract, dc_dive_callback_t callback, dc_event_devinfo_t devinfo; devinfo.model = mares_iconhd_get_model (device, data[0]); devinfo.firmware = 0; - devinfo.serial = array_uint16_le (data + 12); + devinfo.serial = array_uint32_le (data + 0x0C); device_event_emit (abstract, DC_EVENT_DEVINFO, &devinfo); rc = mares_iconhd_extract_dives (abstract, dc_buffer_get_data (buffer), From 7669157a6bdd520bbe4be2391383205c53e82644 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Fri, 11 Jan 2013 13:03:59 +0100 Subject: [PATCH 3/4] Fix the unit conversion for the max depth. The max depth is stored in imperial units (feet), and should be converted into metric units (meter). But for some reason this unit conversion was omitted. --- src/oceanic_vtpro_parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/oceanic_vtpro_parser.c b/src/oceanic_vtpro_parser.c index 4eac78f..08a4b90 100644 --- a/src/oceanic_vtpro_parser.c +++ b/src/oceanic_vtpro_parser.c @@ -186,7 +186,7 @@ oceanic_vtpro_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, uns *((unsigned int *) value) = parser->divetime; break; case DC_FIELD_MAXDEPTH: - *((double *) value) = (data[footer + 0] + ((data[footer + 1] & 0x0F) << 8)) * 1; + *((double *) value) = (data[footer + 0] + ((data[footer + 1] & 0x0F) << 8)) * FEET; break; case DC_FIELD_GASMIX_COUNT: *((unsigned int *) value) = 1; From 154fc82da1f249674cd1e3dd55b8aa0650eb7b2d Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Mon, 21 Jan 2013 22:55:28 +0100 Subject: [PATCH 4/4] Fix the tank pressure decoding for the Hollis DG03. --- src/oceanic_atom2_parser.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/oceanic_atom2_parser.c b/src/oceanic_atom2_parser.c index 78dc981..01225e7 100644 --- a/src/oceanic_atom2_parser.c +++ b/src/oceanic_atom2_parser.c @@ -543,7 +543,10 @@ oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_ if (have_pressure) { if (parser->model == OC1A || parser->model == OC1B) pressure = (data[offset + 10] + (data[offset + 11] << 8)) & 0x0FFF; - else if (parser->model == ZENAIR || parser->model == VT4 || parser->model == VT41|| parser->model == ATOM3 || parser->model == ATOM31 || parser->model == A300AI) + else if (parser->model == VT4 || parser->model == VT41|| + parser->model == ATOM3 || parser->model == ATOM31 || + parser->model == ZENAIR ||parser->model == A300AI || + parser->model == DG03) pressure = (((data[offset + 0] & 0x03) << 8) + data[offset + 1]) * 5; else pressure -= data[offset + 1];