Use independent settings for the global and logbook pointer modes.

This commit is contained in:
Jef Driesen 2010-04-27 11:33:29 +00:00
parent 76db1e6f44
commit e87385850b
5 changed files with 14 additions and 9 deletions

View File

@ -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 */
};

View File

@ -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;

View File

@ -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 {

View File

@ -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 */
};

View File

@ -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