[feat](trx-frontend-http): add S-meter unit to signal strength selector
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
@@ -641,12 +641,13 @@ let hintTimer = null;
|
|||||||
let sigMeasuring = false;
|
let sigMeasuring = false;
|
||||||
let sigLastSUnits = null;
|
let sigLastSUnits = null;
|
||||||
let sigLastDbm = null;
|
let sigLastDbm = null;
|
||||||
const SIG_STRENGTH_UNITS = ["dBFS", "dBf", "dBm"];
|
const SIG_STRENGTH_UNITS = ["dBFS", "dBf", "dBm", "S"];
|
||||||
let sigStrengthUnitIdx = loadSetting("sigStrengthUnit", 0);
|
let sigStrengthUnitIdx = loadSetting("sigStrengthUnit", 0);
|
||||||
|
|
||||||
function formatSigStrength(dbm) {
|
function formatSigStrength(dbm) {
|
||||||
if (!Number.isFinite(dbm)) return "--";
|
if (!Number.isFinite(dbm)) return "--";
|
||||||
const unit = SIG_STRENGTH_UNITS[sigStrengthUnitIdx] || "dBFS";
|
const unit = SIG_STRENGTH_UNITS[sigStrengthUnitIdx] || "dBFS";
|
||||||
|
if (unit === "S") return formatSignal(dbmToSUnits(dbm));
|
||||||
if (unit === "dBm") return `${dbm.toFixed(1)} dBm`;
|
if (unit === "dBm") return `${dbm.toFixed(1)} dBm`;
|
||||||
if (unit === "dBf") {
|
if (unit === "dBf") {
|
||||||
// dBf = dBm + 107 (referenced to 1 femtowatt across 50 Ω)
|
// dBf = dBm + 107 (referenced to 1 femtowatt across 50 Ω)
|
||||||
|
|||||||
Reference in New Issue
Block a user