From 5f13759b6f31ccbf483862e6042918648a267976 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Wed, 14 Nov 2012 09:28:17 +0100 Subject: [PATCH 1/9] Post release version bump to 0.2.1. --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 805f7fe..3b696d7 100644 --- a/configure.ac +++ b/configure.ac @@ -1,8 +1,8 @@ # Versioning. m4_define([dc_version_major],[0]) m4_define([dc_version_minor],[2]) -m4_define([dc_version_micro],[0]) -m4_define([dc_version_suffix],[]) +m4_define([dc_version_micro],[1]) +m4_define([dc_version_suffix],[devel]) m4_define([dc_version],dc_version_major.dc_version_minor.dc_version_micro[]m4_ifset([dc_version_suffix],-[dc_version_suffix])) # Libtool versioning. From b3df32da9d1bd220e99dbc401b5f2da617d7caa1 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Thu, 8 Nov 2012 14:28:50 +0100 Subject: [PATCH 2/9] Fix the parser for the Hollis DG03. The date/time value and the sign bit of the sample temperature were parsed incorrectly. --- src/oceanic_atom2_parser.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/oceanic_atom2_parser.c b/src/oceanic_atom2_parser.c index c0576ca..29636a0 100644 --- a/src/oceanic_atom2_parser.c +++ b/src/oceanic_atom2_parser.c @@ -47,6 +47,7 @@ #define VT4 0x4447 #define OC1B 0x4449 #define ATOM3 0x444C +#define DG03 0x444D #define OCS 0x4450 #define VT41 0x4452 #define ATOM31 0x4456 @@ -182,6 +183,7 @@ oceanic_atom2_parser_get_datetime (dc_parser_t *abstract, dc_datetime_t *datetim case VEO20: case VEO30: case GEO20: + case DG03: datetime->year = ((p[3] & 0xE0) >> 1) + (p[4] & 0x0F) + 2000; datetime->month = (p[4] & 0xF0) >> 4; datetime->day = p[3] & 0x1F; @@ -518,7 +520,9 @@ oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_ temperature = ((data[offset + 7] & 0xF0) >> 4) | ((data[offset + 7] & 0x0C) << 2) | ((data[offset + 5] & 0x0C) << 4); } else { unsigned int sign; - if (parser->model == ATOM2 || parser->model == EPIC || parser->model == PROPLUS21) + if (parser->model == DG03) + sign = (~data[offset + 5] & 0x04) >> 2; + else if (parser->model == ATOM2 || parser->model == EPIC || parser->model == PROPLUS21) sign = (data[offset + 0] & 0x80) >> 7; else sign = (~data[offset + 0] & 0x80) >> 7; From 328e929d4ba7a0b30c5944e2a0480533724f3c3e Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Sat, 17 Nov 2012 13:08:25 +0100 Subject: [PATCH 3/9] Add support for a second Aeris Epic variant. --- src/descriptor.c | 1 + src/oceanic_atom2.c | 6 ++++-- src/oceanic_atom2_parser.c | 8 +++++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/descriptor.c b/src/descriptor.c index 5a04025..bfce2b5 100644 --- a/src/descriptor.c +++ b/src/descriptor.c @@ -130,6 +130,7 @@ static const dc_descriptor_t g_descriptors[] = { {"Hollis", "DG03", DC_FAMILY_OCEANIC_ATOM2, 0x444D}, {"Oceanic", "OCS", DC_FAMILY_OCEANIC_ATOM2, 0x4450}, {"Oceanic", "VT 4.1", DC_FAMILY_OCEANIC_ATOM2, 0x4452}, + {"Aeris", "Epic", DC_FAMILY_OCEANIC_ATOM2, 0x4453}, {"Oceanic", "Atom 3.1", DC_FAMILY_OCEANIC_ATOM2, 0x4456}, {"Sherwood", "Wisdom 3", DC_FAMILY_OCEANIC_ATOM2, 0x4358}, /* Mares Nemo */ diff --git a/src/oceanic_atom2.c b/src/oceanic_atom2.c index 5e68fe7..8ecb042 100644 --- a/src/oceanic_atom2.c +++ b/src/oceanic_atom2.c @@ -66,7 +66,8 @@ static const device_backend_t oceanic_atom2_device_backend = { static const unsigned char aeris_manta_version[] = "MANTA R\0\0 512K"; static const unsigned char aeris_atmosai_version[] = "ATMOSAI R\0\0 512K"; -static const unsigned char aeris_epic_version[] = "2M EPIC r\0\0 512K"; +static const unsigned char aeris_epica_version[] = "2M EPIC r\0\0 512K"; +static const unsigned char aeris_epicb_version[] = "EPIC1 R\0\0 512K"; static const unsigned char aeris_f10_version[] = "FREEWAER \0\0 512K"; static const unsigned char oceanic_proplus2_version[] = "PROPLUS2 \0\0 512K"; static const unsigned char oceanic_atom1_version[] = "ATOM rev\0\0 256K"; @@ -399,7 +400,8 @@ oceanic_atom2_device_open (dc_device_t **out, dc_context_t *context, const char oceanic_common_match (tusa_element2_version, device->version, sizeof (device->version)) || oceanic_common_match (tusa_zen_version, device->version, sizeof (device->version))) device->base.layout = &oceanic_atom2b_layout; - else if (oceanic_common_match (aeris_epic_version, device->version, sizeof (device->version)) || + else if (oceanic_common_match (aeris_epica_version, device->version, sizeof (device->version)) || + oceanic_common_match (aeris_epicb_version, device->version, sizeof (device->version)) || oceanic_common_match (oceanic_atom2_version, device->version, sizeof (device->version))) device->base.layout = &oceanic_atom2c_layout; else if (oceanic_common_match (oceanic_veo1_version, device->version, sizeof (device->version))) diff --git a/src/oceanic_atom2_parser.c b/src/oceanic_atom2_parser.c index 29636a0..41318ec 100644 --- a/src/oceanic_atom2_parser.c +++ b/src/oceanic_atom2_parser.c @@ -30,7 +30,7 @@ #include "array.h" #define ATOM1 0x4250 -#define EPIC 0x4257 +#define EPICA 0x4257 #define VT3 0x4258 #define T3 0x4259 #define ATOM2 0x4342 @@ -50,6 +50,7 @@ #define DG03 0x444D #define OCS 0x4450 #define VT41 0x4452 +#define EPICB 0x4453 #define ATOM31 0x4456 typedef struct oceanic_atom2_parser_t oceanic_atom2_parser_t; @@ -482,7 +483,7 @@ oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_ } else { // Tank pressure (2 psi) and number (one based index) tank = (data[offset + 1] & 0x03) - 1; - if (parser->model == ATOM2 || parser->model == EPIC) + if (parser->model == ATOM2 || parser->model == EPICA || parser->model == EPICB) pressure = (((data[offset + 3] << 8) + data[offset + 4]) & 0x0FFF) * 2; else pressure = (((data[offset + 4] << 8) + data[offset + 5]) & 0x0FFF) * 2; @@ -522,7 +523,8 @@ oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_ unsigned int sign; if (parser->model == DG03) sign = (~data[offset + 5] & 0x04) >> 2; - else if (parser->model == ATOM2 || parser->model == EPIC || parser->model == PROPLUS21) + else if (parser->model == ATOM2 || parser->model == PROPLUS21 || + parser->model == EPICA || parser->model == EPICB) sign = (data[offset + 0] & 0x80) >> 7; else sign = (~data[offset + 0] & 0x80) >> 7; From ecb17c6fb6fff892d851a930324ad5ab988180e6 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 13 Nov 2012 11:25:18 -0800 Subject: [PATCH 4/9] Correct the OSTC depth calculation This now uses the same formula as the OSTC uses internally which will get the values reported by libdivecomputer to be consistent with what is displayed on the OSTC. Signed-off-by: Dirk Hohndel --- src/hw_ostc_parser.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hw_ostc_parser.c b/src/hw_ostc_parser.c index e0801f2..f86fed3 100644 --- a/src/hw_ostc_parser.c +++ b/src/hw_ostc_parser.c @@ -22,6 +22,7 @@ #include #include +#include "libdivecomputer/units.h" #include "context-private.h" #include "parser-private.h" @@ -307,7 +308,7 @@ hw_ostc_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t call // Depth (mbar). unsigned int depth = array_uint16_le (data + offset); - sample.depth = depth / 100.0; + sample.depth = (depth * BAR / 1000.0) / (GRAVITY * data[43] * 10.0); if (callback) callback (DC_SAMPLE_DEPTH, sample, userdata); offset += 2; From 3803e3c52d2f518b972e29749588f6bb0e2a7515 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Fri, 30 Nov 2012 09:33:39 +0100 Subject: [PATCH 5/9] Add support for a second Sherwood Insight variant. There appears to be two very different versions of the Sherwood Insight. The old Insight needs the veo250 backend, while the newer Insight 2 needs the atom2 backend. Currently only the newer version was included in the list of supported devices, and to increase the confusion it was even named after the old version. With this patch, the old version is added to the list, and the new version is renamed to "Insight 2". --- src/descriptor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/descriptor.c b/src/descriptor.c index bfce2b5..d43b24f 100644 --- a/src/descriptor.c +++ b/src/descriptor.c @@ -101,6 +101,7 @@ static const dc_descriptor_t g_descriptors[] = { {"Oceanic", "Veo 250", DC_FAMILY_OCEANIC_VEO250, 0x424C}, {"Oceanic", "Veo 180", DC_FAMILY_OCEANIC_VEO250, 0x4252}, {"Aeris", "XR-2", DC_FAMILY_OCEANIC_VEO250, 0x4255}, + {"Sherwood", "Insight", DC_FAMILY_OCEANIC_VEO250, 0x425A}, /* Oceanic Atom 2.0 */ {"Oceanic", "Atom 1.0", DC_FAMILY_OCEANIC_ATOM2, 0x4250}, {"Aeris", "Epic", DC_FAMILY_OCEANIC_ATOM2, 0x4257}, @@ -114,7 +115,7 @@ static const dc_descriptor_t g_descriptors[] = { {"Aeris", "F10", DC_FAMILY_OCEANIC_ATOM2, 0x434D}, {"Oceanic", "OC1", DC_FAMILY_OCEANIC_ATOM2, 0x434E}, {"Sherwood", "Wisdom 2", DC_FAMILY_OCEANIC_ATOM2, 0x4350}, - {"Sherwood", "Insight", DC_FAMILY_OCEANIC_ATOM2, 0x4353}, + {"Sherwood", "Insight 2", DC_FAMILY_OCEANIC_ATOM2, 0x4353}, {"Tusa", "Element II (IQ-750)", DC_FAMILY_OCEANIC_ATOM2, 0x4357}, {"Oceanic", "Veo 1.0", DC_FAMILY_OCEANIC_ATOM2, 0x4358}, {"Oceanic", "Veo 2.0", DC_FAMILY_OCEANIC_ATOM2, 0x4359}, From 9c3af57038b18f8bcfab74c8a3f09276330df338 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Sat, 1 Dec 2012 10:27:33 +0100 Subject: [PATCH 6/9] Fix a regression in the depth calculation. Apparently some older firmware versions don't support the salinity setting. Because unused bytes are initialized with zero, the salinity adjustment results in a division by zero, which converts all depth values to infinity. To fix this regression, the salinity factor is first checked for valid values. If the value is out of range, no salinity adjustment is done, and the previous behaviour is retained. --- src/hw_ostc_parser.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/hw_ostc_parser.c b/src/hw_ostc_parser.c index f86fed3..7588146 100644 --- a/src/hw_ostc_parser.c +++ b/src/hw_ostc_parser.c @@ -277,6 +277,12 @@ hw_ostc_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t call // Get the sample rate. unsigned int samplerate = data[36]; + // Get the salinity factor. + unsigned int salinity = data[43]; + if (salinity < 100 || salinity > 104) + salinity = 100; + double hydrostatic = GRAVITY * salinity * 10.0; + // Get the extended sample configuration. hw_ostc_sample_info_t info[NINFO]; for (unsigned int i = 0; i < NINFO; ++i) { @@ -308,7 +314,7 @@ hw_ostc_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t call // Depth (mbar). unsigned int depth = array_uint16_le (data + offset); - sample.depth = (depth * BAR / 1000.0) / (GRAVITY * data[43] * 10.0); + sample.depth = (depth * BAR / 1000.0) / hydrostatic; if (callback) callback (DC_SAMPLE_DEPTH, sample, userdata); offset += 2; From f65f808b6c8088e6d6c3704ee8e9854e37f390b8 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Wed, 12 Dec 2012 20:05:00 +0100 Subject: [PATCH 7/9] Add support for the Aeris A300 AI. --- src/descriptor.c | 1 + src/oceanic_atom2.c | 4 +++- src/oceanic_atom2_parser.c | 6 ++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/descriptor.c b/src/descriptor.c index d43b24f..2492527 100644 --- a/src/descriptor.c +++ b/src/descriptor.c @@ -133,6 +133,7 @@ static const dc_descriptor_t g_descriptors[] = { {"Oceanic", "VT 4.1", DC_FAMILY_OCEANIC_ATOM2, 0x4452}, {"Aeris", "Epic", DC_FAMILY_OCEANIC_ATOM2, 0x4453}, {"Oceanic", "Atom 3.1", DC_FAMILY_OCEANIC_ATOM2, 0x4456}, + {"Aeris", "A300 AI", DC_FAMILY_OCEANIC_ATOM2, 0x4457}, {"Sherwood", "Wisdom 3", DC_FAMILY_OCEANIC_ATOM2, 0x4358}, /* Mares Nemo */ {"Mares", "Nemo", DC_FAMILY_MARES_NEMO, 0}, diff --git a/src/oceanic_atom2.c b/src/oceanic_atom2.c index 8ecb042..03bfd3e 100644 --- a/src/oceanic_atom2.c +++ b/src/oceanic_atom2.c @@ -69,6 +69,7 @@ static const unsigned char aeris_atmosai_version[] = "ATMOSAI R\0\0 512K"; static const unsigned char aeris_epica_version[] = "2M EPIC r\0\0 512K"; static const unsigned char aeris_epicb_version[] = "EPIC1 R\0\0 512K"; static const unsigned char aeris_f10_version[] = "FREEWAER \0\0 512K"; +static const unsigned char aeris_a300ai_version[] = "AERISAIR \0\0 1024"; static const unsigned char oceanic_proplus2_version[] = "PROPLUS2 \0\0 512K"; static const unsigned char oceanic_atom1_version[] = "ATOM rev\0\0 256K"; static const unsigned char oceanic_atom2_version[] = "2M ATOM r\0\0 512K"; @@ -378,7 +379,8 @@ oceanic_atom2_device_open (dc_device_t **out, dc_context_t *context, const char oceanic_common_match (oceanic_atom3_version, device->version, sizeof (device->version)) || oceanic_common_match (oceanic_atom31_version, device->version, sizeof (device->version)) || oceanic_common_match (oceanic_vt4_version, device->version, sizeof (device->version)) || - oceanic_common_match (oceanic_vt41_version, device->version, sizeof (device->version))) + oceanic_common_match (oceanic_vt41_version, device->version, sizeof (device->version)) || + oceanic_common_match (aeris_a300ai_version, device->version, sizeof (device->version))) device->base.layout = &oceanic_oc1_layout; else if (oceanic_common_match (aeris_f10_version, device->version, sizeof (device->version))) device->base.layout = &aeris_f10_layout; diff --git a/src/oceanic_atom2_parser.c b/src/oceanic_atom2_parser.c index 41318ec..78dc981 100644 --- a/src/oceanic_atom2_parser.c +++ b/src/oceanic_atom2_parser.c @@ -52,6 +52,7 @@ #define VT41 0x4452 #define EPICB 0x4453 #define ATOM31 0x4456 +#define A300AI 0x4457 typedef struct oceanic_atom2_parser_t oceanic_atom2_parser_t; @@ -174,6 +175,7 @@ oceanic_atom2_parser_get_datetime (dc_parser_t *abstract, dc_datetime_t *datetim case VT41: case ATOM3: case ATOM31: + case A300AI: datetime->year = ((p[5] & 0xE0) >> 5) + ((p[7] & 0xE0) >> 2) + 2000; datetime->month = (p[3] & 0x0F); datetime->day = ((p[0] & 0x80) >> 3) + ((p[3] & 0xF0) >> 4); @@ -517,7 +519,7 @@ oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_ temperature = data[offset + 3]; } else if (parser->model == OCS) { temperature = data[offset + 1]; - } else if (parser->model == VT4 || parser->model == VT41 || parser->model == ATOM3 || parser->model == ATOM31) { + } else if (parser->model == VT4 || parser->model == VT41 || parser->model == ATOM3 || parser->model == ATOM31 || parser->model == A300AI) { temperature = ((data[offset + 7] & 0xF0) >> 4) | ((data[offset + 7] & 0x0C) << 2) | ((data[offset + 5] & 0x0C) << 4); } else { unsigned int sign; @@ -541,7 +543,7 @@ 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) + else if (parser->model == ZENAIR || parser->model == VT4 || parser->model == VT41|| parser->model == ATOM3 || parser->model == ATOM31 || parser->model == A300AI) pressure = (((data[offset + 0] & 0x03) << 8) + data[offset + 1]) * 5; else pressure -= data[offset + 1]; From 113d2e4706698f7086e5499282ec958aa2de044f Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Thu, 13 Dec 2012 19:47:43 +0100 Subject: [PATCH 8/9] Fix a redefinition warning for the ERROR macro. Apparantly, the windows wingdi.h header file already defines the ERROR macro. By defining the NOGDI macro before including the windows.h header file, we can prevent the wingdi.h file from being included and thus avoid the warning. We don't need that header for anything anyway. Because the libusb header file includes the windows.h file explicitly, it needs the same fix. --- src/atomics_cobalt.c | 3 +++ src/context.c | 1 + src/irda.c | 1 + src/serial_win32.c | 2 ++ 4 files changed, 7 insertions(+) diff --git a/src/atomics_cobalt.c b/src/atomics_cobalt.c index aa597fd..543a366 100644 --- a/src/atomics_cobalt.c +++ b/src/atomics_cobalt.c @@ -27,6 +27,9 @@ #include // malloc, free #ifdef HAVE_LIBUSB +#ifdef _WIN32 +#define NOGDI +#endif #include #endif diff --git a/src/context.c b/src/context.c index 0163a3c..344e4ee 100644 --- a/src/context.c +++ b/src/context.c @@ -25,6 +25,7 @@ #include #ifdef _WIN32 +#define NOGDI #include #endif diff --git a/src/irda.c b/src/irda.c index 476fa7e..4556256 100644 --- a/src/irda.c +++ b/src/irda.c @@ -22,6 +22,7 @@ #include // malloc, free #include // snprintf #ifdef _WIN32 + #define NOGDI #include #include #include diff --git a/src/serial_win32.c b/src/serial_win32.c index 4879c2d..fa4d00a 100644 --- a/src/serial_win32.c +++ b/src/serial_win32.c @@ -20,6 +20,8 @@ */ #include + +#define NOGDI #include #include "serial.h" From a046071ad00aeffc6bf0f8470764371e693c8624 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Fri, 21 Dec 2012 16:56:31 +0100 Subject: [PATCH 9/9] Fix a typo in the Sherwood Wisdom 3 model number. --- src/descriptor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/descriptor.c b/src/descriptor.c index 2492527..807f59f 100644 --- a/src/descriptor.c +++ b/src/descriptor.c @@ -134,7 +134,7 @@ static const dc_descriptor_t g_descriptors[] = { {"Aeris", "Epic", DC_FAMILY_OCEANIC_ATOM2, 0x4453}, {"Oceanic", "Atom 3.1", DC_FAMILY_OCEANIC_ATOM2, 0x4456}, {"Aeris", "A300 AI", DC_FAMILY_OCEANIC_ATOM2, 0x4457}, - {"Sherwood", "Wisdom 3", DC_FAMILY_OCEANIC_ATOM2, 0x4358}, + {"Sherwood", "Wisdom 3", DC_FAMILY_OCEANIC_ATOM2, 0x4458}, /* Mares Nemo */ {"Mares", "Nemo", DC_FAMILY_MARES_NEMO, 0}, {"Mares", "Nemo Excel", DC_FAMILY_MARES_NEMO, 17},