From 6b3874121d189e4a672bc0915e890dc5e12690d9 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Sat, 16 Jan 2016 17:03:06 +0100 Subject: [PATCH] Don't ignore zero depth samples in freedive mode. In freedive mode, samples are only 2 or 4 bytes large, thus a sample containing all 0x00 bytes represents a zero depth value and not some invalid data that should be ignored. --- src/oceanic_atom2_parser.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/oceanic_atom2_parser.c b/src/oceanic_atom2_parser.c index d52b379..5dc3488 100644 --- a/src/oceanic_atom2_parser.c +++ b/src/oceanic_atom2_parser.c @@ -638,7 +638,8 @@ oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_ dc_sample_value_t sample = {0}; // Ignore empty samples. - if (array_isequal (data + offset, samplesize, 0x00) || + if ((parser->mode != FREEDIVE && + array_isequal (data + offset, samplesize, 0x00)) || array_isequal (data + offset, samplesize, 0xFF)) { offset += samplesize; continue;