From 73c129a6cef6f87a46c82fdde5415a64d04ccb24 Mon Sep 17 00:00:00 2001 From: Aaron Hexamer Date: Wed, 13 Mar 2024 23:30:50 -0500 Subject: [PATCH] Fix issue mentioned here: https://forum.z-wave.me/viewtopic.php?t=35673 --- .../zunoG2/libraries/ZUNO_DS18B20/ZUNO_DS18B20.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hardware/arduino/zunoG2/libraries/ZUNO_DS18B20/ZUNO_DS18B20.cpp b/hardware/arduino/zunoG2/libraries/ZUNO_DS18B20/ZUNO_DS18B20.cpp index ae63544d..e5a82b77 100644 --- a/hardware/arduino/zunoG2/libraries/ZUNO_DS18B20/ZUNO_DS18B20.cpp +++ b/hardware/arduino/zunoG2/libraries/ZUNO_DS18B20/ZUNO_DS18B20.cpp @@ -82,7 +82,8 @@ int DS18B20Sensor::getTempC100(byte * addr) size_t current_resolution; byte dallas_data[9]; - int temp = BAD_TEMP; + int16_t temp = BAD_TEMP; + int32_t tempC100 = BAD_TEMP; byte i; if (!my_ow->reset()) @@ -149,11 +150,10 @@ int DS18B20Sensor::getTempC100(byte * addr) // temp /= 0.16 // will be // 16/100 => 4/25 => temp *= 25; tem/=4; - temp *= 25; - temp >>= 2; + tempC100 = (int32_t)temp * 25; + tempC100 >>= 2; - - return temp; + return tempC100; } float DS18B20Sensor::getTemperature(byte * addr) {