Skip dives without a footer marker.
Due to the internal memory buffering scheme of the Sensus Ultra, the last page might contain a partial dive. Skipping this dive is more apropriate than returning an error.
This commit is contained in:
parent
7f983e29fe
commit
0edeed162a
@ -654,27 +654,24 @@ reefnet_sensusultra_parse (reefnet_sensusultra_device_t *device,
|
|||||||
previous = NULL;
|
previous = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Report an error if no footer marker was found.
|
// Skip dives without a footer marker.
|
||||||
if (previous == NULL) {
|
if (previous) {
|
||||||
WARNING ("No stop marker present.");
|
// Move the pointer to the end of the footer.
|
||||||
return DEVICE_STATUS_ERROR;
|
previous += sizeof (footer);
|
||||||
}
|
|
||||||
|
|
||||||
// Move the pointer to the end of the footer.
|
// Automatically abort when a dive is older than the provided timestamp.
|
||||||
previous += sizeof (footer);
|
unsigned int timestamp = array_uint32_le (current + 4);
|
||||||
|
if (device && timestamp <= device->timestamp) {
|
||||||
|
if (aborted)
|
||||||
|
*aborted = 1;
|
||||||
|
return DEVICE_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
// Automatically abort when a dive is older than the provided timestamp.
|
if (callback && !callback (current, previous - current, userdata)) {
|
||||||
unsigned int timestamp = array_uint32_le (current + 4);
|
if (aborted)
|
||||||
if (device && timestamp <= device->timestamp) {
|
*aborted = 1;
|
||||||
if (aborted)
|
return DEVICE_STATUS_SUCCESS;
|
||||||
*aborted = 1;
|
}
|
||||||
return DEVICE_STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (callback && !callback (current, previous - current, userdata)) {
|
|
||||||
if (aborted)
|
|
||||||
*aborted = 1;
|
|
||||||
return DEVICE_STATUS_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare for the next iteration.
|
// Prepare for the next iteration.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user