From 3cb29abfaa90d0ebf89bb72af510a845f443e620 Mon Sep 17 00:00:00 2001 From: Janice Date: Fri, 23 Sep 2016 17:27:31 -0700 Subject: [PATCH 1/7] Add support for the Subgear XP-Air --- src/descriptor.c | 1 + src/oceanic_atom2.c | 1 + src/oceanic_atom2_parser.c | 18 ++++++++++++------ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/descriptor.c b/src/descriptor.c index 3efb036..a4a25a5 100644 --- a/src/descriptor.c +++ b/src/descriptor.c @@ -194,6 +194,7 @@ static const dc_descriptor_t g_descriptors[] = { {"Aeris", "A300CS", DC_FAMILY_OCEANIC_ATOM2, 0x454C}, {"Beuchat", "Mundial 3", DC_FAMILY_OCEANIC_ATOM2, 0x4550}, {"Oceanic", "F11", DC_FAMILY_OCEANIC_ATOM2, 0x4554}, + {"Subgear", "XP-Air", DC_FAMILY_OCEANIC_ATOM2, 0x4555}, {"Sherwood", "Vision", DC_FAMILY_OCEANIC_ATOM2, 0x4556}, {"Oceanic", "VTX", DC_FAMILY_OCEANIC_ATOM2, 0x4557}, {"Aqualung", "i300", DC_FAMILY_OCEANIC_ATOM2, 0x4559}, diff --git a/src/oceanic_atom2.c b/src/oceanic_atom2.c index b3ddce4..7acb958 100644 --- a/src/oceanic_atom2.c +++ b/src/oceanic_atom2.c @@ -163,6 +163,7 @@ static const oceanic_common_version_t oceanic_vt4_version[] = { {"OCEAVT41 \0\0 1024"}, {"AERISAIR \0\0 1024"}, {"SWVISION \0\0 1024"}, + {"XPSUBAIR \0\0 1024"}, }; static const oceanic_common_version_t hollis_tx1_version[] = { diff --git a/src/oceanic_atom2_parser.c b/src/oceanic_atom2_parser.c index 7d151b5..efe0653 100644 --- a/src/oceanic_atom2_parser.c +++ b/src/oceanic_atom2_parser.c @@ -76,6 +76,7 @@ #define A300CS 0x454C #define MUNDIAL3 0x4550 #define F11B 0x4554 +#define XPAIR 0x4555 #define VISION 0x4556 #define VTX 0x4557 #define I300 0x4559 @@ -242,6 +243,7 @@ oceanic_atom2_parser_get_datetime (dc_parser_t *abstract, dc_datetime_t *datetim case OCI: case I550T: case VISION: + case XPAIR: 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); @@ -375,7 +377,8 @@ oceanic_atom2_parser_cache (oceanic_atom2_parser_t *parser) unsigned int header = headersize - PAGESIZE / 2; unsigned int footer = size - footersize; if (parser->model == VT4 || parser->model == VT41 || - parser->model == A300AI || parser->model == VISION) { + parser->model == A300AI || parser->model == VISION || + parser->model == XPAIR) { header = 3 * PAGESIZE; } @@ -402,7 +405,8 @@ oceanic_atom2_parser_cache (oceanic_atom2_parser_t *parser) ngasmixes = 1; o2_offset = header + 3; } else if (parser->model == VT4 || parser->model == VT41 || - parser->model == A300AI || parser->model == VISION) { + parser->model == A300AI || parser->model == VISION || + parser->model == XPAIR) { o2_offset = header + 4; ngasmixes = 4; } else if (parser->model == OCI) { @@ -752,7 +756,8 @@ oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_ temperature = data[offset + 1]; } else if (parser->model == VT4 || parser->model == VT41 || parser->model == ATOM3 || parser->model == ATOM31 || - parser->model == A300AI || parser->model == VISION) { + parser->model == A300AI || parser->model == VISION || + parser->model == XPAIR) { temperature = ((data[offset + 7] & 0xF0) >> 4) | ((data[offset + 7] & 0x0C) << 2) | ((data[offset + 5] & 0x0C) << 4); } else if (parser->model == A300CS || parser->model == VTX) { temperature = data[offset + 11]; @@ -791,7 +796,7 @@ oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_ parser->model == ZENAIR ||parser->model == A300AI || parser->model == DG03 || parser->model == PROPLUS3 || parser->model == AMPHOSAIR || parser->model == I550T || - parser->model == VISION) + parser->model == VISION || parser->model == XPAIR) pressure = (((data[offset + 0] & 0x03) << 8) + data[offset + 1]) * 5; else if (parser->model == TX1 || parser->model == A300CS || parser->model == VTX) pressure = array_uint16_le (data + offset + 4); @@ -860,7 +865,8 @@ oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_ decostop = data[offset + 10]; decotime = array_uint16_le(data + offset + 6); have_deco = 1; - } else if (parser->model == ATOM31 || parser->model == VISION) { + } else if (parser->model == ATOM31 || parser->model == VISION || + parser->model == XPAIR) { decostop = (data[offset + 5] & 0xF0) >> 4; decotime = array_uint16_le(data + offset + 4) & 0x03FF; have_deco = 1; @@ -892,7 +898,7 @@ oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_ } else if (parser->model == I550T) { rbt = array_uint16_le(data + offset + 4) & 0x03FF; have_rbt = 1; - } else if (parser->model == VISION) { + } else if (parser->model == VISION || parser->model == XPAIR) { rbt = array_uint16_le(data + offset + 6) & 0x03FF; have_rbt = 1; } From 7714a57c44c134ecda672bd6c6959ad47d6de891 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Wed, 24 Aug 2016 14:10:24 +0200 Subject: [PATCH 2/7] Add missing header files to the Makefiles. To be able to generate a distribution tarball, all files need to be listed explicitely. --- include/libdivecomputer/Makefile.am | 1 + src/Makefile.am | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/libdivecomputer/Makefile.am b/include/libdivecomputer/Makefile.am index 778037f..e11ca4e 100644 --- a/include/libdivecomputer/Makefile.am +++ b/include/libdivecomputer/Makefile.am @@ -13,6 +13,7 @@ libdivecomputer_HEADERS = \ suunto.h \ suunto_solution.h \ suunto_eon.h \ + suunto_eonsteel.h \ suunto_vyper.h \ suunto_vyper2.h \ suunto_d9.h \ diff --git a/src/Makefile.am b/src/Makefile.am index fba41a8..f3305a4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -65,7 +65,7 @@ libdivecomputer_la_SOURCES = \ checksum.h checksum.c \ array.h array.c \ buffer.c \ - cochran_commander.h cochran_commander.c \ + cochran_commander.c \ cochran_commander_parser.c if OS_WIN32 From 995cfd4bbd5cc95adfc4be582b3e04f65c05d782 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Fri, 23 Sep 2016 23:04:28 +0200 Subject: [PATCH 3/7] Update the msvc project file. --- msvc/libdivecomputer.vcproj | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/msvc/libdivecomputer.vcproj b/msvc/libdivecomputer.vcproj index 52781f2..2f3dcdf 100644 --- a/msvc/libdivecomputer.vcproj +++ b/msvc/libdivecomputer.vcproj @@ -462,6 +462,10 @@ RelativePath="..\src\suunto_vyper_parser.c" > + + @@ -752,6 +756,10 @@ RelativePath="..\include\libdivecomputer\units.h" > + + From 53c75860a73068a4f51305aeb36762e409a1a63b Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Mon, 26 Sep 2016 19:54:42 +0200 Subject: [PATCH 4/7] Add some workarounds for the msvc compiler. --- src/suunto_eonsteel_parser.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/suunto_eonsteel_parser.c b/src/suunto_eonsteel_parser.c index 64a01ca..5bc2590 100644 --- a/src/suunto_eonsteel_parser.c +++ b/src/suunto_eonsteel_parser.c @@ -30,6 +30,16 @@ #include "parser-private.h" #include "array.h" +#ifdef _MSC_VER +#define strcasecmp _stricmp +#if _MSC_VER < 1800 +// The rint() function is only available in MSVC 2013 and later +// versions. Our replacement macro isn't entirely correct, because the +// rounding rules for halfway cases are slightly different (away from +// zero vs to even). But for our use-case, that's not a problem. +#define rint(x) ((x) >= 0.0 ? floor((x) + 0.5): ceil((x) - 0.5)) +#endif +#endif #define C_ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a))) From e7ceb96627188aaa16915786e82deb7f15284630 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Mon, 26 Sep 2016 19:59:18 +0200 Subject: [PATCH 5/7] Add explicit casts for the msvc C++ compiler. --- src/suunto_eonsteel_parser.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/suunto_eonsteel_parser.c b/src/suunto_eonsteel_parser.c index 5bc2590..a2fa3ee 100644 --- a/src/suunto_eonsteel_parser.c +++ b/src/suunto_eonsteel_parser.c @@ -678,7 +678,7 @@ static const char *lookup_enum(const struct type_desc *desc, unsigned char value if (n != value) continue; - ret = malloc(end - begin + 1); + ret = (char *)malloc(end - begin + 1); if (!ret) break; @@ -1177,7 +1177,7 @@ static int add_gas_type(suunto_eonsteel_parser_t *eon, const struct type_desc *d else if (!strcasecmp(name, "Oxygen")) ; else if (!strcasecmp(name, "None")) - tankinfo = 0; + tankinfo = DC_TANKVOLUME_NONE; else if (strcasecmp(name, "Primary")) DEBUG(eon->base.context, "Unknown gas type %u (%s)", type, name); @@ -1344,7 +1344,7 @@ static int traverse_diving_fields(suunto_eonsteel_parser_t *eon, const struct ty } if (!strcmp(name, "DiveMode")) { - if (!strncmp(data, "CCR", 3)) { + if (!strncmp((const char *)data, "CCR", 3)) { eon->cache.divemode = DC_DIVEMODE_CC; eon->cache.initialized |= 1 << DC_FIELD_DIVEMODE; } From 81c19446047c5b80e23487487e8c6793bae79944 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Mon, 26 Sep 2016 20:37:25 +0200 Subject: [PATCH 6/7] Include the public header in the implementation file. In the public header files, all symbols are marked extern C. When using a C compiler, there is usually no problem if the header isn't included in the C file. But the msvc build system uses the C++ compiler (due to the use of some C99 features not supported by the msvc C compiler). --- src/hw_ostc_parser.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/hw_ostc_parser.c b/src/hw_ostc_parser.c index 48eae3d..2a43dee 100644 --- a/src/hw_ostc_parser.c +++ b/src/hw_ostc_parser.c @@ -22,6 +22,7 @@ #include #include +#include #include "libdivecomputer/units.h" #include "context-private.h" From ba0e7224b0fd68fe319b0a0ffb4caaf721b3148b Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Fri, 30 Sep 2016 21:13:27 +0200 Subject: [PATCH 7/7] Release version 0.5.0. --- NEWS | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 2 +- 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index ec4d0ce..938041d 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,54 @@ +Version 0.5.0 (2016-09-30) +========================== + +After more than three years of development, the v0.5.0 release is long +overdue. The main highlights are the support for many new devices, a few +new features and lots of bug fixes. This release is fully backwards +compatible with the previous one. + +New features: + + * Add support for new backends: + - aqualand: Citizen Hyper Aqualand + - commander: Cochran Commander and EMC + - eonsteel: Suunto EON Steel + - idive: DiveSystem iDive and iX3M + - meridian: Scubapro Meridian, Mantis and Chromis + - nitekq: Dive Rite NiTek Q + * Add support for many new devices: + - Aeris: 500 AI, A300, A300CS, F11, XR-1 NX + - Aqualung: i300, i450T, i550T + - Beuchat: Mundial 2, Mundial 3, Voyager 2G + - Cressi: Giotto, Newton + - Dive Rite: NiTek Trio + - Heinrichs Weikamp: OSTC 2, 3+, 4, cR and Sport + - Hollis: TX1 + - Mares: Airlab, Smart, Smart Apnea, Puck 2 + - Oceanic: F11, OCi, VTX + - Scubapro: XTender 5 + - Shearwater: Nerd, Perdix, Petrel 2 + - Sherwood: Amphos, Amphos Air, Vision + - Subgear: XP-3G, XP-Air + - Suunto: Vyper Novo, Zoop Novo + - Tusa: IQ-700 + - Uwatec: Aladin 2G, Aladin Sport + * Add a new sample with the active gas mix. + * Add the temperature, tank and divemode fields. + * Add support for updating the OSTC and OSTC3 firmware. + * Add support for configuring the OSTC3 settings. + * Add a new dc_parser_new2 convenience function. + +Removed/changed features: + + * The gas change events (SAMPLE_EVENT_GASCHANGE and + SAMPLE_EVENT_GASCHANGE2) have been replaced with the new gasmix + sample (DC_SAMPLE_GASMIX). The legacy events are considered + deprecated, but kept for backwards compatibility. + +Bug fixes: + + * Many small improvements + Version 0.4.0 (2013-05-13) ========================== diff --git a/configure.ac b/configure.ac index 0bb834f..7dcb896 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ m4_define([dc_version_major],[0]) m4_define([dc_version_minor],[5]) m4_define([dc_version_micro],[0]) -m4_define([dc_version_suffix],[devel]) +m4_define([dc_version_suffix],[]) m4_define([dc_version],dc_version_major.dc_version_minor.dc_version_micro[]m4_ifset([dc_version_suffix],-[dc_version_suffix])) # Libtool versioning.