From b746acf4bcd6baacd00b6763036d3b862e3aba66 Mon Sep 17 00:00:00 2001 From: Chris L Date: Wed, 6 Dec 2023 02:44:00 +0100 Subject: [PATCH] Dynamic PWM settings for v0.22.x #404 --- src/sources/Bluejay/settings.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/sources/Bluejay/settings.js b/src/sources/Bluejay/settings.js index c8d6f0679..883773b2f 100644 --- a/src/sources/Bluejay/settings.js +++ b/src/sources/Bluejay/settings.js @@ -429,30 +429,28 @@ COMMON['209'] = { }], }, { - name: 'THRESHOLD_48to24', + name: 'THRESHOLD_96to48', type: 'number', min: 0, max: 255, step: 1, - displayFactor: 100 / 255, - label: '48to24Threshold', + label: '96to48Threshold', visibleIf: (settings) => ('PWM_FREQUENCY' in settings) && (parseInt(settings.PWM_FREQUENCY, 10) === 0), - sanitize: (value, settings) => { - if(value > settings.THRESHOLD_96to48) { - return settings.THRESHOLD_96to48; + sanitize: (settings) => { + if(settings.THRESHOLD_96to48 > settings.THRESHOLD_48to24) { + return { THRESHOLD_96to48: settings.THRESHOLD_48to24 }; } - return value; + return {}; }, }, { - name: 'THRESHOLD_96to48', + name: 'THRESHOLD_48to24', type: 'number', min: 0, max: 255, step: 1, - displayFactor: 100 / 255, - label: '96to48Threshold', + label: '48to24Threshold', visibleIf: (settings) => ('PWM_FREQUENCY' in settings) && (parseInt(settings.PWM_FREQUENCY, 10) === 0), }, ], @@ -608,6 +606,7 @@ DEFAULTS['209'] = { // v0.22 ...DEFAULTS['208'], PWM_FREQUENCY: 24, STARTUP_MELODY_WAIT_MS: 0, + THRESHOLD_96to48: 85, THRESHOLD_48to24: 170, };