Fix the fingerprint offset for the Suunto D4i, D6i and D9tx.
When support for these models was introduced, I fixed the date/time parsing, but forgot about the fingerprint offset.
This commit is contained in:
parent
a4d46b2477
commit
8fa25ea9f3
@ -35,8 +35,6 @@
|
||||
#define SZ_PACKET 0x78
|
||||
#define SZ_MINIMUM 8
|
||||
|
||||
#define FP_OFFSET 0x15
|
||||
|
||||
#define RB_PROFILE_DISTANCE(l,a,b,m) ringbuffer_distance (a, b, m, l->rb_profile_begin, l->rb_profile_end)
|
||||
|
||||
#define BACKEND(abstract) ((suunto_common2_device_backend_t *) abstract->backend)
|
||||
@ -413,10 +411,7 @@ suunto_common2_device_foreach (dc_device_t *abstract, dc_dive_callback_t callbac
|
||||
}
|
||||
|
||||
if (next != current) {
|
||||
unsigned int fp_offset = FP_OFFSET;
|
||||
if (devinfo.model == 0x15)
|
||||
fp_offset += 6; // HelO2
|
||||
|
||||
unsigned int fp_offset = layout->fingerprint + 4;
|
||||
if (memcmp (p + fp_offset, device->fingerprint, sizeof (device->fingerprint)) == 0) {
|
||||
free (data);
|
||||
return DC_STATUS_SUCCESS;
|
||||
|
||||
@ -31,6 +31,8 @@ extern "C" {
|
||||
typedef struct suunto_common2_layout_t {
|
||||
// Memory size.
|
||||
unsigned int memsize;
|
||||
// Fingerprint
|
||||
unsigned int fingerprint;
|
||||
// Serial number.
|
||||
unsigned int serial;
|
||||
// Profile ringbuffer
|
||||
|
||||
@ -65,6 +65,7 @@ static const suunto_common2_device_backend_t suunto_d9_device_backend = {
|
||||
|
||||
static const suunto_common2_layout_t suunto_d9_layout = {
|
||||
0x8000, /* memsize */
|
||||
0x0011, /* fingerprint */
|
||||
0x0023, /* serial */
|
||||
0x019A, /* rb_profile_begin */
|
||||
0x7FFE /* rb_profile_end */
|
||||
@ -72,6 +73,7 @@ static const suunto_common2_layout_t suunto_d9_layout = {
|
||||
|
||||
static const suunto_common2_layout_t suunto_d9tx_layout = {
|
||||
0x10000, /* memsize */
|
||||
0x0013, /* fingerprint */
|
||||
0x0024, /* serial */
|
||||
0x019A, /* rb_profile_begin */
|
||||
0xEBF0 /* rb_profile_end */
|
||||
|
||||
@ -35,6 +35,8 @@
|
||||
rc == -1 ? DC_STATUS_IO : DC_STATUS_TIMEOUT \
|
||||
)
|
||||
|
||||
#define HELO2 0x15
|
||||
|
||||
typedef struct suunto_vyper2_device_t {
|
||||
suunto_common2_device_t base;
|
||||
serial_t *port;
|
||||
@ -58,6 +60,15 @@ static const suunto_common2_device_backend_t suunto_vyper2_device_backend = {
|
||||
|
||||
static const suunto_common2_layout_t suunto_vyper2_layout = {
|
||||
0x8000, /* memsize */
|
||||
0x0011, /* fingerprint */
|
||||
0x0023, /* serial */
|
||||
0x019A, /* rb_profile_begin */
|
||||
0x7FFE /* rb_profile_end */
|
||||
};
|
||||
|
||||
static const suunto_common2_layout_t suunto_helo2_layout = {
|
||||
0x8000, /* memsize */
|
||||
0x0017, /* fingerprint */
|
||||
0x0023, /* serial */
|
||||
0x019A, /* rb_profile_begin */
|
||||
0x7FFE /* rb_profile_end */
|
||||
@ -144,7 +155,11 @@ suunto_vyper2_device_open (dc_device_t **out, dc_context_t *context, const char
|
||||
}
|
||||
|
||||
// Override the base class values.
|
||||
device->base.layout = &suunto_vyper2_layout;
|
||||
unsigned int model = device->base.version[0];
|
||||
if (model == HELO2)
|
||||
device->base.layout = &suunto_helo2_layout;
|
||||
else
|
||||
device->base.layout = &suunto_vyper2_layout;
|
||||
|
||||
*out = (dc_device_t*) device;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user