From 691f0727b2a1cf450932b4cd1bebd956f46edb7a Mon Sep 17 00:00:00 2001 From: Stan Grams Date: Mon, 30 Mar 2026 21:35:08 +0200 Subject: [PATCH] [feat](trx-frontend-http): display S-meter in standard S-unit steps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Show S0–S9 as whole units and S9+xdB in 10dB steps instead of fractional S-unit values. Co-Authored-By: Claude Opus 4.6 Signed-off-by: Stan Grams --- .../trx-frontend/trx-frontend-http/assets/web/app.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/trx-client/trx-frontend/trx-frontend-http/assets/web/app.js b/src/trx-client/trx-frontend/trx-frontend-http/assets/web/app.js index 4412928..950c394 100644 --- a/src/trx-client/trx-frontend/trx-frontend-http/assets/web/app.js +++ b/src/trx-client/trx-frontend/trx-frontend-http/assets/web/app.js @@ -2712,10 +2712,11 @@ function dbmToSUnits(dbm) { } function formatSignal(sUnits) { - if (!Number.isFinite(sUnits) || sUnits <= 9) return `S${Math.max(0, sUnits || 0).toFixed(1)}`; - // S9+60dB is already extremely strong; cap anything beyond that. - const overDb = Math.min(60, (sUnits - 9) * 10); - return `S9 + ${overDb.toFixed(0)}dB`; + if (!Number.isFinite(sUnits) || sUnits <= 0) return "S0"; + if (sUnits <= 9) return `S${Math.round(sUnits)}`; + // S9+xdB: round to nearest 10 dB step, cap at +60. + const overDb = Math.min(60, Math.round((sUnits - 9) * 10 / 10) * 10); + return overDb === 0 ? "S9" : `S9+${overDb}dB`; } function setDisabled(disabled) {