Skip to content

Commit

Permalink
NewUI: add preview of LEDs
Browse files Browse the repository at this point in the history
index.js: call userFun without jsonValues

newUI index.htm:
- add importmap for three.js

newui index.js
- fetchModelForLiveServer: add pview.file F_ixture.json
- fetchModelForLiveServer: random data for pview

Add F_Panel2x2-16x16.json and update model.json to StarLight
  • Loading branch information
ewoudwijma committed Aug 15, 2024
1 parent b1e1c8a commit 2ce0f54
Show file tree
Hide file tree
Showing 7 changed files with 7,568 additions and 2,016 deletions.
2 changes: 1 addition & 1 deletion data/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ function makeWS() {
previewBoard(canvasNode, buffer);
}
else
userFun(buffer, jsonValues);
userFun(buffer);
}
else {
// console.log("onmessage", e.data);
Expand Down
8 changes: 8 additions & 0 deletions data/newui/index.htm
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@
<script src="modules.js"></script>
<link rel="stylesheet" href="modules.css">
<script src="../app.js"></script>
<script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@0.156.1/build/three.module.js",
"three/addons/": "https://unpkg.com/three@0.156.1/examples/jsm/"
}
}
</script>
</head>
<body id="body" onload="controller.onLoad()"></body>
</html>
26 changes: 24 additions & 2 deletions data/newui/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ 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 @@ -80,8 +88,22 @@ class Controller {
controller.modules.previewBoard(canvasNode, buffer);
}
}
else {
userFun(buffer, {});
else if (buffer[0] == 1) {
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
}

userFun(buffer);
}
}
}, 100);

Expand Down
Loading

0 comments on commit 2ce0f54

Please sign in to comment.