-
Notifications
You must be signed in to change notification settings - Fork 42
Add helper method to set IAQ humidity #35
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think I have the sensor to test this, but in the meantime here are the changes per the CI! Thanks for submitting!
Most sensors only report relative humidity and temperature, so this uses the formula in the datasheet [^1] to make calibration easier. Notes: - The datasheet doesn't give the origin of the formula, but it seems to be based on Tetens Equation (to approximate pressure). - The example in the datasheet is wrong: the output should be 11.48. - math.exp is available in MicroPython [^2]. [^1]: https://sensirion.com/media/documents/984E0DD5/61644B8B/Sensirion_Gas_Sensors_Datasheet_SGP30.pdf [^2]: https://docs.micropython.org/en/latest/library/math.html#math.exp
@tekktrik thanks for the speedy first look! Somehow I totally missed this repo has a CI pipeline, which I can now see is passing after fixing all the linting issues. I was wondering whether to add a test for the new method but thought it would be too big a step for this PR, seeing as the repo doesn't have any tests currently. What do you think? |
Testing isn't the norm for CircuitPython libraries, but adding an example usage to a new or existing example file would be great! Would you mind doing that? |
Thanks for working on this @benthorner Echoing what tekktrik mentioned. We don't have many automated tests for the libraries. But we always do like to include an example that illustrates how to use new functionality when it gets added. If you're up for it please go ahead and add a small script inside of |
In response to [^1]. [^1]: adafruit#35 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for following up! I think this looks great, thanks for adding the example!
Updating https://github.com/adafruit/Adafruit_CircuitPython_SCD30 to 2.2.3 from 2.2.2: > Merge pull request adafruit/Adafruit_CircuitPython_SCD30#31 from cHemingway/readme_example_sck > Update Black to latest. > Fixed readthedocs build > Consolidate Documentation sections of README Updating https://github.com/adafruit/Adafruit_CircuitPython_SGP30 to 2.4.0 from 2.3.7: > Merge pull request adafruit/Adafruit_CircuitPython_SGP30#35 from benthorner/main > Update Black to latest. > Fixed readthedocs build > Consolidate Documentation sections of README Updating https://github.com/adafruit/Adafruit_CircuitPython_ESP32S2TFT to 1.0.1 from 1.0.0: > Merge pull request adafruit/Adafruit_CircuitPython_ESP32S2TFT#2 from tekktrik/dev/use-f-strings > Update Black to latest. > Corrected pylint version Updating https://github.com/adafruit/Adafruit_CircuitPython_MIDI to 1.4.8 from 1.4.7: > Merge pull request adafruit/Adafruit_CircuitPython_MIDI#49 from deckerego/update_control_values > Update Black to latest.
This has been exported to the underlying library [^1]. [^1]: adafruit/Adafruit_CircuitPython_SGP30#35
Most sensors only report relative humidity and temperature, so this
uses the formula in the datasheet 1 to make calibration easier.
Notes:
The datasheet doesn't give the origin of the formula, but it seems
to be based on Tetens Equation (to approximate pressure).
The example in the datasheet is wrong: the output should be 11.48.
math.exp is available in MicroPython 2.
Footnotes
https://sensirion.com/media/documents/984E0DD5/61644B8B/Sensirion_Gas_Sensors_Datasheet_SGP30.pdf ↩
https://docs.micropython.org/en/latest/library/math.html#math.exp ↩