Skip to content

Commit

Permalink
Add support for the Mares Horizon
Browse files Browse the repository at this point in the history
The Mares Horizon is a variant of the Mares Genius, with a few changes
to support SCR dives:

The dive header is slightly modified. There is an extra 8 byte field at
offset 0x18, which causes all later fields to have moved up with the
same amount. This difference is indicated in both the object minor
version (with a change from v0.0 to v0.1), and the logformat.

For the profile data, there is a new SDPT sample type which contains a
bit more information compared to the existing DPRS sample type. This
difference is indicated with a change in the object type (from 0 to 1).

The current implementation assumes a fixed order for the record types (a
DSTR record, a TISS record, zero or more DPRS/SDPT records with an AIRS
record every 4 sample, and finally a DEND record), and either only DPRS
or SDPT records but never a mixture of the two. If these assumptions
turns out to be incorrect, the implementation will need to be changed
significantly. Note that the assumption of the fixed order was already
present for the Genius.

Bluetooth support is currently disabled in the Horizon firmware, but
might be re-enabled in the future.
  • Loading branch information
jefdriesen committed Dec 24, 2020
1 parent 484e9dc commit 8b06f2c
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 49 deletions.
1 change: 1 addition & 0 deletions src/descriptor.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ static const dc_descriptor_t g_descriptors[] = {
{"Mares", "Quad Air", DC_FAMILY_MARES_ICONHD , 0x23, DC_TRANSPORT_SERIAL | DC_TRANSPORT_BLE, dc_filter_mares},
{"Mares", "Smart Air", DC_FAMILY_MARES_ICONHD , 0x24, DC_TRANSPORT_SERIAL | DC_TRANSPORT_BLE, dc_filter_mares},
{"Mares", "Quad", DC_FAMILY_MARES_ICONHD , 0x29, DC_TRANSPORT_SERIAL | DC_TRANSPORT_BLE, dc_filter_mares},
{"Mares", "Horizon", DC_FAMILY_MARES_ICONHD , 0x2C, DC_TRANSPORT_SERIAL, NULL},
/* Heinrichs Weikamp */
{"Heinrichs Weikamp", "OSTC", DC_FAMILY_HW_OSTC, 0, DC_TRANSPORT_SERIAL, NULL},
{"Heinrichs Weikamp", "OSTC Mk2", DC_FAMILY_HW_OSTC, 1, DC_TRANSPORT_SERIAL, NULL},
Expand Down
5 changes: 4 additions & 1 deletion src/mares_iconhd.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#define QUADAIR 0x23
#define SMARTAIR 0x24
#define QUAD 0x29
#define HORIZON 0x2C

#define MAXRETRIES 4

Expand Down Expand Up @@ -162,6 +163,7 @@ mares_iconhd_get_model (mares_iconhd_device_t *device)
{"Quad Air", QUADAIR},
{"Smart Air", SMARTAIR},
{"Quad", QUAD},
{"Horizon", HORIZON},
};

// Check the product name in the version packet against the list
Expand Down Expand Up @@ -566,6 +568,7 @@ mares_iconhd_device_open (dc_device_t **out, dc_context_t *context, dc_iostream_
device->packetsize = 256;
break;
case GENIUS:
case HORIZON:
device->layout = &mares_genius_layout;
device->packetsize = 4096;
device->fingerprint_size = 4;
Expand Down Expand Up @@ -958,7 +961,7 @@ mares_iconhd_device_foreach (dc_device_t *abstract, dc_dive_callback_t callback,
devinfo.serial = array_uint32_le (serial);
device_event_emit (abstract, DC_EVENT_DEVINFO, &devinfo);

if (device->model == GENIUS) {
if (device->model == GENIUS || device->model == HORIZON) {
return mares_iconhd_device_foreach_object (abstract, callback, userdata);
} else {
return mares_iconhd_device_foreach_raw (abstract, callback, userdata);
Expand Down
Loading

0 comments on commit 8b06f2c

Please sign in to comment.