stash
This commit is contained in:
parent
15fb96bb02
commit
d0a06bc4db
1 changed files with 16 additions and 1 deletions
|
@ -311,6 +311,7 @@
|
|||
<input type="checkbox" name="onoffswitch" id="led-switch" onclick="gpio()">
|
||||
<span class="toggle button">toggle signal led</span>
|
||||
</label>
|
||||
<span><input type="color" onchange="console.log(colorStringToVec(event.target.value))"/></span>
|
||||
</footer>
|
||||
</article>
|
||||
</div>
|
||||
|
@ -343,6 +344,18 @@
|
|||
return pos;
|
||||
};
|
||||
|
||||
DataView.prototype.setInt8Vec = function (pos, vec) {
|
||||
for (var i = 0; i < vec.length; i++) {
|
||||
this.setInt8(pos++, vec[i]);
|
||||
}
|
||||
return pos;
|
||||
};
|
||||
|
||||
function colorStringToVec(hex) {
|
||||
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
||||
return result ? [parseInt(result[1], 16), parseInt(result[2], 16), parseInt(result[3], 16)] : null;
|
||||
}
|
||||
|
||||
var ws;
|
||||
var retries;
|
||||
var series = new TimeSeries();
|
||||
|
@ -594,13 +607,15 @@
|
|||
const ssid = ap_ssid.value;
|
||||
const password = ap_pw.value;
|
||||
|
||||
const buffer = new ArrayBuffer(ssid.length + password.length + 4);
|
||||
const buffer = new ArrayBuffer(ssid.length + password.length + 4 + 8);
|
||||
const view1 = new DataView(buffer);
|
||||
var tx_len = 0;
|
||||
view1.setChar(tx_len++, 'A');
|
||||
view1.setChar(tx_len++, (en ? "E" : "D"));
|
||||
tx_len = view1.setString(tx_len, ssid);
|
||||
tx_len = view1.setString(tx_len, password);
|
||||
tx_len = view1.setInt8Vec(tx_len, [192, 168, 111, 1]);
|
||||
tx_len = view1.setInt8Vec(tx_len, [255, 255, 255, 0]);
|
||||
wsWrite(buffer);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue