Replace form with div to avoid default button handling
This commit is contained in:
@@ -140,7 +140,7 @@
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<form id="configForm" class="controls">
|
||||
<div class="controls">
|
||||
<div>
|
||||
<label>Sample Rate (Hz)</label>
|
||||
<input type="number" id="sampleRate" value="10000" min="1" max="83333">
|
||||
@@ -171,9 +171,9 @@
|
||||
</div>
|
||||
<div>
|
||||
<button id="resetBtn">Reset</button>
|
||||
<button id="powerOff"><a style="text-decoration: none; color: inherit" href="/poweroff">Power off</a></button>
|
||||
<button id="powerOff">Power off</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="deltaPanel"></div>
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user