Add the serial number encoding to the layout.

At the moment, the encoding of the serial number is tied to the global
pointer mode. To support devices where this is no longer the case, a new
entry for the serial number encoding is added.
This commit is contained in:
Jef Driesen 2016-08-07 21:29:06 +02:00
parent 0a769cdd57
commit 00c2705786
5 changed files with 46 additions and 23 deletions

View File

@ -195,7 +195,8 @@ static const oceanic_common_layout_t aeris_f10_layout = {
0x0D80, /* rb_profile_begin */
0x10000, /* rb_profile_end */
0, /* pt_mode_global */
2 /* pt_mode_logbook */
2, /* pt_mode_logbook */
0, /* pt_mode_serial */
};
static const oceanic_common_layout_t aeris_f11_layout = {
@ -208,7 +209,8 @@ static const oceanic_common_layout_t aeris_f11_layout = {
0x0D80, /* rb_profile_begin */
0x20000, /* rb_profile_end */
0, /* pt_mode_global */
3 /* pt_mode_logbook */
3, /* pt_mode_logbook */
0, /* pt_mode_serial */
};
static const oceanic_common_layout_t oceanic_default_layout = {
@ -221,7 +223,8 @@ static const oceanic_common_layout_t oceanic_default_layout = {
0x0A40, /* rb_profile_begin */
0x10000, /* rb_profile_end */
0, /* pt_mode_global */
0 /* pt_mode_logbook */
0, /* pt_mode_logbook */
0, /* pt_mode_serial */
};
static const oceanic_common_layout_t oceanic_atom1_layout = {
@ -234,7 +237,8 @@ static const oceanic_common_layout_t oceanic_atom1_layout = {
0x0440, /* rb_profile_begin */
0x8000, /* rb_profile_end */
0, /* pt_mode_global */
0 /* pt_mode_logbook */
0, /* pt_mode_logbook */
0, /* pt_mode_serial */
};
static const oceanic_common_layout_t oceanic_atom2a_layout = {
@ -247,7 +251,8 @@ static const oceanic_common_layout_t oceanic_atom2a_layout = {
0x0A40, /* rb_profile_begin */
0xFE00, /* rb_profile_end */
0, /* pt_mode_global */
0 /* pt_mode_logbook */
0, /* pt_mode_logbook */
0, /* pt_mode_serial */
};
static const oceanic_common_layout_t oceanic_atom2b_layout = {
@ -260,7 +265,8 @@ static const oceanic_common_layout_t oceanic_atom2b_layout = {
0x0A40, /* rb_profile_begin */
0xFE00, /* rb_profile_end */
0, /* pt_mode_global */
0 /* pt_mode_logbook */
0, /* pt_mode_logbook */
0, /* pt_mode_serial */
};
static const oceanic_common_layout_t oceanic_atom2c_layout = {
@ -273,7 +279,8 @@ static const oceanic_common_layout_t oceanic_atom2c_layout = {
0x0A40, /* rb_profile_begin */
0xFFF0, /* rb_profile_end */
0, /* pt_mode_global */
0 /* pt_mode_logbook */
0, /* pt_mode_logbook */
0, /* pt_mode_serial */
};
static const oceanic_common_layout_t oceanic_proplus3_layout = {
@ -286,7 +293,8 @@ static const oceanic_common_layout_t oceanic_proplus3_layout = {
0x0A40, /* rb_profile_begin */
0xFE00, /* rb_profile_end */
0, /* pt_mode_global */
0 /* pt_mode_logbook */
0, /* pt_mode_logbook */
0, /* pt_mode_serial */
};
static const oceanic_common_layout_t tusa_zenair_layout = {
@ -299,7 +307,8 @@ static const oceanic_common_layout_t tusa_zenair_layout = {
0x0A40, /* rb_profile_begin */
0xFE00, /* rb_profile_end */
0, /* pt_mode_global */
1 /* pt_mode_logbook */
1, /* pt_mode_logbook */
0, /* pt_mode_serial */
};
static const oceanic_common_layout_t oceanic_oc1_layout = {
@ -312,7 +321,8 @@ static const oceanic_common_layout_t oceanic_oc1_layout = {
0x0A40, /* rb_profile_begin */
0x1FE00, /* rb_profile_end */
0, /* pt_mode_global */
1 /* pt_mode_logbook */
1, /* pt_mode_logbook */
0, /* pt_mode_serial */
};
static const oceanic_common_layout_t oceanic_oci_layout = {
@ -325,7 +335,8 @@ static const oceanic_common_layout_t oceanic_oci_layout = {
0x1400, /* rb_profile_begin */
0x1FE00, /* rb_profile_end */
0, /* pt_mode_global */
1 /* pt_mode_logbook */
1, /* pt_mode_logbook */
0, /* pt_mode_serial */
};
static const oceanic_common_layout_t oceanic_atom3_layout = {
@ -338,7 +349,8 @@ static const oceanic_common_layout_t oceanic_atom3_layout = {
0x0A40, /* rb_profile_begin */
0x1FE00, /* rb_profile_end */
0, /* pt_mode_global */
1 /* pt_mode_logbook */
1, /* pt_mode_logbook */
0, /* pt_mode_serial */
};
static const oceanic_common_layout_t oceanic_vt4_layout = {
@ -351,7 +363,8 @@ static const oceanic_common_layout_t oceanic_vt4_layout = {
0x0A40, /* rb_profile_begin */
0x1FE00, /* rb_profile_end */
0, /* pt_mode_global */
1 /* pt_mode_logbook */
1, /* pt_mode_logbook */
0, /* pt_mode_serial */
};
static const oceanic_common_layout_t hollis_tx1_layout = {
@ -364,7 +377,8 @@ static const oceanic_common_layout_t hollis_tx1_layout = {
0x1000, /* rb_profile_begin */
0x40000, /* rb_profile_end */
0, /* pt_mode_global */
1 /* pt_mode_logbook */
1, /* pt_mode_logbook */
0, /* pt_mode_serial */
};
static const oceanic_common_layout_t oceanic_veo1_layout = {
@ -377,7 +391,8 @@ static const oceanic_common_layout_t oceanic_veo1_layout = {
0x0400, /* rb_profile_begin */
0x0400, /* rb_profile_end */
0, /* pt_mode_global */
0 /* pt_mode_logbook */
0, /* pt_mode_logbook */
0, /* pt_mode_serial */
};
static const oceanic_common_layout_t oceanic_reactpro_layout = {
@ -390,7 +405,8 @@ static const oceanic_common_layout_t oceanic_reactpro_layout = {
0x0600, /* rb_profile_begin */
0xFFF0, /* rb_profile_end */
1, /* pt_mode_global */
1 /* pt_mode_logbook */
1, /* pt_mode_logbook */
1, /* pt_mode_serial */
};
static const oceanic_common_layout_t aeris_a300cs_layout = {
@ -403,7 +419,8 @@ static const oceanic_common_layout_t aeris_a300cs_layout = {
0x1000, /* rb_profile_begin */
0x3FE00, /* rb_profile_end */
0, /* pt_mode_global */
1 /* pt_mode_logbook */
1, /* pt_mode_logbook */
0, /* pt_mode_serial */
};
static const oceanic_common_layout_t aqualung_i450t_layout = {
@ -416,7 +433,8 @@ static const oceanic_common_layout_t aqualung_i450t_layout = {
0x1400, /* rb_profile_begin */
0x3FE00, /* rb_profile_end */
0, /* pt_mode_global */
1 /* pt_mode_logbook */
1, /* pt_mode_logbook */
0, /* pt_mode_serial */
};
static dc_status_t

View File

@ -644,7 +644,7 @@ oceanic_common_device_foreach (dc_device_t *abstract, dc_dive_callback_t callbac
dc_event_devinfo_t devinfo;
devinfo.model = array_uint16_be (id + 8);
devinfo.firmware = 0;
if (layout->pt_mode_global == 0)
if (layout->pt_mode_serial == 0)
devinfo.serial = bcd2dec (id[10]) * 10000 + bcd2dec (id[11]) * 100 + bcd2dec (id[12]);
else
devinfo.serial = id[11] * 10000 + id[12] * 100 + id[13];

View File

@ -55,6 +55,7 @@ typedef struct oceanic_common_layout_t {
// 12-bit values or two 16-bit values with each 4 bits padding).
unsigned int pt_mode_global;
unsigned int pt_mode_logbook;
unsigned int pt_mode_serial;
} oceanic_common_layout_t;
typedef struct oceanic_common_device_t {

View File

@ -83,7 +83,8 @@ static const oceanic_common_layout_t oceanic_veo250_layout = {
0x0600, /* rb_profile_begin */
0x8000, /* rb_profile_end */
1, /* pt_mode_global */
1 /* pt_mode_logbook */
1, /* pt_mode_logbook */
1, /* pt_mode_serial */
};

View File

@ -98,7 +98,8 @@ static const oceanic_common_layout_t oceanic_vtpro_layout = {
0x0440, /* rb_profile_begin */
0x8000, /* rb_profile_end */
0, /* pt_mode_global */
0 /* pt_mode_logbook */
0, /* pt_mode_logbook */
0, /* pt_mode_serial */
};
static const oceanic_common_layout_t oceanic_wisdom_layout = {
@ -111,7 +112,8 @@ static const oceanic_common_layout_t oceanic_wisdom_layout = {
0x05D0, /* rb_profile_begin */
0x8000, /* rb_profile_end */
0, /* pt_mode_global */
0 /* pt_mode_logbook */
0, /* pt_mode_logbook */
0, /* pt_mode_serial */
};
static const oceanic_common_layout_t aeris_500ai_layout = {
@ -124,7 +126,8 @@ static const oceanic_common_layout_t aeris_500ai_layout = {
0x00200, /* rb_profile_begin */
0x20000, /* rb_profile_end */
0, /* pt_mode_global */
1 /* pt_mode_logbook */
1, /* pt_mode_logbook */
0, /* pt_mode_serial */
};
static dc_status_t