From 597a18165f5a4b5b02e84f6b162f7e142547b5db Mon Sep 17 00:00:00 2001 From: 1technophile Date: Tue, 27 Feb 2018 13:56:32 +0100 Subject: [PATCH] when temperature are negatives values are not corrects indeed if negative temperature the hex value is of type 0xffe9 for example giving a number > 65000, to deduct the negative value we need to substract 0xffff to the hex value --- ZgatewayBT.ino | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ZgatewayBT.ino b/ZgatewayBT.ino index 3b72c2b..30f77ea 100644 --- a/ZgatewayBT.ino +++ b/ZgatewayBT.ino @@ -117,8 +117,8 @@ Thanks to wolass https://github.com/wolass for suggesting me HM 10 and dinosd ht 1, /* Priority of the task */ NULL, /* Task handle. */ taskCore); /* Core where the task should run */ - trc(F("ZgatewayBT ESP32 setup done ")); - BLEDevice::init(""); + trc(F("ZgatewayBT ESP32 setup done ")); + BLEDevice::init(""); } void coreTask( void * pvParameters ){ @@ -322,6 +322,7 @@ boolean process_miflora_data(int offset, char * rest_data, char * mac_adress){ break; case '4' : mactopic = mactopic + "/" + "tem"; + if (value > 65000) value = value - 65535; dtostrf(value/10,3,1,val); // temp has to be divided by 10 break; case '7' :