Skip to content

Conversation

@tekktrik
Copy link
Member

Fixes #23 by adding units to docstrings. Also reformatted and renamed some instance variables in pressure to be more consistent throughout (helps with following along with the datasheet, if nothing else). Also seemed like _temperature variable that was being calculated was getting used, so I removed it.

@tekktrik tekktrik requested review from a team, caternuson and ladyada June 29, 2022 01:22
@caternuson
Copy link
Contributor

Did you test the changes just to make sure? Can just check pressure and altitude are close to whatever your local expected values should be. If there's a unit or other error, they should be obviously off.

@tekktrik
Copy link
Member Author

I don't have the hardware to test but can get it if needed. It looks like the equation for pressure is in the datasheet, and comes out with units Pa, so the division by 100 is what gave me confidence that it's hPa. Reference for altitude units came from SparkFun's explanation.

Let me know if you want me to test it though and I'll get it on order!

@caternuson
Copy link
Contributor

No worries. Just tested and looks OK. Wanted to make sure since there were some changes to the math code, even if minor.

Adafruit CircuitPython 7.3.1 on 2022-06-22; Adafruit QT Py M0 with samd21e18 >>> import board >>> from adafruit_dps310.basic import DPS310 >>> dps = DPS310(board.I2C()) >>> dps.pressure 1009.75 >>> dps.altitude 29.2341 >>> 
@tekktrik tekktrik merged commit 5ed1e61 into adafruit:main Jun 29, 2022
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Jun 30, 2022
Updating https://github.com/adafruit/Adafruit_CircuitPython_AW9523 to 1.1.0 from 1.0.6: > Merge pull request adafruit/Adafruit_CircuitPython_AW9523#6 from rtyley/add-constant-current-range-selector Updating https://github.com/adafruit/Adafruit_CircuitPython_DPS310 to 2.1.5 from 2.1.4: > Merge pull request adafruit/Adafruit_CircuitPython_DPS310#24 from tekktrik/dev/fix-units Updating https://github.com/adafruit/Adafruit_CircuitPython_GC_IOT_Core to 3.2.3 from 3.2.2: > Merge pull request adafruit/Adafruit_CircuitPython_GC_IOT_Core#26 from JulianOrteil/type-annotations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants