diff --git a/src/ds18.cpp b/src/ds18.cpp index 563e5c30d..08bb6d7ca 100644 --- a/src/ds18.cpp +++ b/src/ds18.cpp @@ -134,7 +134,6 @@ char * DS18::getDeviceString(char * buffer, unsigned char index) { return buffer; } - /* * Read sensor values * @@ -152,7 +151,7 @@ char * DS18::getDeviceString(char * buffer, unsigned char index) { DS18B20 & DS1822: store for crc byte 8: SCRATCHPAD_CRC */ -double DS18::getValue(unsigned char index) { +int16_t DS18::getRawValue(unsigned char index) { if (index >= _count) return 0; @@ -179,8 +178,12 @@ double DS18::getValue(unsigned char index) { // 12 bit res, 750 ms } - double value = (float)raw / 16.0; + return raw; +} +// return real value as a double +double DS18::getValue(unsigned char index) { + double value = (float)getRawValue(index) / 16.0; return value; } diff --git a/src/ds18.h b/src/ds18.h index a537ecf87..e6e97b300 100644 --- a/src/ds18.h +++ b/src/ds18.h @@ -40,6 +40,7 @@ class DS18 { void loop(); char * getDeviceString(char * s, unsigned char index); double getValue(unsigned char index); + int16_t getRawValue(unsigned char index); // raw values, needs / 16 protected: bool validateID(unsigned char id);