1
0
mirror of https://github.com/cmur2/python-bme680.git synced 2026-04-05 14:18:43 +02:00

Fix Python 3 TypeError crashes by using floor division explicitly

The / operator in Python 3 returns a float, which was causing TypeErrors
when being passed to the << or >> operators.
This commit is contained in:
Dave Arter
2017-11-19 17:10:27 +00:00
parent d9970151cd
commit 3e4bf56802
2 changed files with 9 additions and 9 deletions

View File

@@ -323,9 +323,9 @@ class CalibrationData:
self.par_gh3 = twos_comp(calibration[GH3_REG], bits=8)
def set_other(self, heat_range, heat_value, sw_error):
self.res_heat_range = (heat_range & RHRANGE_MSK) / 16
self.res_heat_range = (heat_range & RHRANGE_MSK) // 16
self.res_heat_val = heat_value
self.range_sw_err = (sw_error * RSERROR_MSK) / 16
self.range_sw_err = (sw_error * RSERROR_MSK) // 16
# BME680 sensor settings structure which comprises of ODR,
# over-sampling and filter settings.