Add compatibility for SR playlists (to support HB effects)
liveviewws2D and ws.cpp: show preset and playlist id json.cpp: add SR preset compatibility
This commit is contained in:
@@ -46,9 +46,10 @@
|
||||
if (leds[0] != 76 || leds[1] != 2 || !ctx) return; //'L', set in ws.cpp
|
||||
let mW = leds[2]; // matrix width
|
||||
let mH = leds[3]; // matrix height
|
||||
let pPL = Math.min(c.width / mW, c.height / mH); // pixels per LED (width of circle)
|
||||
let pPL = Math.min(c.width / mW, (c.height-10) / mH); // pixels per LED (width of circle) WLEDSR -10 for prompts
|
||||
let lOf = Math.floor((c.width - pPL*mW)/2); //left offeset (to center matrix)
|
||||
var i = 4;
|
||||
var i = 6;
|
||||
ctx.clearRect(0, 0, c.width, c.height); //WLEDSR
|
||||
for (y=0.5;y<mH;y++) for (x=0.5; x<mW; x++) {
|
||||
ctx.fillStyle = `rgb(${leds[i]},${leds[i+1]},${leds[i+2]})`;
|
||||
ctx.beginPath();
|
||||
@@ -56,6 +57,10 @@
|
||||
ctx.fill();
|
||||
i+=3;
|
||||
}
|
||||
//WLEDSR show preset and playlist id
|
||||
ctx.fillStyle = `rgb(255,255,255)`;
|
||||
if (leds[4] != 0) ctx.fillText("preset " + leds[4].toString(), lOf, mH*pPL+10);
|
||||
if (leds[5] != 255) ctx.fillText("playlist " + leds[5].toString(), lOf + 70, mH*pPL+10);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Peek WS error:",err);
|
||||
|
||||
Reference in New Issue
Block a user