Skip to content

Commit

Permalink
Dynamic PWM settings for v0.22.x #404
Browse files Browse the repository at this point in the history
  • Loading branch information
stylesuxx committed Dec 6, 2023
1 parent 5aaf929 commit b746acf
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/sources/Bluejay/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
},
],
Expand Down Expand Up @@ -608,6 +606,7 @@ DEFAULTS['209'] = { // v0.22
...DEFAULTS['208'],
PWM_FREQUENCY: 24,
STARTUP_MELODY_WAIT_MS: 0,
THRESHOLD_96to48: 85,
THRESHOLD_48to24: 170,
};

Expand Down

0 comments on commit b746acf

Please sign in to comment.