From 8711371728c4ee29dbe649084e13968fdec9ae0c Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Fri, 20 Dec 2019 21:59:18 +0100 Subject: [PATCH] Add initial support for the Oceanic Pro Plus 4 This is _partial_ support for the Oceanic Pro Plus 4 from Jef, based on a partial dump by John Clark. Quoting Jef in the email thread: "I'm not sure why downloading the memory dump fails. All 4 attempts fail around the same memory address (0x3140), but not exactly the same. Strange, but the good news that there is already enough information to figure some things out. Linus and Dirk: Attached is a patch with the things I figured out so far. Can you make a build for John to try? Most of the info looks reasonable, but there are probably still a few things missing or wrong. I don't have any ground truth data to compare against for things like the temperature sign" This is that patch for testing. Signed-off-by: Linus Torvalds --- src/descriptor.c | 1 + src/oceanic_atom2.c | 1 + src/oceanic_atom2_parser.c | 10 +++++++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/descriptor.c b/src/descriptor.c index 4db368d..8338e8c 100644 --- a/src/descriptor.c +++ b/src/descriptor.c @@ -244,6 +244,7 @@ static const dc_descriptor_t g_descriptors[] = { {"Aqualung", "i770R", DC_FAMILY_OCEANIC_ATOM2, 0x4651, DC_TRANSPORT_SERIAL | DC_TRANSPORT_BLE, NULL}, {"Aqualung", "i550C", DC_FAMILY_OCEANIC_ATOM2, 0x4652, DC_TRANSPORT_SERIAL | DC_TRANSPORT_BLE, NULL}, {"Oceanic", "Geo 4.0", DC_FAMILY_OCEANIC_ATOM2, 0x4653, DC_TRANSPORT_SERIAL | DC_TRANSPORT_BLE, NULL}, + {"Oceanic", "Pro Plus 4", DC_FAMILY_OCEANIC_ATOM2, 0x4656, DC_TRANSPORT_SERIAL | DC_TRANSPORT_BLE, NULL}, /* Mares Nemo */ {"Mares", "Nemo", DC_FAMILY_MARES_NEMO, 0, DC_TRANSPORT_SERIAL, NULL}, {"Mares", "Nemo Steel", DC_FAMILY_MARES_NEMO, 0, DC_TRANSPORT_SERIAL, NULL}, diff --git a/src/oceanic_atom2.c b/src/oceanic_atom2.c index 42152f0..ae49028 100644 --- a/src/oceanic_atom2.c +++ b/src/oceanic_atom2.c @@ -148,6 +148,7 @@ static const oceanic_common_version_t sherwood_wisdom_version[] = { static const oceanic_common_version_t oceanic_proplus3_version[] = { {"PROPLUS3 \0\0 512K"}, + {"PROPLUS4 \0\0 512K"}, }; static const oceanic_common_version_t tusa_zenair_version[] = { diff --git a/src/oceanic_atom2_parser.c b/src/oceanic_atom2_parser.c index 6c4615a..6ca5e1b 100644 --- a/src/oceanic_atom2_parser.c +++ b/src/oceanic_atom2_parser.c @@ -95,6 +95,7 @@ #define I770R 0x4651 #define I550C 0x4652 #define GEO40 0x4653 +#define PROPLUS4 0x4656 #define NORMAL 0 #define GAUGE 1 @@ -174,7 +175,8 @@ oceanic_atom2_parser_create (dc_parser_t **out, dc_context_t *context, unsigned parser->headersize += PAGESIZE; } else if (model == TX1) { parser->headersize += 2 * PAGESIZE; - } else if (model == ATOM1 || model == I100) { + } else if (model == ATOM1 || model == I100 || + model == PROPLUS4) { parser->headersize -= 2 * PAGESIZE; } else if (model == F10A || model == F10B || model == MUNDIAL2 || model == MUNDIAL3) { @@ -292,6 +294,7 @@ oceanic_atom2_parser_get_datetime (dc_parser_t *abstract, dc_datetime_t *datetim case I100: case I300C: case GEO40: + case PROPLUS4: datetime->year = ((p[3] & 0xE0) >> 1) + (p[4] & 0x0F) + 2000; datetime->month = (p[4] & 0xF0) >> 4; datetime->day = p[3] & 0x1F; @@ -918,7 +921,8 @@ oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_ } else { unsigned int sign; if (parser->model == DG03 || parser->model == PROPLUS3 || - parser->model == I550 || parser->model == I550C) + parser->model == I550 || parser->model == I550C || + parser->model == PROPLUS4) sign = (~data[offset + 5] & 0x04) >> 2; else if (parser->model == VOYAGER2G || parser->model == AMPHOS || parser->model == AMPHOSAIR || parser->model == ZENAIR) @@ -951,7 +955,7 @@ oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_ parser->model == DG03 || parser->model == PROPLUS3 || parser->model == AMPHOSAIR || parser->model == I550 || parser->model == VISION || parser->model == XPAIR || - parser->model == I550C) + parser->model == I550C || parser->model == PROPLUS4) pressure = (((data[offset + 0] & 0x03) << 8) + data[offset + 1]) * 5; else if (parser->model == TX1 || parser->model == A300CS || parser->model == VTX || parser->model == I750TC ||