|
|
@@ -926,17 +926,19 @@ function renderVarvCalibLive() {
|
|
|
const el = document.getElementById("varv-calib-live");
|
|
|
if (!el) return;
|
|
|
if (!varvLatest.length) { el.textContent = ""; return; }
|
|
|
+ const bandSum = (r) => Object.values(r.bands || {}).reduce((a, v) => a + (Number(v) || 0), 0);
|
|
|
const c = varvLatest[0];
|
|
|
- const sum = Object.values(c.bands || {}).reduce((a, v) => a + (Number(v) || 0), 0);
|
|
|
- let hint;
|
|
|
- if (sum < 50) {
|
|
|
- hint = "PIME — valge jaoks on vaja valgust (lamp/päevavalgus); kontrolli, et kate on eemaldatud";
|
|
|
- } else if (sum < 200) {
|
|
|
- hint = "hämar — valge jaoks soovitav tugevam valgustus";
|
|
|
- } else {
|
|
|
- hint = "HELE — sobib valgeks (hoia valgustus/geomeetria muutumatuna)";
|
|
|
- }
|
|
|
- el.textContent = `Viimane mõõtmine: ${(c.rgb_hex || "").toUpperCase()} · heledus ${Math.round(sum)} · ${hint}`;
|
|
|
+ const sum = bandSum(c);
|
|
|
+ const sums = varvLatest.slice(0, 5).map(bandSum);
|
|
|
+ const mx = Math.max(...sums);
|
|
|
+ const mn = Math.min(...sums);
|
|
|
+ const unstable = mx > 0 && (mx - mn) / mx > 0.2;
|
|
|
+ let light;
|
|
|
+ if (sum < 50) light = "PIME — valge jaoks vaja valgust";
|
|
|
+ else if (sum < 200) light = "hämar";
|
|
|
+ else light = "HELE";
|
|
|
+ const st = unstable ? "MUUTUB (oota stabiliseerumist)" : "stabiilne ✓";
|
|
|
+ el.textContent = `Viimane: ${(c.rgb_hex || "").toUpperCase()} · heledus ${Math.round(sum)} · ${light} · ${st}`;
|
|
|
}
|
|
|
|
|
|
async function captureVarvCalib(kind) {
|