Replace the deco events with a deco sample

This commit is contained in:
Jef Driesen 2017-03-30 23:51:14 +02:00
parent e2c020d4c7
commit bfd7301945
3 changed files with 26 additions and 12 deletions

View File

@ -272,12 +272,13 @@ mares_darwin_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t
// Deco stop
if (deco) {
sample.event.type = SAMPLE_EVENT_DECOSTOP;
sample.event.time = 0;
sample.event.flags = 0;
sample.event.value = 0;
if (callback) callback (DC_SAMPLE_EVENT, sample, userdata);
sample.deco.type = DC_DECO_DECOSTOP;
} else {
sample.deco.type = DC_DECO_NDL;
}
sample.deco.time = 0;
sample.deco.depth = 0.0;
if (callback) callback (DC_SAMPLE_DECO, sample, userdata);
if (parser->samplesize == 3) {
unsigned int type = (time / 20 + 2) % 3;

View File

@ -412,12 +412,13 @@ mares_nemo_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t c
// Deco stop
if (deco) {
sample.event.type = SAMPLE_EVENT_DECOSTOP;
sample.event.time = 0;
sample.event.flags = 0;
sample.event.value = 0;
if (callback) callback (DC_SAMPLE_EVENT, sample, userdata);
sample.deco.type = DC_DECO_DECOSTOP;
} else {
sample.deco.type = DC_DECO_NDL;
}
sample.deco.time = 0;
sample.deco.depth = 0.0;
if (callback) callback (DC_SAMPLE_DECO, sample, userdata);
// Pressure (1 bar).
if (parser->sample_size == 3) {

View File

@ -243,6 +243,16 @@ uwatec_memomouse_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callba
gasmix_previous = gasmix;
}
// NDL / Deco
if (warnings & 0x01) {
sample.deco.type = DC_DECO_DECOSTOP;
} else {
sample.deco.type = DC_DECO_NDL;
}
sample.deco.time = 0;
sample.deco.depth = 0.0;
if (callback) callback (DC_SAMPLE_DECO, sample, userdata);
// Warnings
for (unsigned int i = 0; i < 6; ++i) {
if (warnings & (1 << i)) {
@ -251,7 +261,7 @@ uwatec_memomouse_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callba
sample.event.value = 0;
switch (i) {
case 0: // Deco stop
sample.event.type = SAMPLE_EVENT_DECOSTOP;
sample.event.type = SAMPLE_EVENT_NONE;
break;
case 1: // Remaining bottom time too short (Air series only)
sample.event.type = SAMPLE_EVENT_RBT;
@ -269,7 +279,9 @@ uwatec_memomouse_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callba
sample.event.type = SAMPLE_EVENT_TRANSMITTER;
break;
}
if (callback) callback (DC_SAMPLE_EVENT, sample, userdata);
if (sample.event.type != SAMPLE_EVENT_NONE) {
if (callback) callback (DC_SAMPLE_EVENT, sample, userdata);
}
}
}