Skip to content

Commit

Permalink
Use "pd" JSON API call for direct preset apply (Aircoookie#2946)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aircoookie authored Dec 13, 2022
1 parent 6bb1587 commit f50c9e8
Show file tree
Hide file tree
Showing 4 changed files with 1,954 additions and 1,961 deletions.
10 changes: 5 additions & 5 deletions wled00/data/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2194,12 +2194,12 @@ function setPreset(i)
{
var obj = {"ps":i};
if (pJson && pJson[i] && (!pJson[i].win || pJson[i].win.indexOf("Please") <= 0)) {
// we will send complete preset content as to avoid delay introduced by
// async nature of applyPreset(). json.cpp has to decide wether to call applyPreset()
// or not (by looking at the JSON content, if "ps" only)
// we will send the complete preset content as to avoid delay introduced by
// async nature of applyPreset() and having to read the preset from file system.
obj = {"pd":i}; // use "pd" instead of "ps" to indicate that we are sending the preset content directly
Object.assign(obj, pJson[i]);
delete obj.ql; // no need for quick load
delete obj.n; // no need for name
delete obj.ql; // no need for quick load
delete obj.n; // no need for name
}
if (isPlaylist(i)) obj.on = true; // force on
showToast("Loading preset " + pName(i) +" (" + i + ")");
Expand Down
Loading

0 comments on commit f50c9e8

Please sign in to comment.