[fix](trx-rs): show signal strength with decimal precision
Change RigRxStatus.sig from i32 to f64 and add get_signal_strength_db to RigCat trait so SDR backends can bypass the coarse 0..15 quantisation. Compensate for decimation processing gain so the meter matches the spectrum peak. Display with one decimal place in all units. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
@@ -582,16 +582,16 @@ let sigStrengthUnitIdx = loadSetting("sigStrengthUnit", 0);
|
||||
function formatSigStrength(dbm) {
|
||||
if (!Number.isFinite(dbm)) return "--";
|
||||
const unit = SIG_STRENGTH_UNITS[sigStrengthUnitIdx] || "dBFS";
|
||||
if (unit === "dBm") return `${dbm} dBm`;
|
||||
if (unit === "dBm") return `${dbm.toFixed(1)} dBm`;
|
||||
if (unit === "dBf") {
|
||||
// dBf = dBm + 107 (referenced to 1 femtowatt across 50 Ω)
|
||||
const dbf = dbm + 107;
|
||||
return `${dbf.toFixed(0)} dBf`;
|
||||
return `${dbf.toFixed(1)} dBf`;
|
||||
}
|
||||
// dBFS: map receiver range to a full-scale reference
|
||||
// Typical receiver: -140 dBm (noise floor) to 0 dBm (full scale)
|
||||
const dbfs = Math.max(-140, Math.min(0, dbm));
|
||||
return `${dbfs} dBFS`;
|
||||
return `${dbfs.toFixed(1)} dBFS`;
|
||||
}
|
||||
|
||||
function refreshSigStrengthDisplay() {
|
||||
@@ -9199,7 +9199,7 @@ function startSpectrumStreaming() {
|
||||
vchanRdsById = next;
|
||||
vchanSignalDbById = nextSig;
|
||||
if (typeof vchanActiveId !== "undefined" && vchanActiveId && nextSig.has(vchanActiveId)) {
|
||||
sigLastDbm = Math.round(nextSig.get(vchanActiveId));
|
||||
sigLastDbm = nextSig.get(vchanActiveId);
|
||||
refreshSigStrengthDisplay();
|
||||
}
|
||||
updateRdsPsOverlay(primaryRds);
|
||||
|
||||
Reference in New Issue
Block a user