Skip to content

Commit

Permalink
NewUI: Live Server preview fix
Browse files Browse the repository at this point in the history
NewUI :
======

index.js
- fetchModelForLiveServer: move F_ixture.json set to modules.js
- fetchModelForLiveServer: pview data: check if file present
  • Loading branch information
ewoudwijma committed Aug 18, 2024
1 parent 18bdae7 commit 6f57cc2
Show file tree
Hide file tree
Showing 5 changed files with 2,009 additions and 2,012 deletions.
2 changes: 1 addition & 1 deletion data/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// @license For non GPL-v3 usage, commercial licenses must be purchased. Contact moonmodules@icloud.com

function appName() {
return "Led";
return "StarLight";
}

function userFunSetup() {
Expand Down
28 changes: 11 additions & 17 deletions data/newui/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,6 @@ class Controller {
json.sysInfo.pinTypes[pinNr] = Math.round(Math.random() * 3)
this.receiveData(json);

//LED specific
//send F_ixture.json
json = {}
json.pview = {}
json.pview.file = 'F_panel2x2-16x16.json'
this.receiveData(json);
//end LED specific

// every 1 second
window.setInterval(function() {
controller.modules.generateData() //generates data for each variabe in model
Expand All @@ -93,17 +85,19 @@ class Controller {
let canvasNode = document.getElementById("pview");
if (canvasNode) {
// console.log(buffer, canvasNode);
buffer[1] = 0
buffer[2] = 0
buffer[3] = 0
let pviewVar = controller.modules.findVar("pview");
for (let i = 0; i < pviewVar.file.nrOfLeds; i++) {
buffer[4+i*3] = Math.random() * 256
buffer[4+i*3+1] = Math.random() * 256
buffer[4+i*3+2] = Math.random() * 256
}
if (pviewVar.file) {
buffer[1] = 0
buffer[2] = 0
buffer[3] = 0
for (let i = 0; i < pviewVar.file.nrOfLeds; i++) {
buffer[4+i*3] = Math.random() * 256
buffer[4+i*3+1] = Math.random() * 256
buffer[4+i*3+2] = Math.random() * 256
}

userFun(buffer);
userFun(buffer);
}
}
}
}, 100);
Expand Down
6 changes: 5 additions & 1 deletion data/newui/modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class Modules {
}

//used by fetchModel and by makeWS
addModule(moduleJson) {
addModule(moduleJson) {
moduleJson.type = moduleJson.type=="appmod"?appName():moduleJson.type=="usermod"?"User":"System";
this.model.push(moduleJson);

Expand Down Expand Up @@ -412,6 +412,10 @@ class CanvasVariable extends Variable {
return super.createHTML(`<canvas id=${this.variable.id} class="${this.variable.type}"></canvas>`);
}

receiveData(properties) {
super.receiveData(properties)
}

generateData() {
if (this.node && this.variable.file == null)
super.generateData(`"file":"F_panel2x2-16x16.json"`)
Expand Down
Loading

0 comments on commit 6f57cc2

Please sign in to comment.