Limit maximum LEDs number for WLED and UDP-Raw (#1334)

* Have maximum 490 LEDs configured for WLED and UDP-Raw

* Add additional Warning
This commit is contained in:
LordGrey
2021-09-20 09:36:59 +02:00
committed by GitHub
parent 8134917c51
commit 2a10ef955d
5 changed files with 94 additions and 5 deletions

View File

@@ -943,6 +943,11 @@ $(document).ready(function () {
params = { host: host, filter: "info" };
getProperties_device(ledType, host, params);
break;
case "udpraw":
getProperties_device(ledType, host, params);
break;
default:
}
}
@@ -1579,11 +1584,11 @@ async function identify_device(type, params) {
function updateElements(ledType, key) {
if (devicesProperties[ledType][key]) {
var hardwareLedCount = 1;
switch (ledType) {
case "cololight":
var ledProperties = devicesProperties[ledType][key];
var hardwareLedCount = 1;
if (ledProperties) {
hardwareLedCount = ledProperties.ledCount;
}
@@ -1592,8 +1597,14 @@ function updateElements(ledType, key) {
case "wled":
var ledProperties = devicesProperties[ledType][key];
if (ledProperties && ledProperties.leds) {
if (ledProperties && ledProperties.leds && ledProperties.maxLedCount) {
hardwareLedCount = ledProperties.leds.count;
var maxLedCount = ledProperties.maxLedCount
if (hardwareLedCount > maxLedCount)
{
showInfoDialog('warning', $.i18n("conf_leds_config_warning"), $.i18n('conf_leds_error_hwled_gt_maxled', hardwareLedCount, maxLedCount, maxLedCount));
hardwareLedCount = maxLedCount;
}
}
conf_editor.getEditor("root.generalOptions.hardwareLedCount").setValue(hardwareLedCount);
break;
@@ -1615,6 +1626,21 @@ function updateElements(ledType, key) {
break;
case "udpraw":
var ledProperties = devicesProperties[ledType][key];
if (ledProperties && ledProperties.maxLedCount) {
hardwareLedCount = conf_editor.getEditor("root.generalOptions.hardwareLedCount").getValue();
var maxLedCount = ledProperties.maxLedCount
if (hardwareLedCount > maxLedCount)
{
showInfoDialog('warning', $.i18n("conf_leds_config_warning"), $.i18n('conf_leds_error_hwled_gt_maxled', hardwareLedCount, maxLedCount, maxLedCount));
hardwareLedCount = maxLedCount;
}
updateJsonEditorRange(conf_editor, "root.generalOptions", "hardwareLedCount", 1, maxLedCount, hardwareLedCount);
}
break;
case "atmo":
case "karate":
var ledProperties = devicesProperties[ledType][key];