This commit is contained in:
j3d1 2023-01-19 07:07:24 +01:00
parent f073608c10
commit 94bdb71820
3 changed files with 27 additions and 16 deletions

View file

@ -28,7 +28,7 @@ void user_init(void) {
wifi_available_semaphore = xSemaphoreCreateBinary(); wifi_available_semaphore = xSemaphoreCreateBinary();
xTaskCreate(mqtt_task, "mqtt_task", 1024, NULL, 1, NULL); //xTaskCreate(mqtt_task, "mqtt_task", 1024, NULL, 1, NULL);
xTaskCreate(wifi_task, "wifi_task", 1024, NULL, 1, NULL); xTaskCreate(wifi_task, "wifi_task", 1024, NULL, 1, NULL);
@ -39,7 +39,7 @@ void user_init(void) {
wifi_alive = xSemaphoreCreateBinary(); wifi_alive = xSemaphoreCreateBinary();
publish_queue = xQueueCreate(3, PUB_MSG_LEN); publish_queue = xQueueCreate(3, PUB_MSG_LEN);
xTaskCreate(&beat_task, "beat_task", 256, NULL, 3, NULL); //xTaskCreate(&beat_task, "beat_task", 256, NULL, 3, NULL);
} }

View file

@ -77,7 +77,7 @@ void websocket_task(void *pvParameter) {
} }
//Global Info //Global Info
if(false && has_changed.global) { if(has_changed.global) {
timeval tv{}; timeval tv{};
gettimeofday(&tv, nullptr); gettimeofday(&tv, nullptr);
size_t uptime = xTaskGetTickCount() * portTICK_PERIOD_MS / 1000; size_t uptime = xTaskGetTickCount() * portTICK_PERIOD_MS / 1000;

View file

@ -281,12 +281,18 @@
</label> </label>
<label> <label>
<span>toggle signal led</span> <span>toggle signal led</span>
<input type="color" onchange="colorTop(this.value)"> <input type="color" oninput="colorTop(this.value)">
</label> </label>
<label> <label>
<span>toggle signal led</span> <span>toggle signal led</span>
<input type="color" onchange="colorBottom(this.value)"> <input type="color" oninput="colorBottom(this.value)">
</label> </label>
<label>
<span>toggle signal led</span>
<input type="range" min="0" max="4096" value="0" class="slider"
oninput="lightSlider(this.value)">
</label>
</footer> </footer>
</article> </article>
</div> </div>
@ -345,10 +351,6 @@
return result ? [parseInt(result[1], 16), parseInt(result[2], 16), parseInt(result[3], 16)] : null; return result ? [parseInt(result[1], 16), parseInt(result[2], 16), parseInt(result[3], 16)] : null;
} }
var ws;
var retries;
var series = new TimeSeries();
function setMsg(cls, text) { function setMsg(cls, text) {
sbox.className = "label " + cls; sbox.className = "label " + cls;
sbox.innerHTML = text; sbox.innerHTML = text;
@ -523,6 +525,15 @@
wsWrite(header); wsWrite(header);
} }
function lightSlider(val) {
var header = new ArrayBuffer(8);
var headerview = new DataView(header);
headerview.setChar(0, 'J');
headerview.setInt32(4, val);
console.log(buf2hex(header));
wsWrite(header);
}
window.onload = function () { window.onload = function () {
wsOpen(); wsOpen();
startPolling(); startPolling();
@ -630,6 +641,13 @@
} }
} }
function update_progress(progressBar, progress) {
var iP = Math.floor(progress);
var dBar = document.getElementById("progress_bar_" + progressBar);
dBar.innerText = iP + "%";
dBar.style.width = progress + "%";
}
var sta_toggle = document.getElementById("sta_toggle"); var sta_toggle = document.getElementById("sta_toggle");
var sta_ssid = document.getElementById("sta_ssid"); var sta_ssid = document.getElementById("sta_ssid");
var sta_pw = document.getElementById("sta_pw"); var sta_pw = document.getElementById("sta_pw");
@ -671,13 +689,6 @@
tx_len = view1.setInt8Vec(tx_len, [255, 255, 255, 0]); tx_len = view1.setInt8Vec(tx_len, [255, 255, 255, 0]);
wsWrite(buffer); wsWrite(buffer);
} }
function update_progress(progressBar, progress) {
var iP = Math.floor(progress);
var dBar = document.getElementById("progress_bar_" + progressBar);
dBar.innerText = iP + "%";
dBar.style.width = progress + "%";
}
</script> </script>
</body> </body>
</html> </html>