Fix the detection of the last valid dive.
Normally, the last valid dive is followed by an empty entry with all 0xFF bytes. However, we received data from a device where a few of those bytes are not equal to 0xFF. This causes the entry to be processed incorrectly as a valid dive. As a workaround, we now check the internal dive number for 0xFFFF.
This commit is contained in:
parent
eb12a0aa20
commit
6b912f4f7b
@ -314,6 +314,10 @@ cressi_leonardo_extract_dives (dc_device_t *abstract, const unsigned char data[]
|
|||||||
|
|
||||||
// Get the internal dive number.
|
// Get the internal dive number.
|
||||||
unsigned int current = array_uint16_le (data + offset);
|
unsigned int current = array_uint16_le (data + offset);
|
||||||
|
if (current == 0xFFFF) {
|
||||||
|
WARNING (context, "Unexpected internal dive number found.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (current > maximum) {
|
if (current > maximum) {
|
||||||
maximum = current;
|
maximum = current;
|
||||||
latest = i;
|
latest = i;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user