diff --git a/templates/index.html b/templates/index.html index bebc53a..2a35f06 100644 --- a/templates/index.html +++ b/templates/index.html @@ -979,24 +979,51 @@ 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 con S-Meter grafico (nascondilo se รจ 0) + // Formatta l'RSSI con S-Meter grafico a segmenti 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) + // Calcolo livello S-Meter (Standard VHF/UHF: S9 = -93 dBm, 6dB per punto S) + let sLabel = "S0"; + if (rawRssi >= -93) { + let over = Math.round((rawRssi + 93) / 10) * 10; + sLabel = over > 0 ? `S9+${over}` : "S9"; + } else { + let sUnits = Math.floor((rawRssi + 141) / 6) + 1; + sLabel = `S${Math.max(1, Math.min(9, sUnits))}`; + } - rssiDisplay = ` -