From 328812e95bfe7c6c9d2a8d36c75144f05c7dc9dc Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Wed, 15 Feb 2023 21:07:02 +0100 Subject: [PATCH] Limit the index to the fixed gas mixes The index in the gas change event should refer to the one of the fixed gas mixes. All gas mixes with a higher index are either manual or bailout gas mixes, and are reported with different events containing an O2 and He percentages instead. --- src/hw_ostc_parser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hw_ostc_parser.c b/src/hw_ostc_parser.c index d745ef8..7d75514 100644 --- a/src/hw_ostc_parser.c +++ b/src/hw_ostc_parser.c @@ -902,8 +902,8 @@ hw_ostc_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t call return DC_STATUS_DATAFORMAT; } unsigned int idx = data[offset]; - if (idx < 1 || idx > parser->ngasmixes) { - ERROR(abstract->context, "Invalid gas mix."); + if (idx < 1 || idx > parser->nfixed) { + ERROR(abstract->context, "Invalid gas mix (%u).", idx); return DC_STATUS_DATAFORMAT; } idx--; /* Convert to a zero based index. */