From 49624479512e8cd7cc0b7c5785d78cbe0a02f74d Mon Sep 17 00:00:00 2001 From: jedi Date: Sun, 12 Sep 2021 23:01:00 +0200 Subject: [PATCH] Added wifi settings --- firmware/web.cpp | 14 ++++++++++++++ firmware/webdir/index.html | 18 +++++++++++------- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/firmware/web.cpp b/firmware/web.cpp index 1532f3c..618c4ee 100644 --- a/firmware/web.cpp +++ b/firmware/web.cpp @@ -248,6 +248,20 @@ void websocket_task(void *pvParameter) { } //printf("9: %d\n",gpio_read(9)); //printf("10: %d\n",gpio_read(10)); + + vTaskDelayMs(250); + { + uint8_t response[3]; + uint16_t val; + val = sdk_system_adc_read(); + response[2] = (uint8_t) val; + response[1] = val >> 8; + response[0] = 'V'; + LOCK_TCPIP_CORE(); + websocket_write(pcb, response, 3, WS_BIN_MODE); + UNLOCK_TCPIP_CORE(); + } + vTaskDelayMs(500); } syslog_detach(); diff --git a/firmware/webdir/index.html b/firmware/webdir/index.html index 22e3c4d..81c721a 100644 --- a/firmware/webdir/index.html +++ b/firmware/webdir/index.html @@ -338,6 +338,10 @@ 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) { sbox.className = "label " + cls; sbox.innerHTML = text; @@ -619,13 +623,6 @@ } } - 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_ssid = document.getElementById("sta_ssid"); var sta_pw = document.getElementById("sta_pw"); @@ -667,6 +664,13 @@ tx_len = view1.setInt8Vec(tx_len, [255, 255, 255, 0]); 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 + "%"; + } \ No newline at end of file