Skip to content
Snippets Groups Projects
Commit 19a8a2f1 authored by Tuxilio's avatar Tuxilio
Browse files

minor changes, but loading-bar broken

parent 57061273
No related branches found
No related tags found
1 merge request!4Resolve "Client side loading bar"
......@@ -38,10 +38,26 @@ function sendParty() {
client.publish('kalle/effects', '["party"]')
}
function sendLoadingBar() {
function runLoadingBar() {
const hex = document.querySelector("#loadingbar_inp").value;
const rgb = hexToRgb(hex);
client.publish('kalle/effects', `["loading-bar", ${rgb.r}, ${rgb.g}, ${rgb.b}]`);
for (let i = 0; i <= 7; i++) {
const rgb = hexToRgb(hex);
const ledId = i;
if (rgb) {
const message = [rgb.r, rgb.g, rgb.b];
client.publish(`kalle/led/${ledId}/color`, JSON.stringify(message), { retain: true });
} else {
console.error("Error HEX: ", hex);
}
}
}
function sendLoadingBar() {
for (let i = 0; i < 8; i++) {
setTimeout(runLoadingBar, 1000);
}
}
function hexToRgb(hex) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment