From 2c3920ab62b72c5573d1133c588c5962fa297a32 Mon Sep 17 00:00:00 2001 From: Karl Fessel Date: Wed, 24 May 2023 14:00:43 +0200 Subject: [PATCH] driver/lc709203f: remove unnecessary use of float --- drivers/lc709203f/lc709203f.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/lc709203f/lc709203f.c b/drivers/lc709203f/lc709203f.c index 6591ed0812..994cf30bfe 100644 --- a/drivers/lc709203f/lc709203f.c +++ b/drivers/lc709203f/lc709203f.c @@ -152,7 +152,9 @@ int16_t lc709203f_get_cell_temp(const lc709203f_t *dev) DEBUG("CRC Error \n"); return 0; } - return ((((unsigned int)rec_buf[1] << 8) | rec_buf[0]) - 2731.5); + /* sensor temperature is given in 0.1K -> -2731.5 would be the correct value + * returning in 0.1°C int16_t -> using rounded 2732 */ + return ((((int16_t)rec_buf[1] << 8) | rec_buf[0]) - 2732); } lc709203f_temp_obtaining_mode_t lc709203f_get_status_bit(const lc709203f_t *dev)