stash
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
j3d1 2023-02-18 20:59:55 +01:00
parent 2b07102b69
commit c7c19a8aa8
5 changed files with 91 additions and 59 deletions

View file

@ -272,12 +272,7 @@
</label><br>
<label>
<span>change bottom color</span>
<input type="color" oninput="colorBottom(this.value)" class="postfill_bottom_color">
</label><br>
<label>
<span>set white brightness</span>
<input type="range" min="0" max="4095" value="0" onchange="lightSlider(this.value)"
class="slider postfill_white_brightness">
<input type="number" oninput="ledAmount(this.value)" class="postfill_led_amount">
</label>
</footer>
</article>
@ -366,7 +361,7 @@
} else {
var data = {};
var dv = new DataView(evt.data);
let cmds = ["NONE", "RESTART", "CLEAR_CONFIG", "FIRMWARE_FRAME", "FIRMWARE_CHECK", "VOLTAGE_INFO", "SYSTEM_INFO", "LIGHTS"];
let cmds = ["NONE", "RESTART", "CLEAR_CONFIG", "FIRMWARE_FRAME", "FIRMWARE_CHECK", "VOLTAGE_INFO", "SYSTEM_INFO", "LIGHTS", "LIGHT_CONFIG"];
//console.log("[0]", dv.getUint8(0));
let fst = dv.getUint8(0);
var cmd;
@ -390,6 +385,8 @@
data.top_color = htonl(dv.getUint32(1));
data.bottom_color = htonl(dv.getUint32(5));
data.white_brightness = htons(dv.getInt16(9));
} else if (cmd === "LIGHT_CONFIG") {
data.led_amount = htonl(dv.getUint32(1));
} else if (cmd === "VOLTAGE_INFO") {
console.log(cmd, buf2hex(evt.data));
} else if (cmd === "G") {
@ -511,10 +508,10 @@
wsWrite(header);
}
function lightSlider(val) {
function ledAmount(val) {
var header = new ArrayBuffer(8);
var headerview = new DataView(header);
headerview.setChar(0, 'J');
headerview.setChar(0, 'K');
headerview.setInt32(4, val);
console.log(buf2hex(header));
wsWrite(header);