From 1925493a7e2886e97c949765a657c9ab528e0005 Mon Sep 17 00:00:00 2001 From: huskee Date: Sun, 24 Dec 2023 02:10:08 +0200 Subject: [PATCH] Further improve ESP32 support --- data/script.js | 37 +++++++------ schematics/#auto_saved_files# | 1 + schematics/_autosave-therminator.kicad_sch | 14 +++++ schematics/therminator.kicad_pcb | 2 + schematics/therminator.kicad_pro | 61 ++++++++++++++++++++++ schematics/therminator.kicad_sch | 5 ++ schematics/~therminator.kicad_pcb.lck | 1 + schematics/~therminator.kicad_sch.lck | 1 + src/main.cpp | 9 ++++ 9 files changed, 116 insertions(+), 15 deletions(-) create mode 100644 schematics/#auto_saved_files# create mode 100644 schematics/_autosave-therminator.kicad_sch create mode 100644 schematics/therminator.kicad_pcb create mode 100644 schematics/therminator.kicad_pro create mode 100644 schematics/therminator.kicad_sch create mode 100644 schematics/~therminator.kicad_pcb.lck create mode 100644 schematics/~therminator.kicad_sch.lck diff --git a/data/script.js b/data/script.js index 0733aa3..0f3cfc0 100644 --- a/data/script.js +++ b/data/script.js @@ -1,3 +1,14 @@ +fetch("/isESP32") + .then((res) => res.text()) + .then((textResponse) => { + let isESP32 = textResponse; + }); +fetch("/int") + .then((res) => res.text()) + .then((textResponse) => { + document.querySelector("#updInt").innerText = textResponse; + }); + const canvasA = document.querySelector("#chartA"); const canvasB = document.querySelector("#chartB"); const chartUpdateInt = document.querySelector("#chartUpd").value; @@ -82,12 +93,6 @@ const options = { }, }; -fetch("/int") - .then((res) => res.text()) - .then((textResponse) => { - document.querySelector("#updInt").innerText = textResponse; - }); - document.querySelector("#cupdInt").innerText = chartUpdateInt; document.querySelector("#recInfo").style.display = "none"; const chartA = new Chart(canvasA, { @@ -285,19 +290,21 @@ function startRecording() { } } function startTimer(duration, display) { - var timer = duration, minutes, seconds; + var timer = duration, + minutes, + seconds; setInterval(function () { - minutes = parseInt(timer / 60, 10); - seconds = parseInt(timer % 60, 10); + minutes = parseInt(timer / 60, 10); + seconds = parseInt(timer % 60, 10); - minutes = minutes < 10 ? "0" + minutes : minutes; - seconds = seconds < 10 ? "0" + seconds : seconds; + minutes = minutes < 10 ? "0" + minutes : minutes; + seconds = seconds < 10 ? "0" + seconds : seconds; - display.textContent = minutes + ":" + seconds; + display.textContent = minutes + ":" + seconds; - if (--timer < 0) { - timer = duration; - } + if (--timer < 0) { + timer = duration; + } }, 1000); } function fancyTimeFormat(e) { diff --git a/schematics/#auto_saved_files# b/schematics/#auto_saved_files# new file mode 100644 index 0000000..eb2ca63 --- /dev/null +++ b/schematics/#auto_saved_files# @@ -0,0 +1 @@ +/home/huskee/therminator/schematics/_autosave-therminator.kicad_sch diff --git a/schematics/_autosave-therminator.kicad_sch b/schematics/_autosave-therminator.kicad_sch new file mode 100644 index 0000000..c366af7 --- /dev/null +++ b/schematics/_autosave-therminator.kicad_sch @@ -0,0 +1,14 @@ +(kicad_sch (version 20230121) (generator eeschema) + + (uuid d7e42dbb-653f-4efa-bd53-9e9970955c51) + + (paper "A4") + + (lib_symbols + ) + + + (sheet_instances + (path "/" (page "1")) + ) +) diff --git a/schematics/therminator.kicad_pcb b/schematics/therminator.kicad_pcb new file mode 100644 index 0000000..2b8ba10 --- /dev/null +++ b/schematics/therminator.kicad_pcb @@ -0,0 +1,2 @@ +(kicad_pcb (version 20221018) (generator pcbnew) +) \ No newline at end of file diff --git a/schematics/therminator.kicad_pro b/schematics/therminator.kicad_pro new file mode 100644 index 0000000..3310037 --- /dev/null +++ b/schematics/therminator.kicad_pro @@ -0,0 +1,61 @@ +{ + "board": { + "design_settings": { + "defaults": { + "board_outline_line_width": 0.1, + "copper_line_width": 0.2, + "copper_text_size_h": 1.5, + "copper_text_size_v": 1.5, + "copper_text_thickness": 0.3, + "other_line_width": 0.15, + "silk_line_width": 0.15, + "silk_text_size_h": 1.0, + "silk_text_size_v": 1.0, + "silk_text_thickness": 0.15 + }, + "diff_pair_dimensions": [], + "drc_exclusions": [], + "rules": { + "min_copper_edge_clearance": 0.0, + "solder_mask_clearance": 0.0, + "solder_mask_min_width": 0.0 + }, + "track_widths": [], + "via_dimensions": [] + } + }, + "boards": [], + "libraries": { + "pinned_footprint_libs": [], + "pinned_symbol_libs": [] + }, + "meta": { + "filename": "kicad.kicad_pro", + "version": 1 + }, + "net_settings": { + "classes": [ + { + "clearance": 0.2, + "diff_pair_gap": 0.25, + "diff_pair_via_gap": 0.25, + "diff_pair_width": 0.2, + "microvia_diameter": 0.3, + "microvia_drill": 0.1, + "name": "Default", + "nets": [], + "track_width": 0.25, + "via_diameter": 0.8, + "via_drill": 0.4 + } + ], + "meta": { + "version": 0 + } + }, + "pcbnew": { + "page_layout_descr_file": "" + }, + "sheets": [], + "text_variables": {} +} diff --git a/schematics/therminator.kicad_sch b/schematics/therminator.kicad_sch new file mode 100644 index 0000000..2e2aa2f --- /dev/null +++ b/schematics/therminator.kicad_sch @@ -0,0 +1,5 @@ +(kicad_sch (version 20230121) (generator eeschema) + (paper "A4") + (lib_symbols) + (symbol_instances) +) diff --git a/schematics/~therminator.kicad_pcb.lck b/schematics/~therminator.kicad_pcb.lck new file mode 100644 index 0000000..0fa658d --- /dev/null +++ b/schematics/~therminator.kicad_pcb.lck @@ -0,0 +1 @@ +{"hostname":"selene","username":"huskee"} \ No newline at end of file diff --git a/schematics/~therminator.kicad_sch.lck b/schematics/~therminator.kicad_sch.lck new file mode 100644 index 0000000..0fa658d --- /dev/null +++ b/schematics/~therminator.kicad_sch.lck @@ -0,0 +1 @@ +{"hostname":"selene","username":"huskee"} \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 07c4aaa..1ab37f9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -160,6 +160,15 @@ void initWebServer() { server.on("/int", HTTP_GET, [](AsyncWebServerRequest *request) { request->send_P(200, "text/plain", String(timerDelay).c_str()); }); + #ifdef ESP32 + server.on("/isESP32", HTTP_GET, [](AsyncWebServerRequest *request) { + request->send(200, "text/plain", String(true)); + }); + #else + server.on("/isESP32", HTTP_GET, [](AsyncWebServerRequest *request) { + request->send(200, "text/plain", String(false)); + }); + #endif server.serveStatic("/", LittleFS, "/"); server.begin(); Serial.printf("webserver init\n");