From bba998bce09bc5139eb4ca7a05b0279f4083ff88 Mon Sep 17 00:00:00 2001 From: Mikael Falkvidd Date: Fri, 29 Jan 2021 14:33:48 +0100 Subject: [PATCH] Fix farenheit conversion When temperature in C was below 0, the conversion to F was wrong due to treating the C value as unsigned integer instead of signed integer. See http://bit.ly/3ckRfxp for more information. Thanks to hoggin for reporting this problem. --- libraries/SI7021/SI7021.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/SI7021/SI7021.cpp b/libraries/SI7021/SI7021.cpp index c51ab6b..4f929d1 100644 --- a/libraries/SI7021/SI7021.cpp +++ b/libraries/SI7021/SI7021.cpp @@ -38,7 +38,7 @@ bool SI7021::sensorExists() { } int SI7021::getFahrenheitHundredths() { - unsigned int c = getCelsiusHundredths(); + int c = getCelsiusHundredths(); return (1.8 * c) + 3200; }