Skip all non-sample records
The IX3M 2 with the APOS5 firmware supports a new info record containing the GPS coordinates. To be able to identify this new record type, the previously reserved field at byte offset 52 is now used to store the record type: zero for the existing sample record and one for the new info record. This also fixes the underlying problem of the zero timestamp in commit 3c50e91a1096332df66b2d33d64e5a8dc9136ab9, because the zero timestamp was the result of incorrectly interpreting the first info record as a sample record.
This commit is contained in:
parent
3c50e91a10
commit
e1762fc8bd
@ -58,6 +58,9 @@
|
||||
#define IX3M2_ZHL16C 2
|
||||
#define IX3M2_VPM 3
|
||||
|
||||
#define REC_SAMPLE 0
|
||||
#define REC_INFO 1
|
||||
|
||||
typedef struct divesystem_idive_parser_t divesystem_idive_parser_t;
|
||||
|
||||
typedef struct divesystem_idive_gasmix_t {
|
||||
@ -438,6 +441,16 @@ divesystem_idive_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callba
|
||||
while (offset + samplesize <= size) {
|
||||
dc_sample_value_t sample = {0};
|
||||
|
||||
// Get the record type.
|
||||
unsigned int type = ISIX3M(parser->model) ?
|
||||
array_uint16_le (data + offset + 52) :
|
||||
REC_SAMPLE;
|
||||
if (type != REC_SAMPLE) {
|
||||
// Skip non-sample records.
|
||||
offset += samplesize;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Time (seconds).
|
||||
unsigned int timestamp = array_uint32_le (data + offset + 2);
|
||||
if (timestamp <= time && time != 0) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user