Fix the OSTC tank pressure decoding

The tank pressure is stored with a resolution of 1 bar instead of 0.1
bar. There is however one exception. The hwOS Sport firmware used a
resolution of 0.1 bar between versions 10.40 and 10.50.

Unfortunately the only way to distinguish the Sport from the Tech
variant is the different range of the version number (10.x vs 3.x). The
consequence is that this workaround will start to produce wrong results
once the firmware version number of the hwOS tech variant reaches the
10.x range. If that ever happens, this workaround should be removed
again!
This commit is contained in:
Jef Driesen 2019-11-12 21:12:06 +01:00
parent 21a9fa6879
commit ab230fd4e0

View File

@ -918,7 +918,12 @@ hw_ostc_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t call
value = array_uint16_le (data + offset);
if (value != 0) {
sample.pressure.tank = tank;
sample.pressure.value = value / 10.0;
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)) {
sample.pressure.value /= 10.0;
}
if (callback) callback (DC_SAMPLE_PRESSURE, sample, userdata);
}
break;