Autodetect the three OSTC variants.

The exact OSTC variant can be detected by means of the serial number.
Each of the three variants is now assigned an artifical model number,
and included explicitly in the list of supported models.
This commit is contained in:
Jef Driesen 2012-12-01 12:58:51 +01:00
parent 3502ad39a6
commit 43a518b1d2
2 changed files with 9 additions and 2 deletions

View File

@ -150,7 +150,9 @@ static const dc_descriptor_t g_descriptors[] = {
{"Mares", "Icon HD", DC_FAMILY_MARES_ICONHD , 0x14},
{"Mares", "Icon HD Net Ready", DC_FAMILY_MARES_ICONHD , 0x15},
/* Heinrichs Weikamp */
{"Heinrichs Weikamp", "OSTC", DC_FAMILY_HW_OSTC, 0},
{"Heinrichs Weikamp", "OSTC", DC_FAMILY_HW_OSTC, 0},
{"Heinrichs Weikamp", "OSTC Mk2", DC_FAMILY_HW_OSTC, 1},
{"Heinrichs Weikamp", "OSTC 2N", DC_FAMILY_HW_OSTC, 2},
{"Heinrichs Weikamp", "Frog", DC_FAMILY_HW_FROG, 0},
/* Cressi Edy */
{"Cressi", "Edy", DC_FAMILY_CRESSI_EDY, 0},

View File

@ -323,9 +323,14 @@ hw_ostc_device_foreach (dc_device_t *abstract, dc_dive_callback_t callback, void
// Emit a device info event.
unsigned char *data = dc_buffer_get_data (buffer);
dc_event_devinfo_t devinfo;
devinfo.model = 0;
devinfo.firmware = array_uint16_be (data + 264);
devinfo.serial = array_uint16_le (data + 6);
if (devinfo.serial > 2048)
devinfo.model = 2; // OSTC 2N
else if (devinfo.serial > 300)
devinfo.model = 1; // OSTC Mk2
else
devinfo.model = 0; // OSTC
device_event_emit (abstract, DC_EVENT_DEVINFO, &devinfo);
rc = hw_ostc_extract_dives (abstract, dc_buffer_get_data (buffer),