From 9e169c9a3f67277e4e4f46f457dcb47899f1c4e5 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Tue, 30 Jan 2018 21:07:33 +0100 Subject: [PATCH] Use the correct data type for the temperature Temperatures are reported as a floating point values and not as (unsigned) integers. --- src/cochran_commander_parser.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cochran_commander_parser.c b/src/cochran_commander_parser.c index 12e8b42..e8ba76f 100644 --- a/src/cochran_commander_parser.c +++ b/src/cochran_commander_parser.c @@ -474,19 +474,19 @@ cochran_commander_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, if (value) { switch (type) { case DC_FIELD_TEMPERATURE_SURFACE: - *((unsigned int*) value) = (data[layout->start_temp] - 32.0) / 1.8; + *((double *) value) = (data[layout->start_temp] - 32.0) / 1.8; break; case DC_FIELD_TEMPERATURE_MINIMUM: if (data[layout->min_temp] == 0xFF) return DC_STATUS_UNSUPPORTED; - *((unsigned int*) value) = (data[layout->min_temp] / 2.0 + 20 - 32) / 1.8; + *((double *) value) = (data[layout->min_temp] / 2.0 + 20 - 32) / 1.8; break; case DC_FIELD_TEMPERATURE_MAXIMUM: if (layout->max_temp == UNSUPPORTED) return DC_STATUS_UNSUPPORTED; if (data[layout->max_temp] == 0xFF) return DC_STATUS_UNSUPPORTED; - *((unsigned int*) value) = (data[layout->max_temp] / 2.0 + 20 - 32) / 1.8; + *((double *) value) = (data[layout->max_temp] / 2.0 + 20 - 32) / 1.8; break; case DC_FIELD_DIVETIME: minutes = array_uint16_le(data + layout->divetime);