mirror of
				https://github.com/hyperion-project/hyperion.ng.git
				synced 2025-03-01 10:33:28 +00: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:
		| @@ -9,8 +9,7 @@ | ||||
|       "name": "Run hyperion with debug option and external console", | ||||
|       "args": [ | ||||
|         "-d", | ||||
|         "-c", | ||||
|         "-u test" | ||||
|         "-c" | ||||
|       ], | ||||
|       "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 | ||||
|     window.comps = event.response.info.components | ||||
|  | ||||
|     $(window.hyperion).trigger("ready"); | ||||
|  | ||||
|     window.comps.forEach(function (obj) { | ||||
|       if (obj.name == "ALL") { | ||||
|         if (obj.enabled) | ||||
| @@ -40,7 +42,6 @@ $(document).ready(function () { | ||||
|       $('#btn_hypinstanceswitch').toggle(true) | ||||
|     else | ||||
|       $('#btn_hypinstanceswitch').toggle(false) | ||||
|  | ||||
|     updateSessions(); | ||||
|   }); // end cmd-serverinfo | ||||
|  | ||||
| @@ -121,11 +122,12 @@ $(document).ready(function () { | ||||
|  | ||||
|     //Switch to last selected instance and load related config | ||||
|     var lastSelectedInstance = getStorage('lastSelectedInstance', false); | ||||
|     if (!window.serverInfo.instance[lastSelectedInstance]) { | ||||
|     if (lastSelectedInstance == null || window.serverInfo.instance && !window.serverInfo.instance[lastSelectedInstance]) { | ||||
|       lastSelectedInstance = 0; | ||||
|     } | ||||
|     instanceSwitch(lastSelectedInstance); | ||||
|  | ||||
|     requestSysInfo(); | ||||
|   }); | ||||
|  | ||||
|   $(window.hyperion).on("cmd-config-getconfig", function (event) { | ||||
| @@ -157,8 +159,6 @@ $(document).ready(function () { | ||||
|     if (event.response.hasOwnProperty('info')) | ||||
|       setStorage("loginToken", event.response.info.token, true); | ||||
|  | ||||
|     requestSysInfo(); | ||||
|     requestServerInfo(); | ||||
|     requestServerConfigSchema(); | ||||
|   }); | ||||
|  | ||||
| @@ -218,7 +218,7 @@ $(document).ready(function () { | ||||
|   }); | ||||
|  | ||||
|   $(window.hyperion).one("ready", function (event) { | ||||
|     loadContent(); | ||||
|     // Content will be loaded by the instance load/switch | ||||
|   }); | ||||
|  | ||||
|   $(window.hyperion).on("cmd-adjustment-update", function (event) { | ||||
|   | ||||
| @@ -1,4 +1,5 @@ | ||||
| var ledsCustomCfgInitialized = false; | ||||
| var onLedLayoutTab = false; | ||||
| var nonBlacklistLedArray = []; | ||||
| var ledBlacklist = []; | ||||
| var finalLedArray = []; | ||||
| @@ -568,9 +569,12 @@ $(document).ready(function () { | ||||
|   // toggle live video | ||||
|   $('#leds_prev_toggle_live_video').off().on("click", function () { | ||||
|     setClassByBool('#leds_prev_toggle_live_video', window.imageStreamActive, "btn-success", "btn-danger"); | ||||
|     if (window.imageStreamActive) { | ||||
|       requestLedImageStop(); | ||||
|  | ||||
|     if (onLedLayoutTab && window.imageStreamActive) { | ||||
|       imageCanvasNodeCtx.clear(); | ||||
|       if (!$('#leds_toggle_live_video').hasClass("btn-success")) { | ||||
|         requestLedImageStop(); | ||||
|       } | ||||
|     } | ||||
|     else { | ||||
|       requestLedImageStart(); | ||||
| @@ -578,14 +582,17 @@ $(document).ready(function () { | ||||
|   }); | ||||
|  | ||||
|   $(window.hyperion).on("cmd-ledcolors-imagestream-update", function (event) { | ||||
|     setClassByBool('#leds_prev_toggle_live_video', window.imageStreamActive, "btn-danger", "btn-success"); | ||||
|     var imageData = (event.response.result.image); | ||||
|     //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"); | ||||
|       var imageData = (event.response.result.image); | ||||
|  | ||||
|     var image = new Image(); | ||||
|     image.onload = function () { | ||||
|       imageCanvasNodeCtx.drawImage(image, 0, 0, imageCanvasNodeCtx.canvas.width, imageCanvasNodeCtx.canvas.height); | ||||
|     }; | ||||
|     image.src = imageData; | ||||
|       var image = new Image(); | ||||
|       image.onload = function () { | ||||
|         imageCanvasNodeCtx.drawImage(image, 0, 0, imageCanvasNodeCtx.canvas.width, imageCanvasNodeCtx.canvas.height); | ||||
|       }; | ||||
|       image.src = imageData; | ||||
|     } | ||||
|   }); | ||||
|  | ||||
|   // open checklist | ||||
| @@ -605,9 +612,14 @@ $(document).ready(function () { | ||||
|   // nav | ||||
|   $('#leds_cfg_nav a[data-toggle="tab"]').off().on('shown.bs.tab', function (e) { | ||||
|     var target = $(e.target).attr("href") // activated tab | ||||
|     if (target == "#menu_gencfg" && !ledsCustomCfgInitialized) { | ||||
|       $('#leds_custom_updsim').trigger('click'); | ||||
|       ledsCustomCfgInitialized = true; | ||||
|     if (target == "#menu_gencfg") { | ||||
|       onLedLayoutTab = true; | ||||
|       if (!ledsCustomCfgInitialized) { | ||||
|         $('#leds_custom_updsim').trigger('click'); | ||||
|         ledsCustomCfgInitialized = true; | ||||
|       } | ||||
|     } else { | ||||
|       onLedLayoutTab = false; | ||||
|     } | ||||
|  | ||||
|     blacklist_editor.on('change', function () { | ||||
|   | ||||
| @@ -11,7 +11,7 @@ $(document).ready(function () { | ||||
|   var canvas_height; | ||||
|   var canvas_width; | ||||
|   var twoDPaths = []; | ||||
|   var toggleLeds = false; | ||||
|   var toggleLeds = true; | ||||
|   var toggleLedsNum = false; | ||||
|   var toggleSigDetectArea = false; | ||||
|  | ||||
| @@ -109,7 +109,10 @@ $(document).ready(function () { | ||||
|           lC = true; | ||||
|         } | ||||
|         modalOpened = true; | ||||
|         requestLedColorsStart(); | ||||
|  | ||||
|         setClassByBool('#leds_toggle', toggleLeds, "btn-danger", "btn-success"); | ||||
|         if ($('#leds_toggle').hasClass('btn-success')) | ||||
|           requestLedColorsStart(); | ||||
|  | ||||
|         setClassByBool('#leds_toggle_live_video', window.imageStreamActive, "btn-danger", "btn-success"); | ||||
|         if ($('#leds_toggle_live_video').hasClass('btn-success')) | ||||
| @@ -145,7 +148,7 @@ $(document).ready(function () { | ||||
|     } | ||||
|  | ||||
|     // toggle leds, do not print | ||||
|     if (toggleLeds) | ||||
|     if (!toggleLeds) | ||||
|       return; | ||||
|  | ||||
|     var useColor = false; | ||||
| @@ -220,10 +223,16 @@ $(document).ready(function () { | ||||
|  | ||||
|   $('#leds_toggle').off().on("click", function () { | ||||
|     toggleLeds = !toggleLeds | ||||
|     ledsCanvasNodeCtx.clear(); | ||||
|  | ||||
|     if (window.ledStreamActive) { | ||||
|       requestLedColorsStop(); | ||||
|       ledsCanvasNodeCtx.clear(); | ||||
|     } else { | ||||
|       requestLedColorsStart(); | ||||
|     } | ||||
|     toggleClass('#leds_toggle', "btn-success", "btn-danger"); | ||||
|  | ||||
|     if (!toggleLeds) { | ||||
|     if (toggleLeds) { | ||||
|       $("#leds_toggle_num").show(); | ||||
|     } else { | ||||
|       $("#leds_toggle_num").hide(); | ||||
| @@ -234,6 +243,7 @@ $(document).ready(function () { | ||||
|   $('#leds_toggle_live_video').off().on("click", function () { | ||||
|     setClassByBool('#leds_toggle_live_video', window.imageStreamActive, "btn-success", "btn-danger"); | ||||
|     if (window.imageStreamActive) { | ||||
|       $('#leds_prev_toggle_live_video').trigger('click'); | ||||
|       requestLedImageStop(); | ||||
|       resetImage(); | ||||
|     } | ||||
| @@ -260,12 +270,11 @@ $(document).ready(function () { | ||||
|  | ||||
|   // ------------------------------------------------------------------ | ||||
|   $(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"); | ||||
|     if (!modalOpened) { | ||||
|       if ($('#leds_prev_toggle_live_video').length > 0) | ||||
|         return; | ||||
|       requestLedImageStop(); | ||||
|       if (!$('#leds_prev_toggle_live_video').hasClass("btn-success")) { | ||||
|         requestLedImageStop(); | ||||
|       } | ||||
|     } | ||||
|     else { | ||||
|       var imageData = (event.response.result.image); | ||||
|   | ||||
| @@ -98,8 +98,6 @@ void JsonAPI::initialize() | ||||
| { | ||||
| 	// init API, REQUIRED! | ||||
| 	API::init(); | ||||
| 	// REMOVE when jsonCB is migrated | ||||
| 	handleInstanceSwitch(0); | ||||
|  | ||||
| 	// setup auth interface | ||||
| 	connect(this, &API::onPendingTokenRequest, this, &JsonAPI::newPendingTokenRequest); | ||||
|   | ||||
| @@ -10,7 +10,7 @@ | ||||
| // Constants | ||||
| namespace { | ||||
|  | ||||
| const bool verbose = true; | ||||
| const bool verbose = false; | ||||
|  | ||||
| // Configuration settings | ||||
| const char CONFIG_ADDRESS[] = "host"; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user