Files
audio2midi/data/www/dashboard.html
Jose 1080d3025c Removed duplicated ram info
modified:   data/www/dashboard.html
	modified:   src/esp_info.cpp
	modified:   src/esp_info.h
	modified:   src/web_server.cpp
2025-04-13 12:00:19 +02:00

58 lines
1.9 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>ESP32 Dashboard</title>
<style>
.card {
background: #f0f0f0;
padding: 20px;
margin: 10px;
border-radius: 10px;
}
.error-message {
color: red;
padding: 20px;
margin: 10px;
border: 1px solid red;
border-radius: 10px;
background: #fff0f0;
}
</style>
</head>
<body>
<div id="dashboard"></div>
<script>
function updateValues() {
console.log('Fetching ESP info...');
document.getElementById('dashboard').innerHTML = '<div class="card">Loading...</div>';
fetch('/api/espinfo')
.then(response => {
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return response.text(); // Changed from json() to text()
})
.then(data => {
console.log('Data received:', data);
if (!data) throw new Error('Empty response');
document.getElementById('dashboard').innerHTML = data;
})
.catch(error => {
console.error('Error:', error);
document.getElementById('dashboard').innerHTML =
`<div class="error-message">
Error loading data: ${error.message}<br>
Please check if the ESP32 is connected and the server is running.
</div>`;
});
}
// Initial load
updateValues();
// Update every 5 seconds (increased from 2 to reduce server load)
setInterval(updateValues, 5000);
</script>
</body>
</html>