Skip to content
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

Allow using different models together #16

Open
Neradoc opened this issue Jun 7, 2022 · 1 comment
Open

Allow using different models together #16

Neradoc opened this issue Jun 7, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@Neradoc
Copy link

Neradoc commented Jun 7, 2022

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.

@tekktrik tekktrik added the bug Something isn't working label Jan 10, 2023
@tekktrik tekktrik self-assigned this Jan 10, 2023
@tekktrik tekktrik removed their assignment May 30, 2023
@FoamyGuy
Copy link
Contributor

FoamyGuy commented Dec 4, 2024

I looked into this and attempted a few solutions but I didn't come up with a way to do it as described.

I think it's not entirely possible that AccelRange.RANGE_4G can continue to work in user code, at least in the case where the user is making use of both sensors. RANGE_4G has different values for the different sensors so if both are in use somehow the user code would need to specify which one they are attempting to access.

My instinct is to move the AccelRange values onto the subclasses instead of the super class so that they would need to be accessed with like self.AccelRange or similar internally or instance.AccelRange externally. But I'm not sure that is a fully satisfying solution either as constants aren't typically accessed from the instance like that.

I am moving on for now and wanted to get my thoughts down here, I may circle back to this after some more thought.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants