Fix the firmware version and serial number

When downloading a Shearwater Petrel using the predator backend, the
firmware version and serial number are different compared to those
reported by the petrel backend.

This is caused by a difference in the encoding of the data. In the
predator data format, the firmware version appears to be BCD encoded,
and the serial number is stored as a big endian integer.
This commit is contained in:
Jef Driesen 2017-04-11 20:08:29 +02:00
parent 9fb7a1f228
commit 97a6023bb6

View File

@ -156,8 +156,8 @@ shearwater_predator_device_foreach (dc_device_t *abstract, dc_dive_callback_t ca
unsigned char *data = dc_buffer_get_data (buffer);
dc_event_devinfo_t devinfo;
devinfo.model = data[0x2000D];
devinfo.firmware = data[0x2000A];
devinfo.serial = array_uint32_le (data + 0x20002);
devinfo.firmware = bcd2dec (data[0x2000A]);
devinfo.serial = array_uint32_be (data + 0x20002);
device_event_emit (abstract, DC_EVENT_DEVINFO, &devinfo);
rc = shearwater_predator_extract_dives (abstract, data, SZ_MEMORY, callback, userdata);