From 1c29d37c6f788fa519f09bdb8714587db7e4d2e2 Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 14 Dec 2025 08:23:32 +0000 Subject: [PATCH] Replace form with div to avoid default button handling --- main/index.html | 6 +++--- main/index.js | 28 ++++++++++++---------------- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/main/index.html b/main/index.html index fbac0b0..ca27a62 100644 --- a/main/index.html +++ b/main/index.html @@ -140,7 +140,7 @@
-
+
@@ -171,9 +171,9 @@
- +
- +
diff --git a/main/index.js b/main/index.js index 791ccb6..2ac7517 100644 --- a/main/index.js +++ b/main/index.js @@ -150,8 +150,6 @@ canvas.addEventListener('click', (event) => { voltage, time: timeOffset }; - - // draw(); // Removed: Animation loop handles this } }); @@ -411,21 +409,19 @@ function setParams() { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload) - }) - .then(res => { - if (res.ok) { - resetLowRateState(); + }).then(res => { + if (res.ok) { + resetLowRateState(); - // Update active config - activeConfig = { ...payload, desiredRate, trigger: parseInt(triggerLevel.value) || 2048 }; + // Update active config + activeConfig = { ...payload, desiredRate, trigger: parseInt(triggerLevel.value) || 2048 }; - // Save to localStorage - localStorage.setItem('esp32_adc_config', JSON.stringify(activeConfig)); - } else { - alert('Error updating configuration'); - } - }) - .catch(err => alert('Network error: ' + err)); + // Save to localStorage + localStorage.setItem('esp32_adc_config', JSON.stringify(activeConfig)); + } else { + alert('Error updating configuration'); + } + }).catch(err => alert('Network error: ' + err)); }; // Load config from localStorage on startup @@ -452,6 +448,6 @@ document.getElementById('resetBtn').addEventListener('click', () => { localStorage.clear(); window.location.reload(); }); +document.getElementById('powerOff').addEventListener('click', () => window.location.href = "/poweroff"); setParams(); connect(); -