LED-Device updates (#1315)

* SPI Fix - Free allocated memory in case of invert

* Remove development statement

* UI updates

* Minor corrections

* Tpm2net Fix - Free allocated memory

* LGTM Finding

* Add config directory and user type to SysInfo

* WS281x - Ensure that device runs with root priviliges

* WS281x - Update DMA defauls as per rpi_ws281x recommendation

* Support Sysinfo for Qt < 5.10

* Address LGTM finding
This commit is contained in:
LordGrey
2021-09-15 10:31:56 +02:00
committed by GitHub
parent 8fb3d76b9c
commit 8a785e70c8
18 changed files with 214 additions and 53 deletions

View File

@@ -37,7 +37,13 @@
<div class="panel-body">
<div id="btn_wiz_holder"></div>
<div id='editor_container_leddevice'></div>
<div class="bs-callout bs-callout-info" style="margin-top:0px"><h4 data-i18n="dashboard_infobox_label_title">Information</h4><span data-i18n="conf_leds_device_info_log"> In case your LEDs do not work, check here for errors: </span> <a onclick="SwitchToMenuItem('MenuItemLogging')" data-i18n="main_menu_logging_token" style="cursor:pointer"></a></div>
<div id='info_container' class="bs-callout bs-callout-info" style="margin-top:0px">
<h4 data-i18n="dashboard_infobox_label_title">Information</h4>
<div id='info_container_text'>
<span data-i18n="conf_leds_device_info_log"> In case your LEDs do not work, check here for errors: </span>
<a onclick="SwitchToMenuItem('MenuItemLogging')" data-i18n="main_menu_logging_token" style="cursor:pointer"></a>
</div>
</div>
</div>
<div class="panel-footer" style="text-align:right">
<button id='btn_test_controller' class="btn btn-primary" disabled data-toggle="tooltip" data-placement="top" title="Identify configured device by lighting it up">
@@ -395,3 +401,4 @@
</div>
<script src="/js/content_leds.js"></script>

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_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",
"conf_leds_layout_blacklist_rule_title": "Blacklist rule",

View File

@@ -755,7 +755,7 @@ $(document).ready(function () {
updateJsonEditorSelection(conf_editor_video, 'root.grabberV4L2',
'available_devices', {}, enumVals, enumTitelVals, enumDefaultVal, addSelect, false);
}
}
};
async function discoverInputSources(type, params) {
const result = await requestInputSourcesDiscovery(type, params);

View File

@@ -16,6 +16,8 @@ var devNET = ['atmoorb', 'cololight', 'fadecandy', 'philipshue', 'nanoleaf', 'ti
var devSerial = ['adalight', 'dmx', 'atmo', 'sedu', 'tpm2', 'karate'];
var devHID = ['hyperionusbasp', 'lightpack', 'paintpack', 'rawhid'];
var infoTextDefault = '<span>' + $.i18n("conf_leds_device_info_log") + ' </span><a href="" onclick="SwitchToMenuItem(\'MenuItemLogging\')" style="cursor:pointer">' + $.i18n("main_menu_logging_token") + '</a>';
function round(number) {
var factor = Math.pow(10, 4);
var tempNumber = number * factor;
@@ -664,6 +666,8 @@ $(document).ready(function () {
conf_editor.getEditor("root.specificOptions").setValue(values_specific);
};
$("#info_container_text").html(infoTextDefault);
// change save button state based on validation result
conf_editor.validate().length || window.readOnlyMode ? $('#btn_submit_controller').attr('disabled', true) : $('#btn_submit_controller').attr('disabled', false);
@@ -727,6 +731,7 @@ $(document).ready(function () {
case "sk9822":
case "ws2812spi":
case "piblaster":
case "ws281x":
discover_device(ledType);
hwLedCountDefault = 1;
colorOrderDefault = "rgb";
@@ -1313,6 +1318,8 @@ var updateSelectList = function (ledType, discoveryInfo) {
ledTypeGroup = "devRPiSPI";
} else if ($.inArray(ledType, devRPiGPIO) != -1) {
ledTypeGroup = "devRPiGPIO";
} else if ($.inArray(ledType, devRPiPWM) != -1) {
ledTypeGroup = "devRPiPWM";
}
switch (ledTypeGroup) {
@@ -1473,6 +1480,18 @@ var updateSelectList = function (ledType, discoveryInfo) {
}
}
break;
case "devRPiPWM":
key = ledType;
if (discoveryInfo.devices.length == 0) {
enumVals.push("NONE");
enumTitelVals.push($.i18n('edt_dev_spec_devices_discovered_none'));
$('#btn_submit_controller').attr('disabled', true);
showAllDeviceInputOptions(key, false);
$("#info_container_text").html($.i18n("conf_leds_info_ws281x"));
}
break;
default:
}

View File

@@ -4,10 +4,11 @@ var isScroll = true;
performTranslation();
requestLoggingStop();
requestLoggingStart();
$(document).ready(function () {
requestLoggingStart();
$('#conf_cont').append(createOptPanel('fa-reorder', $.i18n("edt_conf_log_heading_title"), 'editor_container', 'btn_submit'));
if (window.showOptHelp) {
$('#conf_cont').append(createHelpTable(window.schema.logger.properties, $.i18n("edt_conf_log_heading_title")));

View File

@@ -110,8 +110,16 @@ function loadContent(event, forceRefresh) {
$("#page-content").off();
$("#page-content").load("/content/" + tag + ".html", function (response, status, xhr) {
if (status == "error") {
$("#page-content").html('<h3>' + $.i18n('info_404') + '</h3>');
removeOverlay();
tag = 'dashboard';
console.log("Could not find page:", prevTag, ", Redirecting to:", tag);
setStorage('lasthashtag', tag, true);
$("#page-content").load("/content/" + tag + ".html", function (response, status, xhr) {
if (status == "error") {
$("#page-content").html('<h3>' + encode_utf8(tag) + '<br/>' + $.i18n('info_404') + '</h3>');
removeOverlay();
}
});
}
updateUiOnInstance(window.currentHyperionInstance);
});
@@ -710,7 +718,11 @@ function hexToRgb(hex) {
r: parseInt(result[1], 16),
g: parseInt(result[2], 16),
b: parseInt(result[3], 16)
} : null;
} : {
r: 0,
g: 0,
b: 0
};
}
/*
@@ -1135,6 +1147,7 @@ function getSystemInfo() {
info += '- UI Access: ' + storedAccess + '\n';
//info += '- Log lvl: ' + window.serverConfig.logger.level + '\n';
info += '- Avail Capt: ' + window.serverInfo.grabbers.available + '\n';
info += '- Config path: ' + shy.rootPath + '\n';
info += '- Database: ' + (shy.readOnlyMode ? "ready-only" : "read/write") + '\n';
info += '\n';
@@ -1153,6 +1166,7 @@ function getSystemInfo() {
info += '- CPU Hardware: ' + sys.cpuHardware + '\n';
info += '- Kernel: ' + sys.kernelType + ' (' + sys.kernelVersion + ' (WS: ' + sys.wordSize + '))\n';
info += '- Root/Admin: ' + sys.isUserAdmin + '\n';
info += '- Qt Version: ' + sys.qtVersion + '\n';
info += '- Python Version: ' + sys.pyVersion + '\n';
info += '- Browser: ' + navigator.userAgent;