Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BME280 Lua module - (config[3] & 0xFC) | BME280_FORCED_MODE workaround bug fix #3325

Merged
merged 1 commit into from
Nov 11, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lua_modules/bme280/bme280.lua
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ function bme280_startreadout(self, callback, delay, alt)
delay = delay or BME280_SAMPLING_DELAY

if self._isbme then write_reg(self.id, self.addr, BME280_REGISTER_CONTROL_HUM, self._config[2]) end
write_reg(self.id, self.addr, BME280_REGISTER_CONTROL, math_floor(self._config[3]:byte(1)/4)+ 1)
-- math_floor(self._config[3]:byte(1)/4)+ 1
write_reg(self.id, self.addr, BME280_REGISTER_CONTROL, 4*math_floor(self._config[3]:byte(1)/4)+ 1)
-- 4*math_floor(self._config[3]:byte(1)/4)+ 1
-- an awful way to avoid bit operations but calculate (config[3] & 0xFC) | BME280_FORCED_MODE
-- Lua 5.3 integer division // would be more suitable

Expand Down