Skip to content

Commit f50c9e8

Browse files
authored
Use "pd" JSON API call for direct preset apply (wled#2946)
1 parent 6bb1587 commit f50c9e8

File tree

4 files changed

+1954
-1961
lines changed

4 files changed

+1954
-1961
lines changed

wled00/data/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2194,12 +2194,12 @@ function setPreset(i)
21942194
{
21952195
var obj = {"ps":i};
21962196
if (pJson && pJson[i] && (!pJson[i].win || pJson[i].win.indexOf("Please") <= 0)) {
2197-
// we will send complete preset content as to avoid delay introduced by
2198-
// async nature of applyPreset(). json.cpp has to decide wether to call applyPreset()
2199-
// or not (by looking at the JSON content, if "ps" only)
2197+
// we will send the complete preset content as to avoid delay introduced by
2198+
// async nature of applyPreset() and having to read the preset from file system.
2199+
obj = {"pd":i}; // use "pd" instead of "ps" to indicate that we are sending the preset content directly
22002200
Object.assign(obj, pJson[i]);
2201-
delete obj.ql; // no need for quick load
2202-
delete obj.n; // no need for name
2201+
delete obj.ql; // no need for quick load
2202+
delete obj.n; // no need for name
22032203
}
22042204
if (isPlaylist(i)) obj.on = true; // force on
22052205
showToast("Loading preset " + pName(i) +" (" + i + ")");

0 commit comments

Comments
 (0)