Add support for parsing the compass bearings
When no compass bearing is set on the dive computer, the stored value is initialized to zero. Since this can also be a valid value, those zero values are only ignored untill another non-zero value is present. In later firmware versions, the value will get initialized to 0xFFFF instead.
This commit is contained in:
parent
2d9008aff7
commit
08d8c3e132
@ -413,6 +413,7 @@ divesystem_idive_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callba
|
|||||||
unsigned int algorithm_previous = INVALID;
|
unsigned int algorithm_previous = INVALID;
|
||||||
unsigned int gf_low = INVALID;
|
unsigned int gf_low = INVALID;
|
||||||
unsigned int gf_high = INVALID;
|
unsigned int gf_high = INVALID;
|
||||||
|
unsigned int have_bearing = 0;
|
||||||
|
|
||||||
unsigned int firmware = 0;
|
unsigned int firmware = 0;
|
||||||
unsigned int apos4 = 0;
|
unsigned int apos4 = 0;
|
||||||
@ -618,6 +619,16 @@ divesystem_idive_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callba
|
|||||||
tank[tank_idx].endpressure = pressure;
|
tank[tank_idx].endpressure = pressure;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Compass bearing
|
||||||
|
unsigned int bearing = array_uint16_le (data + offset + 50);
|
||||||
|
if (bearing != 0) {
|
||||||
|
have_bearing = 1; // Stop ignoring zero values.
|
||||||
|
}
|
||||||
|
if (have_bearing && bearing != 0xFFFF) {
|
||||||
|
sample.bearing = bearing;
|
||||||
|
if (callback) callback (DC_SAMPLE_BEARING, &sample, userdata);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
offset += samplesize;
|
offset += samplesize;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user