adafruit / adafruit/Adafruit_CircuitPython_ICM20X

Allow using different models together

Open
#16 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
9
Forks
17
PR merge metrics
No merged PRs in 30d

Description

Because the class-level properties of `AccelRange` and `GyroRange` are defined when the ICM20948 and ICM20649 are inited, the values overwrite each other if you use both in the same code. The values differ between both models (eg: RANGE_4G is 0 on ICM20649 and 1 on the other), and which values are allowed varies too. One solution would be to have them defined globally with all the values and have each model have its own translation table of allowed values. That would still allow using `AccelRange.RANGE_4G` in user code.
While an edge case, it was reported on discord.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing where AccelRange and GyroRange are defined and initialized for ICM20948 and ICM20649. Compare the model-specific allowed values and translations, then verify that both models can be used in the same program while preserving the public AccelRange.RANGE_4G form.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.