Report the initial gas mix on the first sample
For dives with multiple gas mixes, an application doesn't have enough info to figure out which one is the initial gas mix. Usually it's the first gas mix, but that's not guaranteed. Reporting the intial gas mix on the first sample avoids this problem.
This commit is contained in:
parent
d0dbd1f6fd
commit
390b5fe553
@ -501,6 +501,9 @@ cochran_commander_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callb
|
||||
sample.temperature = (data[layout->start_temp] - 32.0) / 1.8;
|
||||
if (callback) callback (DC_SAMPLE_TEMPERATURE, sample, userdata);
|
||||
|
||||
sample.gasmix = 0;
|
||||
if (callback) callback(DC_SAMPLE_GASMIX, sample, userdata);
|
||||
|
||||
while (offset < size) {
|
||||
const unsigned char *s = samples + offset;
|
||||
|
||||
|
||||
@ -149,6 +149,9 @@ cressi_leonardo_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callbac
|
||||
unsigned int time = 0;
|
||||
unsigned int interval = 20;
|
||||
|
||||
unsigned int gasmix_previous = 0xFFFFFFFF;
|
||||
unsigned int gasmix = 0;
|
||||
|
||||
unsigned int offset = SZ_HEADER;
|
||||
while (offset + 2 <= size) {
|
||||
dc_sample_value_t sample = {0};
|
||||
@ -166,6 +169,13 @@ cressi_leonardo_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callbac
|
||||
sample.depth = depth / 10.0;
|
||||
if (callback) callback (DC_SAMPLE_DEPTH, sample, userdata);
|
||||
|
||||
// Gas change.
|
||||
if (gasmix != gasmix_previous) {
|
||||
sample.gasmix = gasmix;
|
||||
if (callback) callback (DC_SAMPLE_GASMIX, sample, userdata);
|
||||
gasmix_previous = gasmix;
|
||||
}
|
||||
|
||||
// Ascent rate
|
||||
if (ascent) {
|
||||
sample.event.type = SAMPLE_EVENT_ASCENT;
|
||||
|
||||
@ -217,8 +217,15 @@ mares_darwin_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t
|
||||
|
||||
unsigned int time = 0;
|
||||
|
||||
unsigned int mode = abstract->data[0x0C] & 0x03;
|
||||
unsigned int pressure = array_uint16_be (abstract->data + 0x17);
|
||||
|
||||
unsigned int gasmix_previous = 0xFFFFFFFF;
|
||||
unsigned int gasmix = gasmix_previous;
|
||||
if (mode != GAUGE) {
|
||||
gasmix = 0;
|
||||
}
|
||||
|
||||
unsigned int offset = parser->headersize;
|
||||
while (offset + parser->samplesize <= abstract->size) {
|
||||
dc_sample_value_t sample = {0};
|
||||
@ -238,6 +245,13 @@ mares_darwin_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t
|
||||
sample.depth = depth / 10.0;
|
||||
if (callback) callback (DC_SAMPLE_DEPTH, sample, userdata);
|
||||
|
||||
// Gas change.
|
||||
if (gasmix != gasmix_previous) {
|
||||
sample.gasmix = gasmix;
|
||||
if (callback) callback (DC_SAMPLE_GASMIX, sample, userdata);
|
||||
gasmix_previous = gasmix;
|
||||
}
|
||||
|
||||
// Ascent rate
|
||||
if (ascent) {
|
||||
sample.event.type = SAMPLE_EVENT_ASCENT;
|
||||
|
||||
@ -358,6 +358,13 @@ mares_nemo_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t c
|
||||
pressure = array_uint16_le(p + parser->header + 4);
|
||||
}
|
||||
|
||||
// Initial gas mix.
|
||||
unsigned int gasmix_previous = 0xFFFFFFFF;
|
||||
unsigned int gasmix = gasmix_previous;
|
||||
if (parser->mode == AIR || parser->mode == NITROX) {
|
||||
gasmix = 0;
|
||||
}
|
||||
|
||||
unsigned int time = 0;
|
||||
for (unsigned int i = 0; i < parser->sample_count; ++i) {
|
||||
dc_sample_value_t sample = {0};
|
||||
@ -378,6 +385,13 @@ mares_nemo_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t c
|
||||
sample.depth = depth / 10.0;
|
||||
if (callback) callback (DC_SAMPLE_DEPTH, sample, userdata);
|
||||
|
||||
// Gas change.
|
||||
if (gasmix != gasmix_previous) {
|
||||
sample.gasmix = gasmix;
|
||||
if (callback) callback (DC_SAMPLE_GASMIX, sample, userdata);
|
||||
gasmix_previous = gasmix;
|
||||
}
|
||||
|
||||
// Ascent rate
|
||||
if (ascent) {
|
||||
sample.event.type = SAMPLE_EVENT_ASCENT;
|
||||
|
||||
@ -275,6 +275,10 @@ suunto_eon_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t c
|
||||
sample.depth = 0;
|
||||
if (callback) callback (DC_SAMPLE_DEPTH, sample, userdata);
|
||||
|
||||
// Initial gas mix.
|
||||
sample.gasmix = 0;
|
||||
if (callback) callback (DC_SAMPLE_GASMIX, sample, userdata);
|
||||
|
||||
unsigned int depth = 0;
|
||||
unsigned int time = 0;
|
||||
unsigned int interval = data[3];
|
||||
|
||||
@ -170,6 +170,8 @@ suunto_solution_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callbac
|
||||
return DC_STATUS_DATAFORMAT;
|
||||
|
||||
unsigned int time = 0, depth = 0;
|
||||
unsigned int gasmix_previous = 0xFFFFFFFF;
|
||||
unsigned int gasmix = 0;
|
||||
|
||||
unsigned int offset = 3;
|
||||
while (offset < size && data[offset] != 0x80) {
|
||||
@ -193,6 +195,13 @@ suunto_solution_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callbac
|
||||
}
|
||||
sample.depth = depth * FEET;
|
||||
if (callback) callback (DC_SAMPLE_DEPTH, sample, userdata);
|
||||
|
||||
// Gas change.
|
||||
if (gasmix != gasmix_previous) {
|
||||
sample.gasmix = gasmix;
|
||||
if (callback) callback (DC_SAMPLE_GASMIX, sample, userdata);
|
||||
gasmix_previous = gasmix;
|
||||
}
|
||||
} else {
|
||||
// Event.
|
||||
sample.event.type = SAMPLE_EVENT_NONE;
|
||||
|
||||
@ -319,6 +319,8 @@ suunto_vyper_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t
|
||||
if (rc != DC_STATUS_SUCCESS)
|
||||
return rc;
|
||||
|
||||
unsigned int gauge = data[4] & 0x40;
|
||||
|
||||
// Time
|
||||
sample.time = 0;
|
||||
if (callback) callback (DC_SAMPLE_TIME, sample, userdata);
|
||||
@ -327,6 +329,12 @@ suunto_vyper_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t
|
||||
sample.depth = 0;
|
||||
if (callback) callback (DC_SAMPLE_DEPTH, sample, userdata);
|
||||
|
||||
// Initial gas mix
|
||||
if (!gauge) {
|
||||
sample.gasmix = 0;
|
||||
if (callback) callback (DC_SAMPLE_GASMIX, sample, userdata);
|
||||
}
|
||||
|
||||
unsigned int depth = 0;
|
||||
unsigned int time = 0;
|
||||
unsigned int interval = data[3];
|
||||
|
||||
@ -216,6 +216,9 @@ uwatec_memomouse_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callba
|
||||
|
||||
unsigned int time = 20;
|
||||
|
||||
unsigned int gasmix_previous = 0xFFFFFFFF;
|
||||
unsigned int gasmix = 0;
|
||||
|
||||
unsigned int offset = header + 18;
|
||||
while (offset + 2 <= size) {
|
||||
dc_sample_value_t sample = {0};
|
||||
@ -233,6 +236,13 @@ uwatec_memomouse_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callba
|
||||
sample.depth = depth * 10.0 / 64.0;
|
||||
if (callback) callback (DC_SAMPLE_DEPTH, sample, userdata);
|
||||
|
||||
// Gas change.
|
||||
if (gasmix != gasmix_previous) {
|
||||
sample.gasmix = gasmix;
|
||||
if (callback) callback (DC_SAMPLE_GASMIX, sample, userdata);
|
||||
gasmix_previous = gasmix;
|
||||
}
|
||||
|
||||
// Warnings
|
||||
for (unsigned int i = 0; i < 6; ++i) {
|
||||
if (warnings & (1 << i)) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user