diff --git a/firmware/webdir/index.html b/firmware/webdir/index.html index dfad951..db43712 100644 --- a/firmware/webdir/index.html +++ b/firmware/webdir/index.html @@ -311,6 +311,7 @@ toggle signal led + @@ -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); }