Add support for the Sherwood Sage

The Sherwood Sage appears to be very similar to the Aeris A300CS. For
the BLE communication the handshake fails and is disabled.

Reported-By: Nick Shore <support@mac-dive.com>
This commit is contained in:
Jef Driesen 2020-11-25 14:11:23 +01:00
parent 7f553c1276
commit 90a08ad845
3 changed files with 18 additions and 9 deletions

View File

@ -253,6 +253,7 @@ static const dc_descriptor_t g_descriptors[] = {
{"Aqualung", "i450T", DC_FAMILY_OCEANIC_ATOM2, 0x4641, DC_TRANSPORT_SERIAL, NULL},
{"Aqualung", "i550", DC_FAMILY_OCEANIC_ATOM2, 0x4642, DC_TRANSPORT_SERIAL, NULL},
{"Aqualung", "i200", DC_FAMILY_OCEANIC_ATOM2, 0x4646, DC_TRANSPORT_SERIAL, NULL},
{"Sherwood", "Sage", DC_FAMILY_OCEANIC_ATOM2, 0x4647, DC_TRANSPORT_SERIAL | DC_TRANSPORT_BLE, dc_filter_oceanic},
{"Aqualung", "i300C", DC_FAMILY_OCEANIC_ATOM2, 0x4648, DC_TRANSPORT_SERIAL | DC_TRANSPORT_BLE, dc_filter_oceanic},
{"Aqualung", "i200C", DC_FAMILY_OCEANIC_ATOM2, 0x4649, DC_TRANSPORT_SERIAL | DC_TRANSPORT_BLE, dc_filter_oceanic},
{"Aqualung", "i100", DC_FAMILY_OCEANIC_ATOM2, 0x464E, DC_TRANSPORT_SERIAL, NULL},
@ -641,6 +642,7 @@ static int dc_filter_oceanic (dc_transport_t transport, const void *userdata, vo
{
static const unsigned int model[] = {
0x4552, // Oceanic Pro Plus X
0x4647, // Sherwood Sage
0x4648, // Aqualung i300C
0x4649, // Aqualung i200C
0x4651, // Aqualung i770R

View File

@ -38,6 +38,7 @@
#define PROPLUSX 0x4552
#define VTX 0x4557
#define I750TC 0x455A
#define SAGE 0x4647
#define I770R 0x4651
#define GEO40 0x4653
@ -491,6 +492,7 @@ static const oceanic_common_version_t versions[] = {
{"AER300CS \0\0 2048", 0, &aeris_a300cs_layout},
{"OCEANVTX \0\0 2048", 0, &aeris_a300cs_layout},
{"AQUAI750 \0\0 2048", 0, &aeris_a300cs_layout},
{"SWDRAGON \0\0 2048", 0, &aeris_a300cs_layout},
{"AQUAI450 \0\0 2048", 0, &aqualung_i450t_layout},
@ -902,7 +904,7 @@ oceanic_atom2_device_open (dc_device_t **out, dc_context_t *context, dc_iostream
}
if (dc_iostream_get_transport (device->iostream) == DC_TRANSPORT_BLE &&
model != PROPLUSX) {
model != PROPLUSX && model != SAGE ) {
status = oceanic_atom2_ble_handshake(device);
if (status != DC_STATUS_SUCCESS) {
goto error_free;

View File

@ -87,6 +87,7 @@
#define I450T 0x4641
#define I550 0x4642
#define I200 0x4646
#define SAGE 0x4647
#define I300C 0x4648
#define I200C 0x4649
#define I100 0x464E
@ -188,7 +189,7 @@ oceanic_atom2_parser_create (dc_parser_t **out, dc_context_t *context, unsigned
parser->footersize = 0;
} else if (model == A300CS || model == VTX ||
model == I450T || model == I750TC ||
model == I770R) {
model == I770R || model == SAGE) {
parser->headersize = 5 * PAGESIZE;
} else if (model == PROPLUSX) {
parser->headersize = 3 * PAGESIZE;
@ -341,6 +342,7 @@ oceanic_atom2_parser_get_datetime (dc_parser_t *abstract, dc_datetime_t *datetim
case I750TC:
case PROPLUSX:
case I770R:
case SAGE:
datetime->year = (p[10]) + 2000;
datetime->month = (p[8]);
datetime->day = (p[9]);
@ -461,7 +463,7 @@ oceanic_atom2_parser_cache (oceanic_atom2_parser_t *parser)
he_offset = 0x48;
ngasmixes = 6;
} else if (parser->model == A300CS || parser->model == VTX ||
parser->model == I750TC) {
parser->model == I750TC || parser->model == SAGE) {
o2_offset = 0x2A;
if (data[0x39] & 0x04) {
ngasmixes = 1;
@ -670,7 +672,8 @@ oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_
unsigned int idx = 0x17;
if (parser->model == A300CS || parser->model == VTX ||
parser->model == I450T || parser->model == I750TC ||
parser->model == PROPLUSX || parser->model == I770R)
parser->model == PROPLUSX || parser->model == I770R ||
parser->model == SAGE)
idx = 0x1f;
switch (data[idx] & 0x03) {
case 0:
@ -726,7 +729,8 @@ oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_
parser->model == TX1 || parser->model == A300CS ||
parser->model == VTX || parser->model == I450T ||
parser->model == I750TC || parser->model == PROPLUSX ||
parser->model == I770R || parser->model == I470TC) {
parser->model == I770R || parser->model == I470TC ||
parser->model == SAGE) {
samplesize = PAGESIZE;
}
@ -811,7 +815,7 @@ oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_
tank = 0;
pressure = (((data[offset + 7] << 8) + data[offset + 6]) & 0x0FFF);
} else if (parser->model == A300CS || parser->model == VTX ||
parser->model == I750TC) {
parser->model == I750TC || parser->model == SAGE) {
// Tank pressure (1 psi) and number (one based index)
tank = (data[offset + 1] & 0x03) - 1;
pressure = ((data[offset + 7] << 8) + data[offset + 6]) & 0x0FFF;
@ -913,7 +917,7 @@ 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 if (parser->model == A300CS || parser->model == VTX ||
parser->model == I750TC || parser->model == PROPLUSX ||
parser->model == I770R) {
parser->model == I770R|| parser->model == SAGE) {
temperature = data[offset + 11];
} else {
unsigned int sign;
@ -957,7 +961,8 @@ oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_
pressure = (((data[offset + 0] & 0x03) << 8) + data[offset + 1]) * 5;
else if (parser->model == TX1 || parser->model == A300CS ||
parser->model == VTX || parser->model == I750TC ||
parser->model == PROPLUSX || parser->model == I770R)
parser->model == PROPLUSX || parser->model == I770R ||
parser->model == SAGE)
pressure = array_uint16_le (data + offset + 4);
else
pressure -= data[offset + 1];
@ -1008,7 +1013,7 @@ oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_
unsigned int have_deco = 0;
unsigned int decostop = 0, decotime = 0;
if (parser->model == A300CS || parser->model == VTX ||
parser->model == I750TC ||
parser->model == I750TC || parser->model == SAGE ||
parser->model == PROPLUSX || parser->model == I770R) {
decostop = (data[offset + 15] & 0x70) >> 4;
decotime = array_uint16_le(data + offset + 6) & 0x03FF;