fossasia / pslab-python

Python Library for PSLab Desktop: https://pslab.io
GNU General Public License v3.0
1.63k stars 225 forks source link

fix: fixed BMP180 #231

Closed AsCress closed 3 months ago

AsCress commented 4 months ago

Fixes the BMP180 sensor. The following libraries were used as a reference: -

  1. https://github.com/adafruit/Adafruit-BMP085-Library
  2. https://github.com/adafruit/Adafruit_Python_BMP

Screenshots / Recordings

Here, is a screenshot of the readings. These are consistent with the results provided by other python and Arduino drivers. Screenshot 2024-08-04 163516

@bessman Please let me know your views on this.

Summary by Sourcery

Fix BMP180 sensor functionality and refactor the BMP180 class to enhance readability and support multiple operating modes.

Bug Fixes:

Enhancements:

sourcery-ai[bot] commented 4 months ago

Reviewer's Guide by Sourcery

This pull request refactors the BMP180 sensor class to improve its accuracy and readability. The changes include the addition of module-level constants, new methods for reading calibration values, updated temperature and pressure calculations, and the removal of redundant code. These updates are based on the BMP180 datasheet and reference libraries from Adafruit.

File-Level Changes

Files Changes
pslab/external/BMP180.py Refactored the BMP180 sensor class to improve accuracy and readability by using constants, new calibration methods, and updated calculations based on the datasheet.

Tips - Trigger a new Sourcery review by commenting `@sourcery-ai review` on the pull request. - Continue your discussion with Sourcery by replying directly to review comments. - You can change your review settings at any time by accessing your [dashboard](https://app.sourcery.ai): - Enable or disable the Sourcery-generated pull request summary or reviewer's guide; - Change the review language; - You can always [contact us](mailto:support@sourcery.ai) if you have any questions or feedback.
AsCress commented 3 months ago

@bessman I have (tried to) implement all the changes you suggested. This PR is now up-to-date with my changes.

AsCress commented 3 months ago

@bessman I've made all the changes that we discussed and that you've suggested. Now, the pressure, temperature and altitude can be accessed as properties: -

Screenshot 2024-08-21 145256

Let me know if there's something still not quite right style-wise :))

bessman commented 3 months ago

Looks good, thank you!