From 0c2b3b293e275dc90b8cff995b3cb93ea0b0aad2 Mon Sep 17 00:00:00 2001 From: Kaushik Ghose Date: Sat, 28 May 2022 20:43:40 -0400 Subject: [PATCH] Fix return value for disconnected sensor --- ds18b20.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ds18b20.c b/ds18b20.c index 21fbff0..c9d7101 100644 --- a/ds18b20.c +++ b/ds18b20.c @@ -274,7 +274,7 @@ float ds18b20_getTempC(const DeviceAddress *deviceAddress) { if (ds18b20_isConnected(deviceAddress, scratchPad)){ int16_t rawTemp = calculateTemperature(deviceAddress, scratchPad); if (rawTemp <= DEVICE_DISCONNECTED_RAW) - return DEVICE_DISCONNECTED_F; + return DEVICE_DISCONNECTED_C; // C = RAW/128 // F = (C*1.8)+32 = (RAW/128*1.8)+32 = (RAW*0.0140625)+32 return (float) rawTemp/128.0f;