Add support for the Sherwood Beacon

The Sherwood Beacon appears to be compatible with the Sherwood Sage. For
the BLE communication the handshake also fails and is disabled.
This commit is contained in:
Jef Driesen 2021-02-04 18:03:19 +01:00
parent f42df2d846
commit 580e1d5fc5
3 changed files with 20 additions and 9 deletions

View File

@ -263,6 +263,7 @@ static const dc_descriptor_t g_descriptors[] = {
{"Oceanic", "Veo 4.0", DC_FAMILY_OCEANIC_ATOM2, 0x4654, DC_TRANSPORT_SERIAL | DC_TRANSPORT_BLE, dc_filter_oceanic},
{"Sherwood", "Wisdom 4", DC_FAMILY_OCEANIC_ATOM2, 0x4655, DC_TRANSPORT_SERIAL | DC_TRANSPORT_BLE, dc_filter_oceanic},
{"Oceanic", "Pro Plus 4", DC_FAMILY_OCEANIC_ATOM2, 0x4656, DC_TRANSPORT_SERIAL | DC_TRANSPORT_BLE, dc_filter_oceanic},
{"Sherwood", "Beacon", DC_FAMILY_OCEANIC_ATOM2, 0x4742, DC_TRANSPORT_SERIAL | DC_TRANSPORT_BLE, dc_filter_oceanic},
{"Aqualung", "i470TC", DC_FAMILY_OCEANIC_ATOM2, 0x4743, DC_TRANSPORT_SERIAL | DC_TRANSPORT_BLE, dc_filter_oceanic},
/* Mares Nemo */
{"Mares", "Nemo", DC_FAMILY_MARES_NEMO, 0, DC_TRANSPORT_SERIAL, NULL},
@ -667,6 +668,7 @@ static int dc_filter_oceanic (dc_transport_t transport, const void *userdata, vo
0x4654, // Oceanic Veo 4.0
0x4655, // Sherwood Wisdom 4
0x4656, // Oceanic Pro Plus 4
0x4742, // Sherwood Beacon
0x4743, // Aqualung i470TC
};

View File

@ -41,6 +41,7 @@
#define SAGE 0x4647
#define I770R 0x4651
#define GEO40 0x4653
#define BEACON 0x4742
#define MAXPACKET 256
#define MAXRETRIES 2
@ -493,6 +494,7 @@ static const oceanic_common_version_t versions[] = {
{"OCEANVTX \0\0 2048", 0, &aeris_a300cs_layout},
{"AQUAI750 \0\0 2048", 0, &aeris_a300cs_layout},
{"SWDRAGON \0\0 2048", 0, &aeris_a300cs_layout},
{"SWBEACON \0\0 2048", 0, &aeris_a300cs_layout},
{"AQUAI450 \0\0 2048", 0, &aqualung_i450t_layout},
@ -904,7 +906,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 != SAGE ) {
model != PROPLUSX && model != SAGE && model != BEACON) {
status = oceanic_atom2_ble_handshake(device);
if (status != DC_STATUS_SUCCESS) {
goto error_free;

View File

@ -97,6 +97,7 @@
#define VEO40 0x4654
#define WISDOM4 0x4655
#define PROPLUS4 0x4656
#define BEACON 0x4742
#define I470TC 0x4743
#define NORMAL 0
@ -189,7 +190,8 @@ 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 == SAGE) {
model == I770R || model == SAGE ||
model == BEACON) {
parser->headersize = 5 * PAGESIZE;
} else if (model == PROPLUSX) {
parser->headersize = 3 * PAGESIZE;
@ -343,6 +345,7 @@ oceanic_atom2_parser_get_datetime (dc_parser_t *abstract, dc_datetime_t *datetim
case PROPLUSX:
case I770R:
case SAGE:
case BEACON:
datetime->year = (p[10]) + 2000;
datetime->month = (p[8]);
datetime->day = (p[9]);
@ -463,7 +466,8 @@ 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 == SAGE) {
parser->model == I750TC || parser->model == SAGE ||
parser->model == BEACON) {
o2_offset = 0x2A;
if (data[0x39] & 0x04) {
ngasmixes = 1;
@ -671,7 +675,7 @@ oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_
if (parser->model == A300CS || parser->model == VTX ||
parser->model == I450T || parser->model == I750TC ||
parser->model == PROPLUSX || parser->model == I770R ||
parser->model == SAGE)
parser->model == SAGE || parser->model == BEACON)
idx = 0x1f;
switch (data[idx] & 0x03) {
case 0:
@ -728,7 +732,7 @@ oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_
parser->model == VTX || parser->model == I450T ||
parser->model == I750TC || parser->model == PROPLUSX ||
parser->model == I770R || parser->model == I470TC ||
parser->model == SAGE) {
parser->model == SAGE || parser->model == BEACON) {
samplesize = PAGESIZE;
}
@ -813,7 +817,8 @@ 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 == SAGE) {
parser->model == I750TC || parser->model == SAGE ||
parser->model == BEACON) {
// Tank pressure (1 psi) and number (one based index)
tank = (data[offset + 1] & 0x03) - 1;
pressure = ((data[offset + 7] << 8) + data[offset + 6]) & 0x0FFF;
@ -915,7 +920,8 @@ 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 == SAGE) {
parser->model == I770R|| parser->model == SAGE ||
parser->model == BEACON) {
temperature = data[offset + 11];
} else {
unsigned int sign;
@ -960,7 +966,7 @@ oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_
else if (parser->model == TX1 || parser->model == A300CS ||
parser->model == VTX || parser->model == I750TC ||
parser->model == PROPLUSX || parser->model == I770R ||
parser->model == SAGE)
parser->model == SAGE || parser->model == BEACON)
pressure = array_uint16_le (data + offset + 4);
else
pressure -= data[offset + 1];
@ -1012,7 +1018,8 @@ oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_
unsigned int decostop = 0, decotime = 0;
if (parser->model == A300CS || parser->model == VTX ||
parser->model == I750TC || parser->model == SAGE ||
parser->model == PROPLUSX || parser->model == I770R) {
parser->model == PROPLUSX || parser->model == I770R ||
parser->model == BEACON) {
decostop = (data[offset + 15] & 0x70) >> 4;
decotime = array_uint16_le(data + offset + 6) & 0x03FF;
have_deco = 1;