Skip to content

Commit 6d76cd2

Browse files
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
1 parent 47a3566 commit 6d76cd2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Adafruit_BME280.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ uint32_t Adafruit_BME280::sensorID(void) { return _sensorID; }
545545
* @returns the current temperature compensation value in degrees Celcius
546546
*/
547547
float Adafruit_BME280::getTemperatureCompensation(void) {
548-
return float(((t_fine_adjust * 5) >> 8) / 100);
548+
return float((t_fine_adjust * 5) >> 8) / 100.0;
549549
};
550550

551551
/*!

0 commit comments

Comments
 (0)