From 6d76cd285e181b33d7df561f81c3859916c5c47f Mon Sep 17 00:00:00 2001 From: danbaker-projects Date: Tue, 13 Oct 2020 13:47:44 -0400 Subject: [PATCH] Update Adafruit_BME280.cpp This fixes a (very minor) bug in the return value of getTemperatureCompensation(). getTemperatureCompensation() was dropping (rounding to integer) the fractional part of the temperature offset due to an integer divide by 100 before casting to a float. For example: if the temperature compensation was 1.49 degC, the value returned was 1.00 This didn't affect the accuracy of the readings (setTemperatureCompensation worked fine), it only gave an incorrect value if you read the value back using getTemperatureCompensation --- Adafruit_BME280.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Adafruit_BME280.cpp b/Adafruit_BME280.cpp index 6d58509..fbcb0a2 100644 --- a/Adafruit_BME280.cpp +++ b/Adafruit_BME280.cpp @@ -545,7 +545,7 @@ uint32_t Adafruit_BME280::sensorID(void) { return _sensorID; } * @returns the current temperature compensation value in degrees Celcius */ float Adafruit_BME280::getTemperatureCompensation(void) { - return float(((t_fine_adjust * 5) >> 8) / 100); + return float((t_fine_adjust * 5) >> 8) / 100.0; }; /*!