From 50280f6db35d7bf6fbfcc9c533c4d59433e5f8e1 Mon Sep 17 00:00:00 2001 From: Yurii Date: Wed, 4 Dec 2024 05:36:04 +0300 Subject: [PATCH] fix: negative temperature values from BLE devices --- src/SensorsTask.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/SensorsTask.h b/src/SensorsTask.h index 6519a82..892112a 100644 --- a/src/SensorsTask.h +++ b/src/SensorsTask.h @@ -561,7 +561,7 @@ class SensorsTask : public LeanTask { return; } - float rawTemp = ((pData[0] | (pData[1] << 8)) * 0.01f); + float rawTemp = (pChar->getValue() * 0.01f); Log.straceln( FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': received temp: %.2f"), @@ -634,7 +634,7 @@ class SensorsTask : public LeanTask { return; } - float rawTemp = ((pData[0] | (pData[1] << 8)) * 0.1f); + float rawTemp = (pChar->getValue() * 0.1f); Log.straceln( FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': received temp: %.2f"), @@ -719,7 +719,7 @@ class SensorsTask : public LeanTask { return; } - float rawHumidity = ((pData[0] | (pData[1] << 8)) * 0.01f); + float rawHumidity = (pChar->getValue() * 0.01f); Log.straceln( FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': received humidity: %.2f"), @@ -818,7 +818,7 @@ class SensorsTask : public LeanTask { return; } - uint8_t rawBattery = pData[0]; + auto rawBattery = pChar->getValue(); Log.straceln( FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': received battery: %.2f"),