From 47e51e10f068c13ba734bc08cbed7e6fca89f05b Mon Sep 17 00:00:00 2001 From: Roby Date: Fri, 16 Oct 2026 21:00:21 +0200 Subject: [PATCH] update index.html --- templates/index.html | 57 ++++++++++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 15 deletions(-) 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 = ` -
-
-
-
- ${esc(rawRssi)} -
`; + // Calcolo segmenti accesi (9 segmenti totali) + let activeSegs = 1; + if (rawRssi >= -53) activeSegs = 9; + else if (rawRssi >= -63) activeSegs = 8; + else if (rawRssi >= -73) activeSegs = 7; + else if (rawRssi >= -83) activeSegs = 6; + else if (rawRssi >= -93) activeSegs = 5; // S9 + else if (rawRssi >= -105) activeSegs = 4; + else if (rawRssi >= -117) activeSegs = 3; + else if (rawRssi >= -129) activeSegs = 2; + + // Generazione barre HTML + let barsHtml = ''; + const heights = [4, 5, 6, 7, 8, 10, 12, 14, 14]; + for (let i = 0; i < 9; i++) { + let color = "rgba(255,255,255,0.1)"; // Spento + if (i < activeSegs) { + if (i < 5) color = "var(--success)"; // Verde + else if (i < 7) color = "#f59e0b"; // Giallo + else color = "var(--danger)"; // Rosso + } + barsHtml += `
`; + } + + rssiDisplay = ` +
+
${sLabel}
+
+ ${barsHtml} +
+ ${esc(rawRssi)} dBm +
`; } if (source.includes("๐ŸŒ")) { -- 2.47.3