Skip to content

Commit

Permalink
Add new option to allow bypassing address validation in HT16K33 code …
Browse files Browse the repository at this point in the history
…to solve Issue rwaldron#1834
  • Loading branch information
chrisl8 committed Oct 15, 2023
1 parent 094bf6c commit c06680b
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lib/led/ledcontrol.js
Original file line number Diff line number Diff line change
Expand Up @@ -454,12 +454,15 @@ const Controllers = {
this.addresses = available.slice(0, state.devices);
}

this.addresses.forEach(address => {
if (!addresses.has(address)) {
throw new Error(`Invalid HT16K33 controller address: ${address}`);
}
addresses.delete(address);
});
if (!options.skipAddressValidation)
{
this.addresses.forEach(address => {
if (!addresses.has(address)) {
throw new Error(`Invalid HT16K33 controller address: ${address}`);
}
addresses.delete(address);
});
}

this.rotation = options.rotation || 1;
// set a default rotation that works with AdaFruit 16x8 matrix if using 16 columns
Expand Down

0 comments on commit c06680b

Please sign in to comment.