Skip to content

fix(spectrum): smarter Floor: auto-adjust (smoothing + transient rejection)#2653

Merged
ten9876 merged 1 commit into
mainfrom
noise-floor/cherry-pick-improvements
May 14, 2026
Merged

fix(spectrum): smarter Floor: auto-adjust (smoothing + transient rejection)#2653
ten9876 merged 1 commit into
mainfrom
noise-floor/cherry-pick-improvements

Conversation

@ten9876

@ten9876 ten9876 commented May 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

Consolidates rfoust's "Lock Spectrum Position" algorithm work from #2643 into the existing Display → Floor: noise-floor auto-adjust feature instead of adding a second parallel UX entry point.

The existing Floor: toggle used a 20th-percentile / every-10-frames / zoom-the-span approach that produced:

  • Visible stepping as the range changed in 10-frame jumps
  • Span varied with the floor, making signal visual heights jump every time the floor drifted
  • Lightning crashes and key-up edge clicks pulled the lock immediately

This PR replaces the algorithm with the smoothing + transient rejection logic from #2643 (with permission and attribution preserved via co-author), driving it through the existing toggle + slider so users get the upgrade without learning a new UI surface.

What's in the new algorithm

  • Per-frame baseline update with asymmetric smoothing — τ ≈ 0.08–0.12 s on drops (track noise reductions fast), τ ≈ 1.2–8 s on rises (don't chase upward transients).
  • Candidate-state transient filter — ≥4 dB upward shifts must persist 16 frames / 1.2 s before being adopted; downward shifts adopt in 2 frames / 70 ms.
  • Pan instead of zoom — `m_refLevel` slides to keep the smoothed floor at the slider position; `m_dynamicRange` (span) stays fixed. Signals no longer change visual height when the floor drifts.
  • Smooth motion (τ ≈ 0.10–0.24 s) instead of 10-frame stepping.
  • Command throttling — ≥150 ms / ≥0.75 dB between `dbmRangeChangeRequested` emits, so the radio isn't flooded.
  • Shared noise-floor estimator — two-pass trimmed mean extracted into `estimateNoiseFloorDbm()`; was duplicated between the floor overlay line and the auto-adjust path.
  • Reset triggers in 5 zoom/band-change/dBm-drag paths so the baseline re-acquires after disruptions.

UX

No new menu entries, no new toggles. The existing Display → Floor: button drives the new algorithm. The position slider behaves the same. The dBm-scale drag is now also captured as a new target position (consistent with rfoust's original design).

Validation

  • Built locally, clean
  • Live-tested on FLEX-8600: antenna swaps and preamp toggles re-pin the floor at the slider position smoothly; key-edge clicks no longer pull the lock; signal heights stay constant as the floor moves

Closes

Co-authored with rfoust (algorithm) and Claude.

73, Jeremy KK7GWY & Claude (AI dev partner)

…ansient rejection + pan instead of zoom

The Display → Floor: noise-floor auto-adjust previously used a
20th-percentile / every-10-frames / zoom-the-span algorithm.  Symptoms:
- Visible stepping as the range changed in 10-frame jumps.
- Span varied with the floor, which made signal visual heights jump.
- Lightning crashes and key-up edge clicks pulled the lock immediately.

Cherry-picks rfoust's algorithm work from PR #2643 ("Lock Spectrum
Position") into this existing feature path instead of adding a second
parallel UX:

- Per-frame baseline update with asymmetric smoothing — τ = 0.08–0.12 s
  on drops (track noise reductions fast), τ = 1.2–8 s on rises (don't
  chase upward transients).
- Candidate-state transient filter — ≥4 dB upward shifts must persist
  16 frames / 1.2 s before being adopted; downward 2 frames / 70 ms.
- Pan instead of zoom: m_refLevel slides to keep the smoothed floor at
  m_noiseFloorPosition; m_dynamicRange (span) stays fixed.  Signals no
  longer change visual height when the floor drifts.
- Smooth m_refLevel motion (τ = 0.10–0.24 s) instead of stepping.
- Command throttling — ≥150 ms / ≥0.75 dB between dbmRangeChangeRequested
  emits so the radio isn't flooded.
- Two-pass trimmed-mean noise-floor estimator extracted into a shared
  estimateNoiseFloorDbm() helper (was duplicated between the floor
  overlay line and the auto-adjust path).
- Reset triggers in zoom / band-change / dBm-drag / pan-recenter paths
  so the baseline re-acquires after disruptions (5 fresh frames force
  the baseline rather than smoothing from a stale value).

Driven by the existing m_noiseFloorEnable toggle (Display → Floor) and
m_noiseFloorPosition slider (0=top, 100=bottom).  No new menu entries,
no new toggles — the existing UX gets the upgraded algorithm.

PR #2643 (the "Lock Spectrum Position" right-click toggle that this
work is derived from) is closed in favour of this consolidation:
two implementations of the same feature would have been confusing for
users and a maintenance burden.

Co-Authored-By: rfoust <rfoust@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ten9876 ten9876 requested a review from jensenpat as a code owner May 14, 2026 06:12
@ten9876 ten9876 merged commit 837d190 into main May 14, 2026
5 checks passed
@ten9876 ten9876 deleted the noise-floor/cherry-pick-improvements branch May 14, 2026 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant