Segment visualization fix show fx name

This commit is contained in:
Ewoud
2023-02-15 18:13:30 +01:00
parent b6024d2ed0
commit ab8b260608
3 changed files with 806 additions and 795 deletions

View File

@@ -9,7 +9,7 @@ function toggleCEEditor(name, segID) {
d.getElementById('ceEditor').style.transform = (isCEEditor) ? "translateY(0px)":"translateY(100%)";
}
function fetchAndExecute(url, name, callback, toast=true)
function fetchAndExecute(url, name, callback, callError)
{
fetch
(url+name, {
@@ -17,19 +17,20 @@ function fetchAndExecute(url, name, callback, toast=true)
})
.then(res => {
if (!res.ok) {
if (toast) showToast("File " + name + " not found", true);
return "";
callError("File " + name + " not found");
return "";
}
return res.text();
})
.then(text => {
console.log("text", text);
callback(text);
})
.catch(function (error) {
if (toast) showToast("Error getting " + name, true);
console.log(error);
callError("Error getting " + name);
})
.finally(() => {
console.log("finally");
// if (callback) setTimeout(callback,99);
});
}
@@ -51,6 +52,9 @@ function loadLogFile(name, attempt) {
}
else
ceLogArea.value = logtext;
}, function(error){
showToast(error);
console.log(error);
});
}
@@ -114,6 +118,9 @@ function populateCEEditor(name, segID)
ceLogArea.value = ".";
loadLogFile(name + ".wled.log", 1);
}, function(error){
showToast(error);
console.log(error);
});
}
@@ -133,6 +140,9 @@ function downloadCEFile(url, name) {
var ceProgramArea = d.getElementById("ceProgramArea");
ceProgramArea.value = text;
}
}, function(error){
showToast(error);
console.log(error);
});
return;

View File

@@ -1360,7 +1360,10 @@ function drawSegments() {
ctx.fill();
}
post();
}, false); //false: no toast
}, function(error) { //error handling
console.log(error);
post();
});
}
else
post();
@@ -2893,7 +2896,7 @@ function genPresets()
}
//WLEDMM: utility function to load contents of file from FS (used in draw)
function fetchAndExecute(url, name, callback, toast=true)
function fetchAndExecute(url, name, callback, callError)
{
fetch
(url+name, {
@@ -2901,10 +2904,9 @@ function fetchAndExecute(url, name, callback, toast=true)
})
.then(res => {
if (!res.ok) {
if (toast) showToast("File " + name + " not found", true);
return "";
callError("File " + name + " not found");
return "";
}
console.log("res", res);
return res.text();
})
.then(text => {
@@ -2912,8 +2914,7 @@ function fetchAndExecute(url, name, callback, toast=true)
callback(text);
})
.catch(function (error) {
if (toast) showToast("Error getting " + name, true);
console.log(error);
callError("Error getting " + name);
})
.finally(() => {
console.log("finally");

File diff suppressed because it is too large Load Diff