From bfd7301945f430c0ffefbf3a745bf8bb8639702b Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Thu, 30 Mar 2017 23:51:14 +0200 Subject: [PATCH] Replace the deco events with a deco sample --- src/mares_darwin_parser.c | 11 ++++++----- src/mares_nemo_parser.c | 11 ++++++----- src/uwatec_memomouse_parser.c | 16 ++++++++++++++-- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/mares_darwin_parser.c b/src/mares_darwin_parser.c index ac2c16f..73963e5 100644 --- a/src/mares_darwin_parser.c +++ b/src/mares_darwin_parser.c @@ -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; diff --git a/src/mares_nemo_parser.c b/src/mares_nemo_parser.c index 29b51b1..7b24ca4 100644 --- a/src/mares_nemo_parser.c +++ b/src/mares_nemo_parser.c @@ -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) { diff --git a/src/uwatec_memomouse_parser.c b/src/uwatec_memomouse_parser.c index d03d31b..e5c66f9 100644 --- a/src/uwatec_memomouse_parser.c +++ b/src/uwatec_memomouse_parser.c @@ -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); + } } }