|
@@ -1749,8 +1749,8 @@ function cameraParameterChanged() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-function LoadConfigNeu() {
|
|
|
|
|
- if (!loadConfig(domainname)) {
|
|
|
|
|
|
|
+async function LoadConfigNeu() {
|
|
|
|
|
+ if (!await loadConfig(domainname)) {
|
|
|
firework.launch('Configuration could not be loaded! Please reload the page!', 'danger', 30000);
|
|
firework.launch('Configuration could not be loaded! Please reload the page!', 'danger', 30000);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -1760,7 +1760,7 @@ function LoadConfigNeu() {
|
|
|
category = getConfigCategory();
|
|
category = getConfigCategory();
|
|
|
InitIndivParameter();
|
|
InitIndivParameter();
|
|
|
|
|
|
|
|
- UpdateInput();
|
|
|
|
|
|
|
+ await UpdateInput();
|
|
|
var sel = document.getElementById("Numbers_value1");
|
|
var sel = document.getElementById("Numbers_value1");
|
|
|
UpdateInputIndividual(sel);
|
|
UpdateInputIndividual(sel);
|
|
|
|
|
|
|
@@ -1881,7 +1881,7 @@ function UpdateInputIndividual(sel) {
|
|
|
WriteParameter(param, category, "MQTT", "DomoticzIDX", true, NUNBERSAkt);
|
|
WriteParameter(param, category, "MQTT", "DomoticzIDX", true, NUNBERSAkt);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-function UpdateInput() {
|
|
|
|
|
|
|
+async function UpdateInput() {
|
|
|
document.getElementById("Category_Digits_enabled").checked = category["Digits"]["enabled"];
|
|
document.getElementById("Category_Digits_enabled").checked = category["Digits"]["enabled"];
|
|
|
setVisible("DigitItem", category["Digits"]["enabled"]);
|
|
setVisible("DigitItem", category["Digits"]["enabled"]);
|
|
|
|
|
|
|
@@ -2011,11 +2011,11 @@ function UpdateInput() {
|
|
|
WriteParameter(param, category, "System", "RSSIThreshold", true);
|
|
WriteParameter(param, category, "System", "RSSIThreshold", true);
|
|
|
WriteParameter(param, category, "System", "CPUFrequency", true);
|
|
WriteParameter(param, category, "System", "CPUFrequency", true);
|
|
|
|
|
|
|
|
- WriteModelFiles();
|
|
|
|
|
|
|
+ await WriteModelFiles();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-function WriteModelFiles() {
|
|
|
|
|
- list_tflite = getTFLITEList();
|
|
|
|
|
|
|
+async function WriteModelFiles() {
|
|
|
|
|
+ list_tflite = await getTFLITEList();
|
|
|
|
|
|
|
|
var _indexDig = document.getElementById("Digits_Model_value1");
|
|
var _indexDig = document.getElementById("Digits_Model_value1");
|
|
|
var _indexAna = document.getElementById("Analog_Model_value1");
|
|
var _indexAna = document.getElementById("Analog_Model_value1");
|
|
@@ -2256,7 +2256,7 @@ function UpdateTooltipModus() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-function saveTextAsFile() {
|
|
|
|
|
|
|
+async function saveTextAsFile() {
|
|
|
if (window.GPIO_PROFILE_LOADED !== true) {
|
|
if (window.GPIO_PROFILE_LOADED !== true) {
|
|
|
firework.launch("The GPIO board profile is not available. Reload the page before saving configuration.", "danger", 10000);
|
|
firework.launch("The GPIO board profile is not available. Reload the page before saving configuration.", "danger", 10000);
|
|
|
return;
|
|
return;
|
|
@@ -2280,7 +2280,10 @@ function saveTextAsFile() {
|
|
|
|
|
|
|
|
ReadParameterAll();
|
|
ReadParameterAll();
|
|
|
WriteConfigININew();
|
|
WriteConfigININew();
|
|
|
- SaveConfigToServer(domainname);
|
|
|
|
|
|
|
+ if (!await SaveConfigToServer(domainname)) {
|
|
|
|
|
+ firework.launch('Configuration could not be saved!', 'danger', 10000);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
if(window.location.hash) {
|
|
if(window.location.hash) {
|
|
|
var hash = window.location.hash.substring(1); //Puts hash in variable, and removes the # character
|
|
var hash = window.location.hash.substring(1); //Puts hash in variable, and removes the # character
|
|
@@ -2297,12 +2300,12 @@ function saveTextAsFile() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (changeCamValue == 1) {
|
|
if (changeCamValue == 1) {
|
|
|
- camSettingsSet();
|
|
|
|
|
|
|
+ await camSettingsSet();
|
|
|
firework.launch('You have changed the camera settings, creating a new reference image and updating the alignment marks is mandatory!', 'success', 5000);
|
|
firework.launch('You have changed the camera settings, creating a new reference image and updating the alignment marks is mandatory!', 'success', 5000);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-function camSettingsSet(){
|
|
|
|
|
|
|
+async function camSettingsSet(){
|
|
|
document.getElementById("overlay").style.display = "block";
|
|
document.getElementById("overlay").style.display = "block";
|
|
|
document.getElementById("overlaytext").innerHTML = "Save Cam Settings...";
|
|
document.getElementById("overlaytext").innerHTML = "Save Cam Settings...";
|
|
|
|
|
|
|
@@ -2474,46 +2477,41 @@ function camSettingsSet(){
|
|
|
|
|
|
|
|
async function task() {
|
|
async function task() {
|
|
|
while (true) {
|
|
while (true) {
|
|
|
- var xhttp = new XMLHttpRequest();
|
|
|
|
|
-
|
|
|
|
|
if (durchlaufe > 10) {
|
|
if (durchlaufe > 10) {
|
|
|
document.getElementById("overlay").style.display = "none";
|
|
document.getElementById("overlay").style.display = "none";
|
|
|
firework.launch('Save Cam Settings aborted, timeout!', 'danger', 5000);
|
|
firework.launch('Save Cam Settings aborted, timeout!', 'danger', 5000);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ var responseText = "";
|
|
|
try {
|
|
try {
|
|
|
- xhttp.open("GET", url, false);
|
|
|
|
|
- xhttp.send();
|
|
|
|
|
- } catch (error){}
|
|
|
|
|
|
|
+ const response = await fetch(url);
|
|
|
|
|
+ responseText = await response.text();
|
|
|
|
|
+ } catch (error) {}
|
|
|
|
|
|
|
|
- if (xhttp.responseText == "CamSettingsSet") {
|
|
|
|
|
|
|
+ if (responseText == "CamSettingsSet") {
|
|
|
document.getElementById("overlay").style.display = "none";
|
|
document.getElementById("overlay").style.display = "none";
|
|
|
firework.launch('Cam Settings saved', 'success', 2000);
|
|
firework.launch('Cam Settings saved', 'success', 2000);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
// Get status
|
|
// Get status
|
|
|
- var _xhttp = new XMLHttpRequest();
|
|
|
|
|
- durchlaufe = durchlaufe + 1;
|
|
|
|
|
-
|
|
|
|
|
|
|
+ var statusText = "";
|
|
|
|
|
+ durchlaufe = durchlaufe + 1;
|
|
|
try {
|
|
try {
|
|
|
- _xhttp.open("GET", domainname + "/statusflow", false);
|
|
|
|
|
- _xhttp.send();
|
|
|
|
|
|
|
+ const statusResponse = await fetch(domainname + "/statusflow");
|
|
|
|
|
+ statusText = await statusResponse.text();
|
|
|
}
|
|
}
|
|
|
- catch (error){}
|
|
|
|
|
|
|
+ catch (error) {}
|
|
|
|
|
|
|
|
- document.getElementById("overlaytext").innerHTML = "Device is busy, please wait.<br><br>Current step: " + _xhttp.responseText;
|
|
|
|
|
|
|
+ document.getElementById("overlaytext").innerHTML = "Device is busy, please wait.<br><br>Current step: " + _responseText;
|
|
|
console.log("Device is busy, waiting 2s then checking again...");
|
|
console.log("Device is busy, waiting 2s then checking again...");
|
|
|
await sleep(2000);
|
|
await sleep(2000);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- setTimeout(function() {
|
|
|
|
|
- // Delay so the overlay gets shown
|
|
|
|
|
- task();
|
|
|
|
|
- }, 1);
|
|
|
|
|
|
|
+ await task();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function doReboot() {
|
|
function doReboot() {
|
|
@@ -2965,7 +2963,9 @@ function openDescription() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
openDescription();
|
|
openDescription();
|
|
|
-LoadConfigNeu();
|
|
|
|
|
|
|
+LoadConfigNeu().catch(function (error) {
|
|
|
|
|
+ console.error('Could not initialize configuration editor:', error);
|
|
|
|
|
+});
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
|
* Generate the GPIO editor from the active, audited board whitelist.
|
|
* Generate the GPIO editor from the active, audited board whitelist.
|