Skip to content

Signal-quality rating should be modem-preset-relative, not fixed thresholds #1241

Open

Description

@garthvh

Problem

Per meshtastic/design#15, LoRa signal quality should be rated as SNR relative to the active modem preset's demodulation floor — a given SNR means very different things on different spreading factors (e.g. -15 dB is excellent on LongSlow/SF12 but would be unusable on ShortFast/SF7). A fixed SNR threshold mis-rates most presets.

The web client currently has two separate, uncoordinated fixed-threshold schemes, neither of which is preset-relative:

  1. apps/web/src/core/utils/signalColor.ts — getSignalColor(snr, rssi?) uses fixed SNR_THRESHOLD = {GOOD: -7, FAIR: -15} and RSSI_THRESHOLD = {GOOD: -115, FAIR: -126}. Used by the map's SNR-colored line layer (SNRLayer.tsx).
  2. apps/web/src/components/PageComponents/Map/Popups/NodeDetail.tsx and apps/web/src/pages/Nodes/index.tsx — a separate, ad-hoc linear heuristic: clamp(round((snr + 10) * 5), 0, 100) (-10dB→0%, +10dB→100%), tiered green/yellow/red at 67%/34%. No RSSI, no preset.

Neither reads ModemPreset — the type only appears in the LoRa config form, never joined with SNR quality logic.

Reference implementation (Android/iOS)

Both mobile clients already implement the preset-relative model — this is the reference to port:

  • Android — core/ui/.../component/LoraSignalIndicator.kt's determineSignalQuality(snr, modemPreset): Good if snr > limit, Fair if snr > limit - 5.5, Bad if snr >= limit - 7.5, else None. The per-preset limit table is ChannelOption.snrLimit in core/model/.../ChannelOption.kt (e.g. LONG_FAST = -17.5, SHORT_FAST = -7.5, LONG_SLOW = -20). Android deliberately excludes RSSI from the rating (SNR alone determines demodulability without knowing the noise floor — see Meshtastic-Android#5446), though RSSI is still displayed separately.
  • iOS — Meshtastic/Views/Helpers/LoRaSignalStrengthIndicator.swift + ModemPresets.snrLimit() in Meshtastic/Enums/LoraConfigEnums.swift — same preset-relative bands, but also blends in fixed RSSI thresholds (-115/-120/-126) alongside SNR.

Per-preset SNR floor table (verified matching between iOS/Android, in dB): LongFast -17.5, LongModerate -17.5, LongTurbo -12.5, LongSlow -20, MedSlow -15, MedFast -12.5, ShortSlow -10, ShortFast -7.5, ShortTurbo -7.5.

Fix

  1. Add a ModemPreset → snrLimit lookup table (port the values above; the web client's protobuf schema already defines ModemPreset since it's shared across clients).
  2. Replace both getSignalColor() and the linear (snr+10)*5 heuristic with a single preset-relative rating function, following the iOS behavior (settled — see comment below): use the receiving node's noise floor when available, fall back to preset thresholds when it isn't.
    • Shared tier function on the margin above the preset's demodulation floor: margin > 0 → Good, > -5.5 → Fair, >= -7.5 → Bad, else None.
    • Noise-floor path (noise floor known and nonzero, RSSI present): rate two margins — snr - presetLimit and (rssi - noiseFloor) - presetLimit — and take the more conservative of the two tiers. The noise floor comes from the node's most recent LocalStats telemetry (noise_floor, nonzero).
    • Fallback path (no noise floor): rssi == 0 → SNR-only against the preset limit; otherwise the fixed-RSSI blend: rssi > -115 && snr > limit → Good; rssi < -126 && snr < limit - 7.5 → None; rssi <= -120 || snr <= limit - 5.5 → Bad; else Fair.
  3. Consolidate to one signal-quality function used consistently by both the map SNR layer and the node list/detail displays, rather than the current two divergent implementations.

Reference

Cross-platform alignment tracking issue: meshtastic/design#15.

Activity

  1. added
    bug
    help wanted
    parity
    on Jul 5, 2026
  2. garthvh commented on Aug 12, 2026

    @garthvh
    MemberAuthor

    Settling the open question in step 2 of the fix plan: follow the iOS behavior — use noise-floor data when available, fall back to the preset values when it isn't (the body above now specifies the exact algorithm and thresholds).

    Rationale, from the iOS implementation (LoRaSignalStrengthIndicator.swift): when the receiving node reports a noise floor in its LocalStats telemetry, the real link margin (rssi − noiseFloor) is a second, more physical SNR estimate — rating both it and the reported SNR against the preset's demodulation floor and taking the more conservative tier is more accurate than trusting either alone. When no noise floor is available, SNR alone can't distinguish a genuinely weak link, so the guessed fixed RSSI thresholds (−115/−120/−126) stay in the blend as a sanity floor rather than dropping to SNR-only.

  3. RuffR1d3r commented on Aug 26, 2026

    @RuffR1d3r

    Hi! I'd like to take this one — the help wanted label and the settled
    algorithm above make it a clear starting point.

    Plan, following @garthvh's ruling (noise-floor dual-margin when available,
    preset+RSSI blend otherwise):

    1. Port the per-preset SNR limit table, matching Android's
      ChannelOption.snrLimit (including the newer 2.8-era presets, with a
      graceful fallback to LONG_FAST limits for unknown preset values, as
      Android does)
    2. Add one shared preset-relative rating function with table-driven tests
      covering all presets and boundary margins
    3. Replace both fixed-threshold sites (signalColor.ts and the linear
      heuristic in NodeDetail.tsx / Nodes/index.tsx) with the shared
      function

    One scoping question I'll confirm while building: if the client doesn't
    currently store LocalStats.noise_floor, I'd ship the fallback path first
    (as specified) and propose the noise-floor wiring as a follow-up rather
    than expanding scope unilaterally.

    Will open a draft PR once the implementation and tests are up. Feedback
    welcome at any stage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bughelp wantedparity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions