From c06680bc1e88af74ac0a35d288b5747662f77157 Mon Sep 17 00:00:00 2001 From: Christen Lofland Date: Sat, 14 Oct 2023 19:35:52 -0500 Subject: [PATCH] Add new option to allow bypassing address validation in HT16K33 code to solve Issue #1834 --- lib/led/ledcontrol.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/led/ledcontrol.js b/lib/led/ledcontrol.js index b00d37e35..49464365c 100644 --- a/lib/led/ledcontrol.js +++ b/lib/led/ledcontrol.js @@ -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