diff --git a/templates/index.html b/templates/index.html index df5b41b..bfe164f 100644 --- a/templates/index.html +++ b/templates/index.html @@ -979,7 +979,25 @@ const slotDisplay = protocol === "DMR" ? `TS${rawSlot}` : "--"; let protoColor = "#3b82f6"; if (protocol === "NXDN") protoColor = "#10b981"; else if (protocol === "YSF") protoColor = "#8b5cf6"; else if (protocol === "D-STAR") protoColor = "#06b6d4"; else if (protocol === "P25") protoColor = "#f59e0b"; - // Formatta l'RSSI (nascondilo se è 0) + // Formatta l'RSSI con S-Meter grafico (nascondilo se è 0) + let rssiDisplay = '---'; + if (rawRssi && rawRssi !== 0) { + // Calcola la percentuale su un range utile di 80 dB (da -130 a -50 dBm) + const pct = Math.max(0, Math.min(100, ((rawRssi + 130) / 80) * 100)); + + // Assegna il colore in stile S-Meter amatoriale + let barColor = "var(--success)"; // Verde (fino a S9 / -93 dBm) + if (rawRssi > -93) barColor = "#f59e0b"; // Giallo (S9+) + if (rawRssi > -73) barColor = "var(--danger)"; // Rosso (S9+20 o superiore) + + rssiDisplay = ` +