mirror of
https://github.com/wled/WLED.git
synced 2025-11-22 17:27:46 +00:00
Compare commits
5 Commits
copilot/ad
...
nightly
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
54b7dfe04b | ||
|
|
4a33809d66 | ||
|
|
336e074b4a | ||
|
|
aaad450175 | ||
|
|
65c43b5224 |
@@ -1687,10 +1687,11 @@ void WS2812FX::setTransitionMode(bool t) {
|
||||
// rare circumstances are: setting FPS to high number (i.e. 120) and have very slow effect that will need more
|
||||
// time than 2 * _frametime (1000/FPS) to draw content
|
||||
void WS2812FX::waitForIt() {
|
||||
unsigned long maxWait = millis() + 2*getFrameTime() + 100; // TODO: this needs a proper fix for timeout! see #4779
|
||||
while (isServicing() && maxWait > millis()) delay(1);
|
||||
unsigned long waitStart = millis();
|
||||
unsigned long maxWait = 2*getFrameTime() + 100; // TODO: this needs a proper fix for timeout! see #4779
|
||||
while (isServicing() && (millis() - waitStart < maxWait)) delay(1); // safe even when millis() rolls over
|
||||
#ifdef WLED_DEBUG
|
||||
if (millis() >= maxWait) DEBUG_PRINTLN(F("Waited for strip to finish servicing."));
|
||||
if (millis()-waitStart >= maxWait) DEBUG_PRINTLN(F("Waited for strip to finish servicing."));
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -213,7 +213,7 @@ function createTop(element, editor){
|
||||
function httpPostCb(st,resp){
|
||||
if (st!=200) alert("ERROR "+st+": "+resp);
|
||||
else {
|
||||
alert("Upload successful!");
|
||||
showToast("Upload successful!");
|
||||
refreshTree();
|
||||
}
|
||||
}
|
||||
@@ -264,7 +264,7 @@ function createTree(element, editor){
|
||||
leaf.textContent=name;
|
||||
var span = cE("span");
|
||||
span.style.cssText = "font-size: 14px; color: #aaa; margin-left: 8px;";
|
||||
span.textContent = (size / 1024).toFixed(1) + "KB";
|
||||
span.textContent = (size > 0 ? Math.max(0.1, (size / 1024)).toFixed(1) : 0) + "KB"; // show size in KB, minimum 0.1 to not show 0KB for small files
|
||||
leaf.appendChild(span);
|
||||
leaf.onmouseover=function(){ leaf.style.background="#333"; };
|
||||
leaf.onmouseout=function(){ leaf.style.background=""; };
|
||||
@@ -377,13 +377,13 @@ function prettyLedmap(json){
|
||||
rows.push(" " + obj.map.slice(i, i + width).map(pad).join(", "));
|
||||
}
|
||||
|
||||
let pretty = "{\n \"map\": [\n" + rows.join(",\n") + "\n ]";
|
||||
let pretty = "{\n";
|
||||
for (let k of Object.keys(obj)) {
|
||||
if (k !== "map") {
|
||||
pretty += ",\n \"" + k + "\": " + JSON.stringify(obj[k]);
|
||||
pretty += " \"" + k + "\": " + JSON.stringify(obj[k]) + ",\n"; // print all keys first (speeds up loading)
|
||||
}
|
||||
}
|
||||
pretty += "\n}";
|
||||
pretty += " \"map\": [\n" + rows.join(",\n") + "\n ]\n}";
|
||||
return pretty;
|
||||
} catch (e) {
|
||||
return json;
|
||||
@@ -493,7 +493,7 @@ function createEditor(element,file){
|
||||
req.add("POST","/upload",fd,function(st,resp){
|
||||
if (st!=200) alert("ERROR "+st+": "+resp);
|
||||
else {
|
||||
alert("File saved successfully!");
|
||||
showToast("File saved");
|
||||
refreshTree();
|
||||
}
|
||||
});
|
||||
@@ -567,10 +567,18 @@ function onBodyLoad(){
|
||||
var editor=createEditor("editor",vars.file);
|
||||
globalTree=createTree("tree",editor);
|
||||
createTop("top",editor);
|
||||
// Add Ctrl+S / Cmd+S override to save the file
|
||||
document.addEventListener('keydown', function(e) {
|
||||
if ((e.ctrlKey || e.metaKey) && e.key === 's') {
|
||||
e.preventDefault();
|
||||
editor.save();
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="onBodyLoad()">
|
||||
<div id="toast"></div>
|
||||
<div id="loader"><div class="loader"></div></div>
|
||||
<div id="top"></div>
|
||||
<div style="flex:1;position:relative">
|
||||
|
||||
Reference in New Issue
Block a user