Skip to content

Commit 932881d

Browse files
authored
Updated code
1 parent 0d5c780 commit 932881d

1 file changed

Lines changed: 41 additions & 41 deletions

File tree

Monitor/index.html

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -478,47 +478,47 @@ <h4 class="text-sm font-bold text-slate-800 mb-2">Repositorios Oficiales</h4>
478478
}
479479

480480
// --- Simulación ---
481-
setInterval(() => {
482-
const timeStr = new Date().toLocaleTimeString('es-AR', {
483-
hour12: false, minute: '2-digit', second: '2-digit'
484-
});
485-
486-
const ec = (1200 + Math.random() * 100 - 50).toFixed(0);
487-
const ph = (7.0 + Math.random() * 0.4 - 0.2).toFixed(2);
488-
const temp = (24 + Math.random() * 1 - 0.5).toFixed(1);
489-
const k = (4.5 + Math.random() * 0.8 - 0.4).toFixed(2);
490-
491-
const isK = currentMode === 'potassium';
492-
493-
// LCD principal
494-
document.getElementById('lcd-value').innerText =
495-
isK ? `${k} mM` : `${ec} uS`;
496-
497-
// 🔥 ACÁ ESTÁ EL ARREGLO
498-
if (!isK) {
499-
document.getElementById('lcd-temp').innerText = `${temp} C`;
500-
document.getElementById('lcd-ph').innerText = ph;
501-
document.getElementById('card-temp').innerText = `${temp}°`;
502-
document.getElementById('card-ph').innerText = ph;
503-
} else {
504-
document.getElementById('lcd-temp').innerText = "--";
505-
document.getElementById('lcd-ph').innerText = "--";
506-
document.getElementById('card-temp').innerText = "--";
507-
document.getElementById('card-ph').innerText = "--";
508-
}
509-
510-
if (chartInstance) {
511-
const val = isK ? k : ec;
512-
chartInstance.data.datasets[0].data.push(val);
513-
chartInstance.data.labels.push(timeStr);
514-
515-
if (chartInstance.data.datasets[0].data.length > 20) {
516-
chartInstance.data.datasets[0].data.shift();
517-
chartInstance.data.labels.shift();
518-
}
519-
chartInstance.update();
520-
}
521-
}, 1000);
481+
setInterval(() => {
482+
const timeStr = new Date().toLocaleTimeString('es-AR', {
483+
hour12: false, minute: '2-digit', second: '2-digit'
484+
});
485+
486+
const ec = (1200 + Math.random() * 100 - 50).toFixed(0);
487+
const k = (4.5 + Math.random() * 0.8 - 0.4).toFixed(2);
488+
const ph = (7.0 + Math.random() * 0.4 - 0.2).toFixed(2);
489+
const temp = (24 + Math.random() * 1 - 0.5).toFixed(1);
490+
491+
const isK = currentMode === 'potassium';
492+
493+
// LCD principal
494+
document.getElementById('lcd-value').innerText =
495+
isK ? `${k} mM` : `${ec} uS`;
496+
497+
// Temperatura y pH
498+
if (!isK) {
499+
document.getElementById('lcd-temp').innerText = `${temp} C`;
500+
document.getElementById('lcd-ph').innerText = ph;
501+
document.getElementById('card-temp').innerText = `${temp}°`;
502+
document.getElementById('card-ph').innerText = ph;
503+
} else {
504+
document.getElementById('lcd-temp').innerText = "--";
505+
document.getElementById('lcd-ph').innerText = "--";
506+
document.getElementById('card-temp').innerText = "--";
507+
document.getElementById('card-ph').innerText = "--";
508+
}
509+
510+
if (chartInstance) {
511+
const val = isK ? k : ec;
512+
chartInstance.data.datasets[0].data.push(val);
513+
chartInstance.data.labels.push(timeStr);
514+
515+
if (chartInstance.data.datasets[0].data.length > 20) {
516+
chartInstance.data.datasets[0].data.shift();
517+
chartInstance.data.labels.shift();
518+
}
519+
chartInstance.update();
520+
}
521+
}, 1000);
522522

523523
window.onload = () => initChart(false);
524524
</script>

0 commit comments

Comments
 (0)