Commit graph

84 commits

Author SHA1 Message Date
Kattni
0c85112fb6
Merge pull request #34 from adafruit/pylint-update
Ran black, updated to pylint 2.x
2020-03-17 16:44:44 -04:00
dherrada
575558059f Re-added --force-reinstall 2020-03-17 14:46:05 -04:00
dherrada
6fb01e73c4 Ran black, updated to pylint 2.x 2020-03-16 15:16:30 -04:00
sommersoft
44a11a1b97 update code of coduct: discord moderation contact section
Signed-off-by: sommersoft <sommersoft@gmail.com>
2020-03-15 18:20:47 -05:00
Kattni
421567b49a
Merge pull request #33 from sommersoft/patch_coc
Update Code of Conduct
2020-03-13 15:00:42 -04:00
sommersoft
3dd1c232d3 update code of conduct 2020-03-13 13:18:42 -05:00
sommersoft
39affff5f3 build.yml: move pylint, black, and Sphinx installs to each repo; add description to 'actions-ci/install.sh'
Signed-off-by: sommersoft <sommersoft@gmail.com>
2020-03-05 10:05:47 -06:00
sommersoft
80757ff214 update pylint examples directive
Signed-off-by: sommersoft <sommersoft@gmail.com>
2020-01-14 17:07:24 -06:00
Limor "Ladyada" Fried
2f362f7c7f
Merge pull request #30 from adafruit/dherrada-patch-1
Moved repository from Travis to GitHub Actions
2019-12-27 22:42:58 -05:00
dherrada
ac5d1c7bb2 Moved repository from Travis to GitHub Actions 2019-12-27 22:24:07 -05:00
Kattni
d4e476ad79
Merge pull request #28 from adafruit/dherrada-patch-1
Removed building locally section from README, replaced with documenta…
2019-10-21 19:56:52 -04:00
dherrada
8311b76857
Removed building locally section from README, replaced with documentation section 2019-10-17 18:16:39 -04:00
Limor "Ladyada" Fried
30bd4c3b36
Merge pull request #27 from ncguk/patch-1
Minor comment cleanup
2019-07-26 19:37:08 -04:00
ncguk
f06bc781ef
Minor comment cleanup
A typo and a couple of trivial formatting tweaks for consistency. No code changes.
2019-07-27 00:16:10 +01:00
Limor "Ladyada" Fried
53e09304e0
Merge pull request #26 from barbudor/master
fix #25 + fix #19 + refactor `pressure` property
2019-06-17 12:33:25 -04:00
Barbudor
8975faee83 fix #19 with proper struct unpack
tested with simulation:
# 0xE1 / 0xE2         dig_H2 [7:0]  / [15:8]    signed short
# 0xE3                dig_H3 [7:0]              unsigned char
# 0xE4 / 0xE5[3:0]    dig_H4 [11:4] / [3:0]     signed short
# 0xE5[7:4] / 0xE6    dig_H5 [3:0]  / [11:4]    signed short
# 0xE7                dig_H6                    signed char

>>> coeff = [ 0x12, 0xFF, 0xAA, 0xEE, 0x46, 0xCC, 0x88 ]
>>> coeff = list(struct.unpack('<hBbBbb', bytes(coeff)))
>>> float(coeff[0])                                 # 0xFF12 -> -238.0
-238.0
>>> float(coeff[1])                                 # 0xAA -> 170.0
170.0
>>> float((coeff[2] << 4) |  (coeff[3] & 0xF))      # 0xEE6 -> -282.0
-282.0
>>> float((coeff[4] << 4) | (coeff[3] >> 4))        # 0xCC4 -> -828.0
-828.0
>>> float(coeff[5])                                 # 0x88 -> -120.0
-120.0
>>>
2019-06-01 15:55:02 +02:00
Barbudor
a2d13f1ada refactor pressure property to handle ZeroDivision case
Recap: in the `pressure` property there is a test `if var1 == 0:` in order to avoid a division-by-zero exception. Current code return a pressure of 0 in that case.
It was suggested that my PR makes this a little more pythonic by usage of exception raise.

Analysis of the root cause: because last calculation is
```var1 = (1.0 + var1 / 32768.0) * self._pressure_calib[0]```
the only reason for `var1` to be 0 is `self._pressure_calib[0]` is 0. Calibration values are read at init time from registers in the chip. So the root cause probably relates to a register read problem.

Analysis of other similar codes
Bosch bme280.c (Github): if var1 == 0, return minimum valid pressure (300hPa).
Adafruit CiPy BMP280 driver:
  => initially, no tests were performed
  => In Feb, jraber implemeted return 0 in a commit named "Adopt changes from the BME280 library"
  => In Mar, jraber implemeted return minimum value in a commit named "Remove unnecessary 'if' and 'else' in the pressure property"
Adafruit CiPy BMP680 driver: not tested => ZeroDivisionError

I feel that returning silently the minimun valid pressure is not correct to draw attention on a possible hardware reliability problem. Returning 0 could make sense only if we were sure that the user was testing the return value against 0.
Alternatively, letting the ZeroDivisionError occur will not provide proper clue to the user as to the root cause of the problem and will probably lead to this issue to be raised again as a bug in GitHub.

Proposed solution:
Test against 0 and raise a ArithmeticError with message "Invalid calculation possibly related to error while reading the calibration registers"
2019-06-01 13:25:35 +02:00
Barbudor
cf74245929 fix issue#25 (removed frozenset()) + refactor pressure property
Removed `frozenset()` on `_BME280_IIR_FILTERS`, `_BME280_MODES`, `_BME280_STANDBY_TCS`. Kept as tuples.

Removed useless `if/else` in property `pressure` (was pointed by pylint)
2019-05-31 23:51:07 +02:00
Melissa LeBlanc-Williams
febcd51983
Merge pull request #22 from jraber/master
Add class attributes to allow more control over the sensor
2019-03-12 22:47:20 -07:00
Jeff Raber
0a10d868a6 Don't enable SPI 3-wire interface 2019-03-13 00:34:33 -05:00
Jeff Raber
9c37a711e2 Always write the new mode to the sensor
In FORCE mode, the sensor changes back to SLEEP after completeing a single
measurement, but we are not updating the mode internally.  It's better to
always write the mode to the sensor, and trust the caller not to change it
needlessly.
2019-03-12 23:42:40 -05:00
Jeff Raber
f40fb2c9d4 Add properties for the typical and maximum measurement time
Changed_BME280_OVERSCANS from frozenset to dict to allow lookup
 of the associated value for the measurement time calculation
2019-03-07 03:17:02 -06:00
Jeff Raber
79d4e8556e Do not return None when temp, pressure, or humidity value = 0x80000
0x800000 is the *default* value and is a valid value
2019-03-07 02:04:27 -06:00
Jeff Raber
ef0eef6145 Refactor to remove dependency on the enum class
Removed references to the enum class, while keeping the same
functionality

Updated the 'normal mode' example
2019-03-01 08:13:40 -06:00
Jeff Raber
a8c12e76b0 Fix-up example 2019-03-01 00:46:21 -06:00
Jeff Raber
ccf536384a Added and example for setting the mode, overscan, standby, and iir_filter 2019-02-28 22:57:54 -06:00
Jeff Raber
3b37d55d0e Add disable=too-many-instance-attributes to keep pylint happy 2019-02-28 07:52:20 -06:00
Jeff Raber
3284ed4fc0 Fix __write_config, docstring comes first 2019-02-27 08:58:32 -06:00
Jeff Raber
e9d7320639 Fix typo: standy -> standby 2019-02-27 08:50:04 -06:00
Jeff Raber
29af22eabc Default normal_flag to False to avoid UnboundLocalError in _write_config 2019-02-27 08:35:14 -06:00
Jeff Raber
032d38c749 Increase underline length to make sphinx happy 2019-02-27 01:38:19 -06:00
Jeff Raber
dc89e0becd Fix-up overscan_tempearure as it was returning the wrong value 2019-02-27 01:36:06 -06:00
Jeff Raber
3ebd5c3075 Add class attributes to allow more control over the sensor
Add attributes for IIR filter, standby period, operation mode,
 and overscan for temperature, pressure and humidity.

Add Enum classes for the overscan, standby, and iir filter values
2019-02-27 00:37:49 -06:00
Kattni
a18166df5d
Merge pull request #20 from sommersoft/readme_fix_travis
Update README Travis Badge
2018-12-21 13:45:13 -06:00
sommersoft
e3cadc96cb change 'travis-ci.org' to 'travis-ci.com' 2018-12-21 13:22:49 -06:00
Scott Shawcroft
80fedb78fa
Merge pull request #18 from robert-hh/master
adafruit_bme280.py: Fix the value of dig_H5
2018-11-25 22:15:55 -08:00
hh
e947bde6bb adafruit_bme280.py: Fix the value of dig_H5
The calculation of dig_H5 from the calibration data did not match the
definition of the data sheet and the Bosch sample code. As a result,
the compensated relative humidity data could have been calculated wrong.
2018-11-17 08:51:21 +01:00
Brennen Bearnes
2ce3755316
Merge pull request #16 from adafruit/pypi-readme-update
update to PyPi instructions in readme
2018-10-31 17:55:13 -06:00
Kattni
9f4c59bffb
update to PyPi instructions in readme 2018-10-31 16:44:07 -04:00
sommersoft
1416d93bc6 ignore the board module imports in .pylintrc
Signed-off-by: sommersoft <sommersoft@gmail.com>
2018-08-25 14:06:25 +00:00
Kattni
403cee347c
Merge pull request #13 from adafruit/revert-12-add-dew-point
Revert "Added dew point, updated example"
2018-08-14 16:43:28 -04:00
Kattni
6a9d4e7bf1
Revert "Added dew point, updated example" 2018-08-14 16:34:51 -04:00
Limor "Ladyada" Fried
ac1bc8917f
Merge pull request #12 from kattni/add-dew-point
Added dew point, updated example
2018-08-13 09:23:49 -07:00
Kattni Rembor
cdd59a110b Linting. 2018-08-13 12:20:18 -04:00
Kattni Rembor
12a7d6e558 Added dew point, updated example 2018-08-13 11:37:52 -04:00
Kattni
afcde67aeb
Merge pull request #10 from kattni/minor-fixes
Empty commit for tag bump for Travis.
2018-08-02 13:56:26 -04:00
Kattni Rembor
76a1cfae80 Empty commit for tag bump for Travis. 2018-08-02 13:55:34 -04:00
Brennen Bearnes
295122db12
Merge pull request #9 from kattni/minor-fixes
Updated readme, added overwrite to travis
2018-08-02 11:04:34 -06:00
Kattni Rembor
08e515cc90 Updated readme, added overwrite to travis 2018-08-02 12:52:09 -04:00
Brennen Bearnes
22bec796cd s/pip/pip3/g
Seems like we should specify here.
2018-07-16 14:06:41 -06:00