stash
This commit is contained in:
parent
ce8b71daf0
commit
9c5fb65a90
6 changed files with 390 additions and 30 deletions
|
@ -259,9 +259,17 @@
|
|||
</header>
|
||||
<footer>
|
||||
<label>
|
||||
<input type="checkbox" name="onoffswitch" id="led-switch" onclick="gpio()">
|
||||
<input type="checkbox" name="onoffswitch" id="led-switch" onclick="gpio(this.value)">
|
||||
<span class="toggle button">toggle signal led</span>
|
||||
</label>
|
||||
<label>
|
||||
<span>toggle signal led</span>
|
||||
<input type="color" onchange="colorTop(this.value)">
|
||||
</label>
|
||||
<label>
|
||||
<span>toggle signal led</span>
|
||||
<input type="color" onchange="colorBottom(this.value)">
|
||||
</label>
|
||||
</footer>
|
||||
</article>
|
||||
</div>
|
||||
|
@ -348,7 +356,7 @@
|
|||
document.getElementById("unused_values").innerHTML = JSON.stringify(unused_values);
|
||||
} else {
|
||||
var dv = new DataView(evt.data);
|
||||
console.log("[0]",dv.getUint8(0));
|
||||
console.log("[0]", dv.getUint8(0));
|
||||
var cmd = String.fromCharCode(dv.getUint8(0));
|
||||
var val = dv.getUint16(1);
|
||||
|
||||
|
@ -413,13 +421,31 @@
|
|||
ws.send(data);
|
||||
}
|
||||
|
||||
function gpio() {
|
||||
if (document.getElementById('led-switch').checked)
|
||||
function gpio(val) {
|
||||
if (val)
|
||||
wsWrite('E');
|
||||
else
|
||||
wsWrite('D');
|
||||
}
|
||||
|
||||
function colorTop(val) {
|
||||
var header = new ArrayBuffer(8);
|
||||
var headerview = new DataView(header);
|
||||
headerview.setChar(0, 'T');
|
||||
headerview.setInt32(4, parseInt(val.substring(1), 16));
|
||||
console.log(buf2hex(header));
|
||||
wsWrite(header);
|
||||
}
|
||||
|
||||
function colorBottom(val) {
|
||||
var header = new ArrayBuffer(8);
|
||||
var headerview = new DataView(header);
|
||||
headerview.setChar(0, 'B');
|
||||
headerview.setInt32(4, parseInt(val.substring(1), 16));
|
||||
console.log(buf2hex(header));
|
||||
wsWrite(header);
|
||||
}
|
||||
|
||||
window.onload = function () {
|
||||
wsOpen();
|
||||
startPolling();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue