Fix WLED UI handling non supported segment streaming (#1610)

This commit is contained in:
LordGrey 2023-07-10 20:39:35 +02:00 committed by GitHub
parent af1a31b842
commit 64642a4457
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 6 deletions

View File

@ -2331,6 +2331,7 @@ function updateElementsWled(ledType, key) {
var enumSegSelectVals = [];
var enumSegSelectTitleVals = [];
var enumSegSelectDefaultVal = "";
var defaultSegmentId = "-1";
if (devicesProperties[ledType] && devicesProperties[ledType][key]) {
var ledDeviceProperties = devicesProperties[ledType][key];
@ -2338,9 +2339,8 @@ function updateElementsWled(ledType, key) {
if (!jQuery.isEmptyObject(ledDeviceProperties)) {
if (ledDeviceProperties.info) {
if (ledDeviceProperties.info.liveseg && ledDeviceProperties.info.liveseg < 0) {
if (!ledDeviceProperties.info.hasOwnProperty("liveseg") || ledDeviceProperties.info.liveseg < 0) {
// "Use main segment only" is disabled
var defaultSegmentId = "-1";
enumSegSelectVals.push(defaultSegmentId);
enumSegSelectTitleVals.push($.i18n('edt_dev_spec_segments_disabled_title'));
enumSegSelectDefaultVal = defaultSegmentId;
@ -2392,13 +2392,12 @@ function updateElementsWled(ledType, key) {
hardwareLedCount = 1;
}
if (segmentConfig) {
if (segmentConfig && segmentConfig.streamSegmentId > defaultSegmentId) {
var configuredstreamSegmentId = window.serverConfig.device.segments.streamSegmentId.toString();
enumSegSelectVals = [configuredstreamSegmentId];
enumSegSelectTitleVals = ["Segment " + configuredstreamSegmentId];
enumSegSelectDefaultVal = configuredstreamSegmentId;
} else {
defaultSegmentId = "-1";
enumSegSelectVals.push(defaultSegmentId);
enumSegSelectTitleVals.push($.i18n('edt_dev_spec_segments_disabled_title'));
enumSegSelectDefaultVal = defaultSegmentId;

View File

@ -301,7 +301,7 @@ bool LedDeviceWled::isReadyForSegmentStreaming(semver::version& version) const
}
else
{
Error(_log, "Version provided to test for streaming readiness is not valid ");
Error(_log, "Version provided to test for segment streaming readiness is not valid ");
}
return isReady;
}
@ -325,7 +325,7 @@ bool LedDeviceWled::isReadyForDDPStreaming(semver::version& version) const
}
else
{
Error(_log, "Version provided to test for streaming readiness is not valid ");
Error(_log, "Version provided to test for DDP streaming readiness is not valid ");
}
return isReady;
}