mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Correct PR1312 and LEDSim fixes (#1336)
* Revert Refactor/Optimization of PR1312 * LED Layout - Only update preview image when visible * Revert Debug updates * Correct Refactor/Optimization of PR1312 * LedSim: Do not stream LED data when not required, LedS-im/Layout: Sync on video streaming * Remove initial switch to instance 0 during API init
This commit is contained in:
parent
da49f25b4e
commit
8134917c51
@ -9,8 +9,7 @@
|
|||||||
"name": "Run hyperion with debug option and external console",
|
"name": "Run hyperion with debug option and external console",
|
||||||
"args": [
|
"args": [
|
||||||
"-d",
|
"-d",
|
||||||
"-c",
|
"-c"
|
||||||
"-u test"
|
|
||||||
],
|
],
|
||||||
"externalConsole": true
|
"externalConsole": true
|
||||||
}
|
}
|
||||||
|
10
assets/webconfig/js/content_index.js
Executable file → Normal file
10
assets/webconfig/js/content_index.js
Executable file → Normal file
@ -25,6 +25,8 @@ $(document).ready(function () {
|
|||||||
// comps
|
// comps
|
||||||
window.comps = event.response.info.components
|
window.comps = event.response.info.components
|
||||||
|
|
||||||
|
$(window.hyperion).trigger("ready");
|
||||||
|
|
||||||
window.comps.forEach(function (obj) {
|
window.comps.forEach(function (obj) {
|
||||||
if (obj.name == "ALL") {
|
if (obj.name == "ALL") {
|
||||||
if (obj.enabled)
|
if (obj.enabled)
|
||||||
@ -40,7 +42,6 @@ $(document).ready(function () {
|
|||||||
$('#btn_hypinstanceswitch').toggle(true)
|
$('#btn_hypinstanceswitch').toggle(true)
|
||||||
else
|
else
|
||||||
$('#btn_hypinstanceswitch').toggle(false)
|
$('#btn_hypinstanceswitch').toggle(false)
|
||||||
|
|
||||||
updateSessions();
|
updateSessions();
|
||||||
}); // end cmd-serverinfo
|
}); // end cmd-serverinfo
|
||||||
|
|
||||||
@ -121,11 +122,12 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
//Switch to last selected instance and load related config
|
//Switch to last selected instance and load related config
|
||||||
var lastSelectedInstance = getStorage('lastSelectedInstance', false);
|
var lastSelectedInstance = getStorage('lastSelectedInstance', false);
|
||||||
if (!window.serverInfo.instance[lastSelectedInstance]) {
|
if (lastSelectedInstance == null || window.serverInfo.instance && !window.serverInfo.instance[lastSelectedInstance]) {
|
||||||
lastSelectedInstance = 0;
|
lastSelectedInstance = 0;
|
||||||
}
|
}
|
||||||
instanceSwitch(lastSelectedInstance);
|
instanceSwitch(lastSelectedInstance);
|
||||||
|
|
||||||
|
requestSysInfo();
|
||||||
});
|
});
|
||||||
|
|
||||||
$(window.hyperion).on("cmd-config-getconfig", function (event) {
|
$(window.hyperion).on("cmd-config-getconfig", function (event) {
|
||||||
@ -157,8 +159,6 @@ $(document).ready(function () {
|
|||||||
if (event.response.hasOwnProperty('info'))
|
if (event.response.hasOwnProperty('info'))
|
||||||
setStorage("loginToken", event.response.info.token, true);
|
setStorage("loginToken", event.response.info.token, true);
|
||||||
|
|
||||||
requestSysInfo();
|
|
||||||
requestServerInfo();
|
|
||||||
requestServerConfigSchema();
|
requestServerConfigSchema();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -218,7 +218,7 @@ $(document).ready(function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$(window.hyperion).one("ready", function (event) {
|
$(window.hyperion).one("ready", function (event) {
|
||||||
loadContent();
|
// Content will be loaded by the instance load/switch
|
||||||
});
|
});
|
||||||
|
|
||||||
$(window.hyperion).on("cmd-adjustment-update", function (event) {
|
$(window.hyperion).on("cmd-adjustment-update", function (event) {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
var ledsCustomCfgInitialized = false;
|
var ledsCustomCfgInitialized = false;
|
||||||
|
var onLedLayoutTab = false;
|
||||||
var nonBlacklistLedArray = [];
|
var nonBlacklistLedArray = [];
|
||||||
var ledBlacklist = [];
|
var ledBlacklist = [];
|
||||||
var finalLedArray = [];
|
var finalLedArray = [];
|
||||||
@ -568,9 +569,12 @@ $(document).ready(function () {
|
|||||||
// toggle live video
|
// toggle live video
|
||||||
$('#leds_prev_toggle_live_video').off().on("click", function () {
|
$('#leds_prev_toggle_live_video').off().on("click", function () {
|
||||||
setClassByBool('#leds_prev_toggle_live_video', window.imageStreamActive, "btn-success", "btn-danger");
|
setClassByBool('#leds_prev_toggle_live_video', window.imageStreamActive, "btn-success", "btn-danger");
|
||||||
if (window.imageStreamActive) {
|
|
||||||
requestLedImageStop();
|
if (onLedLayoutTab && window.imageStreamActive) {
|
||||||
imageCanvasNodeCtx.clear();
|
imageCanvasNodeCtx.clear();
|
||||||
|
if (!$('#leds_toggle_live_video').hasClass("btn-success")) {
|
||||||
|
requestLedImageStop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
requestLedImageStart();
|
requestLedImageStart();
|
||||||
@ -578,6 +582,8 @@ $(document).ready(function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$(window.hyperion).on("cmd-ledcolors-imagestream-update", function (event) {
|
$(window.hyperion).on("cmd-ledcolors-imagestream-update", function (event) {
|
||||||
|
//Only update Image, if LED Layout Tab is visible
|
||||||
|
if (onLedLayoutTab && window.imageStreamActive) {
|
||||||
setClassByBool('#leds_prev_toggle_live_video', window.imageStreamActive, "btn-danger", "btn-success");
|
setClassByBool('#leds_prev_toggle_live_video', window.imageStreamActive, "btn-danger", "btn-success");
|
||||||
var imageData = (event.response.result.image);
|
var imageData = (event.response.result.image);
|
||||||
|
|
||||||
@ -586,6 +592,7 @@ $(document).ready(function () {
|
|||||||
imageCanvasNodeCtx.drawImage(image, 0, 0, imageCanvasNodeCtx.canvas.width, imageCanvasNodeCtx.canvas.height);
|
imageCanvasNodeCtx.drawImage(image, 0, 0, imageCanvasNodeCtx.canvas.width, imageCanvasNodeCtx.canvas.height);
|
||||||
};
|
};
|
||||||
image.src = imageData;
|
image.src = imageData;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// open checklist
|
// open checklist
|
||||||
@ -605,10 +612,15 @@ $(document).ready(function () {
|
|||||||
// nav
|
// nav
|
||||||
$('#leds_cfg_nav a[data-toggle="tab"]').off().on('shown.bs.tab', function (e) {
|
$('#leds_cfg_nav a[data-toggle="tab"]').off().on('shown.bs.tab', function (e) {
|
||||||
var target = $(e.target).attr("href") // activated tab
|
var target = $(e.target).attr("href") // activated tab
|
||||||
if (target == "#menu_gencfg" && !ledsCustomCfgInitialized) {
|
if (target == "#menu_gencfg") {
|
||||||
|
onLedLayoutTab = true;
|
||||||
|
if (!ledsCustomCfgInitialized) {
|
||||||
$('#leds_custom_updsim').trigger('click');
|
$('#leds_custom_updsim').trigger('click');
|
||||||
ledsCustomCfgInitialized = true;
|
ledsCustomCfgInitialized = true;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
onLedLayoutTab = false;
|
||||||
|
}
|
||||||
|
|
||||||
blacklist_editor.on('change', function () {
|
blacklist_editor.on('change', function () {
|
||||||
// only update preview, if config is valid
|
// only update preview, if config is valid
|
||||||
|
@ -11,7 +11,7 @@ $(document).ready(function () {
|
|||||||
var canvas_height;
|
var canvas_height;
|
||||||
var canvas_width;
|
var canvas_width;
|
||||||
var twoDPaths = [];
|
var twoDPaths = [];
|
||||||
var toggleLeds = false;
|
var toggleLeds = true;
|
||||||
var toggleLedsNum = false;
|
var toggleLedsNum = false;
|
||||||
var toggleSigDetectArea = false;
|
var toggleSigDetectArea = false;
|
||||||
|
|
||||||
@ -109,6 +109,9 @@ $(document).ready(function () {
|
|||||||
lC = true;
|
lC = true;
|
||||||
}
|
}
|
||||||
modalOpened = true;
|
modalOpened = true;
|
||||||
|
|
||||||
|
setClassByBool('#leds_toggle', toggleLeds, "btn-danger", "btn-success");
|
||||||
|
if ($('#leds_toggle').hasClass('btn-success'))
|
||||||
requestLedColorsStart();
|
requestLedColorsStart();
|
||||||
|
|
||||||
setClassByBool('#leds_toggle_live_video', window.imageStreamActive, "btn-danger", "btn-success");
|
setClassByBool('#leds_toggle_live_video', window.imageStreamActive, "btn-danger", "btn-success");
|
||||||
@ -145,7 +148,7 @@ $(document).ready(function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// toggle leds, do not print
|
// toggle leds, do not print
|
||||||
if (toggleLeds)
|
if (!toggleLeds)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var useColor = false;
|
var useColor = false;
|
||||||
@ -220,10 +223,16 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
$('#leds_toggle').off().on("click", function () {
|
$('#leds_toggle').off().on("click", function () {
|
||||||
toggleLeds = !toggleLeds
|
toggleLeds = !toggleLeds
|
||||||
|
|
||||||
|
if (window.ledStreamActive) {
|
||||||
|
requestLedColorsStop();
|
||||||
ledsCanvasNodeCtx.clear();
|
ledsCanvasNodeCtx.clear();
|
||||||
|
} else {
|
||||||
|
requestLedColorsStart();
|
||||||
|
}
|
||||||
toggleClass('#leds_toggle', "btn-success", "btn-danger");
|
toggleClass('#leds_toggle', "btn-success", "btn-danger");
|
||||||
|
|
||||||
if (!toggleLeds) {
|
if (toggleLeds) {
|
||||||
$("#leds_toggle_num").show();
|
$("#leds_toggle_num").show();
|
||||||
} else {
|
} else {
|
||||||
$("#leds_toggle_num").hide();
|
$("#leds_toggle_num").hide();
|
||||||
@ -234,6 +243,7 @@ $(document).ready(function () {
|
|||||||
$('#leds_toggle_live_video').off().on("click", function () {
|
$('#leds_toggle_live_video').off().on("click", function () {
|
||||||
setClassByBool('#leds_toggle_live_video', window.imageStreamActive, "btn-success", "btn-danger");
|
setClassByBool('#leds_toggle_live_video', window.imageStreamActive, "btn-success", "btn-danger");
|
||||||
if (window.imageStreamActive) {
|
if (window.imageStreamActive) {
|
||||||
|
$('#leds_prev_toggle_live_video').trigger('click');
|
||||||
requestLedImageStop();
|
requestLedImageStop();
|
||||||
resetImage();
|
resetImage();
|
||||||
}
|
}
|
||||||
@ -260,13 +270,12 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
$(window.hyperion).on("cmd-ledcolors-imagestream-update", function (event) {
|
$(window.hyperion).on("cmd-ledcolors-imagestream-update", function (event) {
|
||||||
//console.log("cmd-ledcolors-imagestream-update", event.response);
|
|
||||||
setClassByBool('#leds_toggle_live_video', window.imageStreamActive, "btn-danger", "btn-success");
|
setClassByBool('#leds_toggle_live_video', window.imageStreamActive, "btn-danger", "btn-success");
|
||||||
if (!modalOpened) {
|
if (!modalOpened) {
|
||||||
if ($('#leds_prev_toggle_live_video').length > 0)
|
if (!$('#leds_prev_toggle_live_video').hasClass("btn-success")) {
|
||||||
return;
|
|
||||||
requestLedImageStop();
|
requestLedImageStop();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
var imageData = (event.response.result.image);
|
var imageData = (event.response.result.image);
|
||||||
|
|
||||||
|
@ -98,8 +98,6 @@ void JsonAPI::initialize()
|
|||||||
{
|
{
|
||||||
// init API, REQUIRED!
|
// init API, REQUIRED!
|
||||||
API::init();
|
API::init();
|
||||||
// REMOVE when jsonCB is migrated
|
|
||||||
handleInstanceSwitch(0);
|
|
||||||
|
|
||||||
// setup auth interface
|
// setup auth interface
|
||||||
connect(this, &API::onPendingTokenRequest, this, &JsonAPI::newPendingTokenRequest);
|
connect(this, &API::onPendingTokenRequest, this, &JsonAPI::newPendingTokenRequest);
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
// Constants
|
// Constants
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
const bool verbose = true;
|
const bool verbose = false;
|
||||||
|
|
||||||
// Configuration settings
|
// Configuration settings
|
||||||
const char CONFIG_ADDRESS[] = "host";
|
const char CONFIG_ADDRESS[] = "host";
|
||||||
|
Loading…
Reference in New Issue
Block a user