From e87385850b6a9f3cb3f24590ecdf1a8b466b0b78 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Tue, 27 Apr 2010 11:33:29 +0000 Subject: [PATCH] Use independent settings for the global and logbook pointer modes. --- src/oceanic_atom2.c | 3 ++- src/oceanic_common.c | 8 ++++---- src/oceanic_common.h | 3 ++- src/oceanic_veo250.c | 3 ++- src/oceanic_vtpro.c | 6 ++++-- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/oceanic_atom2.c b/src/oceanic_atom2.c index abcfd34..9621e48 100644 --- a/src/oceanic_atom2.c +++ b/src/oceanic_atom2.c @@ -71,7 +71,8 @@ static const oceanic_common_layout_t oceanic_atom2_layout = { 0x0A40, /* rb_logbook_end */ 0x0A40, /* rb_profile_begin */ 0x10000, /* rb_profile_end */ - 0 /* mode */ + 0, /* pt_mode_global */ + 0 /* pt_mode_logbook */ }; diff --git a/src/oceanic_common.c b/src/oceanic_common.c index 9d09f03..09dac64 100644 --- a/src/oceanic_common.c +++ b/src/oceanic_common.c @@ -57,7 +57,7 @@ get_profile_first (const unsigned char data[], const oceanic_common_layout_t *la { unsigned int value; - if (layout->mode == 0) { + if (layout->pt_mode_logbook == 0) { value = array_uint16_le (data + 5); } else { value = array_uint16_le (data + 4); @@ -72,7 +72,7 @@ get_profile_last (const unsigned char data[], const oceanic_common_layout_t *lay { unsigned int value; - if (layout->mode == 0) { + if (layout->pt_mode_logbook == 0) { value = array_uint16_le (data + 6) >> 4; } else { value = array_uint16_le (data + 6); @@ -181,7 +181,7 @@ oceanic_common_device_foreach (device_t *abstract, dive_callback_t callback, voi device_devinfo_t devinfo; devinfo.model = array_uint16_be (id + 8); devinfo.firmware = 0; - if (layout->mode == 0) + if (layout->pt_mode_global == 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]; @@ -215,7 +215,7 @@ oceanic_common_device_foreach (device_t *abstract, dive_callback_t callback, voi rb_logbook_entry_end = layout->rb_logbook_begin; rb_logbook_entry_size = 0; } else { - if (layout->mode == 0) { + if (layout->pt_mode_global == 0) { rb_logbook_entry_begin = rb_logbook_first; rb_logbook_entry_end = RB_LOGBOOK_INCR (rb_logbook_last, PAGESIZE / 2, layout); rb_logbook_entry_size = RB_LOGBOOK_DISTANCE (rb_logbook_first, rb_logbook_last, layout) + PAGESIZE / 2; diff --git a/src/oceanic_common.h b/src/oceanic_common.h index da78f66..79af409 100644 --- a/src/oceanic_common.h +++ b/src/oceanic_common.h @@ -47,7 +47,8 @@ typedef struct oceanic_common_layout_t { // should be interpreted (a first/last or a begin/end pair), and // how the profile pointers are stored in each logbook entry (two // 12-bit values or two 16-bit values with each 4 bits padding). - unsigned int mode; + unsigned int pt_mode_global; + unsigned int pt_mode_logbook; } oceanic_common_layout_t; typedef struct oceanic_common_device_t { diff --git a/src/oceanic_veo250.c b/src/oceanic_veo250.c index 13bdb52..9ff939b 100644 --- a/src/oceanic_veo250.c +++ b/src/oceanic_veo250.c @@ -72,7 +72,8 @@ static const oceanic_common_layout_t oceanic_veo250_layout = { 0x0600, /* rb_logbook_end */ 0x0600, /* rb_profile_begin */ 0x8000, /* rb_profile_end */ - 1 /* mode */ + 1, /* pt_mode_global */ + 1 /* pt_mode_logbook */ }; diff --git a/src/oceanic_vtpro.c b/src/oceanic_vtpro.c index b274680..94cf66b 100644 --- a/src/oceanic_vtpro.c +++ b/src/oceanic_vtpro.c @@ -75,7 +75,8 @@ static const oceanic_common_layout_t oceanic_vtpro_layout = { 0x0440, /* rb_logbook_end */ 0x0440, /* rb_profile_begin */ 0x8000, /* rb_profile_end */ - 0 /* mode */ + 0, /* pt_mode_global */ + 0 /* pt_mode_logbook */ }; static const oceanic_common_layout_t oceanic_wisdom_layout = { @@ -86,7 +87,8 @@ static const oceanic_common_layout_t oceanic_wisdom_layout = { 0x05D0, /* rb_logbook_end */ 0x05D0, /* rb_profile_begin */ 0x8000, /* rb_profile_end */ - 0 /* mode */ + 0, /* pt_mode_global */ + 0 /* pt_mode_logbook */ }; static int