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

@@ -57,6 +57,7 @@
"conf_leds_device_intro": "Hyperion supports a lot of controllers to transmit data to your target device. Select a LED controller out of the sorted list and configure it. We have chosen the best default settings for each device.",
"conf_leds_error_hwled_gt_layout": "The hardware LED count ($1) is greater than LEDs configured via layout ($2),<br>$3 {{plural:$3|LED|LEDs}} will stay black if you continue.",
"conf_leds_error_hwled_lt_layout": "The hardware LED count ($1) is less than LEDs configured via layout ($2). <br> The number of LEDs configured in the layout must not exceed the available LEDs",
"conf_leds_error_hwled_gt_maxled": "The hardware LED count ($1) is greater than the maximum number of LEDs supported by the device ($2). <br> The hardware LED count is set to ($3).",
"conf_leds_info_ws281x": "Hyperion must run with 'root' privileges for this controller type!",
"conf_leds_layout_advanced": "Advanced Settings",
"conf_leds_layout_blacklist_num_title": "Number of LEDs",

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];