Skip to content

Handle multiple HALLCONF values (Resolves #19) #27

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

Merged
merged 3 commits into from
Mar 2, 2021

Conversation

SAK917
Copy link
Contributor

@SAK917 SAK917 commented Mar 2, 2021

Add functionality to handle multiple HALLCONF values in Adafruit_MLX90393.py by mimicking approach used in the Arduino library for this device (as per @caternuson):

Add comment listing valid values for HALLCONF (i.e., 0x0C or 0x00)
Add level of nesting to _LSB_LOOKUP to accommodate multiple HALLCONF values
Add lookup information for HALLCONF = 0x00 to _LSB_LOOKUP. Confirmed values against most recent datasheet (rev. 06)
In @property magnetic():

  • Add check for valid HALLCONF values and raise ValueError if not 0x0C or 0x00
  • Set _LSB_LOOKUP index as appropriate for HALLCONF
  • Modify raw-value conversion equations to handle new _LSB_LOOKUP with additional level of nesting

NOTE: The code in property magnetic() deviates from the Arduino version in that it uses the appropriate _LSB_LOOKUP values based on the value of HALLCONF, whereas the Arduino version has the index hardcoded to [0] so it always uses the HALLCONF = 0x0C values in _LSB_LOOKUP regardless of the actual value of HALLCONF. The code to determine and use the appropriate _LSB_LOOKUP index value based on the HALLCONF value does not exist in the Arduino version.

I am unable to test this since I don't have the MLX90393 device, but am not getting any Python / Pylint errors.

SAK917 added 3 commits March 1, 2021 13:10
Changed _LSB_LOOKUP to be a 4d array by adding a second set of
calibration data for HALLCONF = 0x0 as per existing Arduino library:
_LSB_LOOKUP[0][x][y][z] is for HALLCONF = 0xC
_LSB_LOOKUP[1][x][y][z] is for HALLCONF = 0x0

Verified calibration values as per most current datasheet (rev. 6)
@caternuson
Copy link
Contributor

Thanks. This looks good. A good follow on issue/PR would be to actually add the ability for the user to set HALL_CONF via a new property. But that can be done separately. This PR gets the table updated and maintains the current behavior.

@caternuson caternuson merged commit 83ea49c into adafruit:master Mar 2, 2021
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Mar 11, 2021
Updating https://github.com/adafruit/Adafruit_CircuitPython_AS7341 to 1.0.6 from 1.0.5:
  > Merge pull request adafruit/Adafruit_CircuitPython_AS7341#11 from FoamyGuy/pylintrc_and_versions

Updating https://github.com/adafruit/Adafruit_CircuitPython_BH1750 to 1.0.4 from 1.0.3:
  > Merge pull request adafruit/Adafruit_CircuitPython_BH1750#1 from FoamyGuy/pylintrc

Updating https://github.com/adafruit/Adafruit_CircuitPython_BNO08X to 1.0.6 from 1.0.5:
  > Merge pull request adafruit/Adafruit_CircuitPython_BNO08x#17 from FoamyGuy/pylintrc

Updating https://github.com/adafruit/Adafruit_CircuitPython_BNO08X_RVC to 1.0.4 from 1.0.3:
  > Merge pull request adafruit/Adafruit_CircuitPython_BNO08x_RVC#2 from FoamyGuy/pylintrc

Updating https://github.com/adafruit/Adafruit_CircuitPython_CLUE to 2.2.9 from 2.2.8:
  > Merge pull request adafruit/Adafruit_CircuitPython_CLUE#40 from AlexColello/patch-2

Updating https://github.com/adafruit/Adafruit_CircuitPython_EMC2101 to 1.1.4 from 1.1.3:
  > Merge pull request adafruit/Adafruit_CircuitPython_EMC2101#5 from FoamyGuy/pylint_to_precommit

Updating https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI to 3.5.6 from 3.5.5:
  > Merge pull request adafruit/Adafruit_CircuitPython_ESP32SPI#124 from FoamyGuy/pylintrc
  > Merge pull request adafruit/Adafruit_CircuitPython_ESP32SPI#125 from brentru/rp2040

Updating https://github.com/adafruit/Adafruit_CircuitPython_IS31FL3731 to 3.0.2 from 3.0.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_IS31FL3731#40 from dglaude/patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_LC709203F to 2.0.2 from 2.0.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_LC709203F#9 from FoamyGuy/pylintrc_and_versions

Updating https://github.com/adafruit/Adafruit_CircuitPython_LSM6DS to 4.1.3 from 4.1.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_LSM6DS#38 from FoamyGuy/pylintrc

Updating https://github.com/adafruit/Adafruit_CircuitPython_MCP2515 to 1.0.8 from 1.0.7:
  > Merge pull request adafruit/Adafruit_CircuitPython_MCP2515#8 from FoamyGuy/pylintrc_and_versions

Updating https://github.com/adafruit/Adafruit_CircuitPython_MLX90393 to 2.0.5 from 2.0.4:
  > Re-added pylint install to build.yml
  > Removed pylint process from github workflow
  > Merge pull request adafruit/Adafruit_CircuitPython_MLX90393#27 from SAK917/master

Updating https://github.com/adafruit/Adafruit_CircuitPython_MS8607 to 1.0.6 from 1.0.5:
  > Merge pull request adafruit/Adafruit_CircuitPython_MS8607#6 from FoamyGuy/pylintrc

Updating https://github.com/adafruit/Adafruit_CircuitPython_PCF8591 to 1.0.4 from 1.0.3:
  > Merge pull request adafruit/Adafruit_CircuitPython_PCF8591#3 from FoamyGuy/pylint_ignore_imports

Updating https://github.com/adafruit/Adafruit_CircuitPython_SSD1306 to 2.11.2 from 2.11.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_SSD1306#59 from adamcandy/fix-page-addressing-mode-spi

Updating https://github.com/adafruit/Adafruit_CircuitPython_AdafruitIO to 5.2.3 from 5.2.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_AdafruitIO#66 from brentru/rp2040-example
  > Merge pull request adafruit/Adafruit_CircuitPython_AdafruitIO#65 from FoamyGuy/pylintrc

Updating https://github.com/adafruit/Adafruit_CircuitPython_datetime to 1.1.1 from 1.1.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_datetime#3 from FoamyGuy/pylint_to_pre_commit
  > Merge pull request adafruit/Adafruit_CircuitPython_datetime#4 from adafruit/jepler-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_Hue to 1.1.5 from 1.1.4:
  > Merge pull request adafruit/Adafruit_CircuitPython_Hue#16 from OBITORASU/patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_MatrixPortal to 2.2.1 from 2.2.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_MatrixPortal#64 from FoamyGuy/pylintrc
  > Merge pull request adafruit/Adafruit_CircuitPython_MatrixPortal#69 from makermelissa/master

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA:
  > Added the following libraries: Adafruit_CircuitPython_SSD1680
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