From 7f21998ad5c73528651054251297c57ef5fb2c9d Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Tue, 19 Nov 2019 20:47:53 +0100 Subject: [PATCH] Limit the tank pressure workaround to hwOS devices The workaround for the tank pressure in the previous commit is only relevant for the newer hwOS based devices, and not for the original OSTC devices. In practice this doesn't cause any problems because the original OSTC doesn't support a tank pressure sensor, but nevertheless it's better to use the correct condition. --- src/hw_ostc_parser.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hw_ostc_parser.c b/src/hw_ostc_parser.c index 4d81f0c..8c80588 100644 --- a/src/hw_ostc_parser.c +++ b/src/hw_ostc_parser.c @@ -921,7 +921,8 @@ hw_ostc_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t call sample.pressure.value = value; // The hwOS Sport firmware used a resolution of // 0.1 bar between versions 10.40 and 10.50. - if (parser->model != OSTC4 && (firmware >= 0x0A28 && firmware <= 0x0A32)) { + if (parser->hwos && parser->model != OSTC4 && + (firmware >= 0x0A28 && firmware <= 0x0A32)) { sample.pressure.value /= 10.0; } if (callback) callback (DC_SAMPLE_PRESSURE, sample, userdata);