Skip to content

BH1750: Prevent out-of-range values#150

Open
mipolansk wants to merge 1 commit intoSUPLA:mainfrom
mipolansk:main
Open

BH1750: Prevent out-of-range values#150
mipolansk wants to merge 1 commit intoSUPLA:mainfrom
mipolansk:main

Conversation

@mipolansk
Copy link
Copy Markdown
Contributor

What does this PR change?

BH1750 is 16 bit sensor, max value is 65 535. PR adds limit for this max value to avoid out-of-range values when I2C communication produce incorrect values.


Affected area

  • Arduino
  • ESP-IDF
  • extras/
  • Documentation

Notes

Optional.


Checklist

  • Code builds for affected platforms
  • Code follows existing style and conventions
  • Documentation updated if needed
  • CLA accepted (requested automatically after opening the PR)

@klew
Copy link
Copy Markdown
Member

klew commented Mar 16, 2026

BH sensor reads 2 bytes, so even if it will read random values, it will still return number in a valid 0..65535 range. Then it can be adjusted based on some BH configuration parameters, so actual value may be in different range, but it should never produce out of range values like "3 579 139 328 lx".
In my opionion root cause here is not known and adding such limitation in SUPLA's BH implementation is not fixing the actual problem.

Please try to look for the root cause of such report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants