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 bypassing address validation in HT16K33 code to address Issue #1834 #1835

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

chrisl8
Copy link

@chrisl8 chrisl8 commented Oct 15, 2023

Allow adding an option called skipAddressValidation when calling the Led.Digits function to skip validating the given address and deleting them.

This will address Issue #1834

This allows using multiple HT16K33 devices on different external boards that might all be on the same address.

This is the only option I could come up with that I feel confident won't affect any existing code that may depend on the current functionality.

I've also added documentation for the option in the place that made the most sense to me.

Please let me know if you feel this option is reasonable, and if so, if I need to add any tests for this before acceptance.

@chrisl8 chrisl8 force-pushed the allow-bypassing-address-check branch from c06680b to 809cee7 Compare October 20, 2023 01:08
@dtex
Copy link
Collaborator

dtex commented Oct 22, 2023

My only concern is that this doesn't solve things for the auto-addressing of multiple HT16K33s across multiple boards.

What if we stored addresses in a WeakMap with boards as keys? It wouldn't require changes to the API, would still protect addresses from reuse, and support multiple boards.

@chrisl8
Copy link
Author

chrisl8 commented Oct 25, 2023

My only concern is that this doesn't solve things for the auto-addressing of multiple HT16K33s across multiple boards.

I was just taking the "easy way out" with the assumption that I'm the only person on the planet even doing this, but my way definitely leaves users like me without that feature.

That feature seems a little odd to me, as I would expect anyone using multiple HT16K33s to already know their addresses, and want to address each one specifically rather than letting the code "guess" for them.

What if we stored addresses in a WeakMap with boards as keys? It wouldn't require changes to the API, would still protect addresses from reuse, and support multiple boards.

That sounds like a good idea to me. I can try to revisit this when I have free time again.

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