Skip to content

Score packets at the spreading factor the radio reports - #3808

Open
marcelverdult wants to merge 1 commit into
meshcore-dev:devfrom
marcelverdult:upstream-candidate/lr-packet-score-sf
Open

marcelverdult wants to merge 1 commit into
meshcore-dev:devfrom
marcelverdult:upstream-candidate/lr-packet-score-sf

Conversation

@marcelverdult

@marcelverdult marcelverdult commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Problem

RadioLibWrapper::packetScore() used spreading factor 10 for every wrapper without its own override. LR1110, LR1121 and LR2021 have none, so their packets were always scored as if the radio ran at SF10, although all three report their real factor through getSpreadingFactor().

The SNR a packet needs rises as the spreading factor falls (packetScoreInt() has one threshold per factor, -7.5 dB at SF7 to -20 dB at SF12). Below SF10 the score came out too high, above SF10 too low.

Fix

packetScore() in the base class now calls getSpreadingFactor(). The five wrappers that overrode it (SX1262, SX1268, SX1276, LLCC68, STM32WLx) return the same member from getSpreadingFactor(), so their overrides are removed. A wrapper that reports no factor falls back to the build's LORA_SF.

Compatibility

The score feeds logging and calcRxDelay(). rx_delay_base is 0 by default, so a default configuration only changes what is logged. With rxdelay above 0, the rebroadcast delay of LR boards changes. For a 64 byte packet with 500 ms airtime and rxdelay 10: SF7 at -5 dB goes from score 0.750 to 0.188 (129 ms to 1799 ms delay), SF12 at -10 dB from 0.375 to 0.750 (993 ms to 129 ms). At SF10 nothing changes.

@marcelverdult
marcelverdult force-pushed the upstream-candidate/lr-packet-score-sf branch from 49ed34b to 2facb91 Compare November 11, 2026 10:53
marcelverdult added a commit to marcelverdult/MeshCore_Refactor that referenced this pull request Nov 11, 2026
…score-sf

docs: note for upstream PR meshcore-dev#3808 (packet score at the reported spreading factor)
@marcelverdult
marcelverdult force-pushed the upstream-candidate/lr-packet-score-sf branch from 2facb91 to 8833660 Compare November 11, 2026 11:41
RadioLibWrapper::packetScore() assumed spreading factor 10 for every wrapper
that did not override it. LR1110, LR1121 and LR2021 have no override, so their
packets were always scored as if the radio ran at SF10, although all three
report their real factor through getSpreadingFactor().

The SNR a packet needs to be decodable rises as the spreading factor falls
(packetScoreInt() holds one threshold per factor, -7.5 dB at SF7 to -20 dB at
SF12), so below SF10 the score came out too high and above SF10 too low.

The five wrappers that did override packetScore() (SX1262, SX1268, SX1276,
LLCC68, STM32WLx) read the same member that their getSpreadingFactor() returns.
The base class now calls getSpreadingFactor() and those five overrides are
removed. A wrapper that reports its factor is scored correctly without extra
code, and one that reports nothing falls back to the build's LORA_SF.

The score is used for logging and for calcRxDelay(). All four roles compute
that delay from rx_delay_base, which is 0 by default, so on a default
configuration the change affects what is logged. With rxdelay above 0 the
rebroadcast delay of LR boards changes. For a 64 byte packet and 500 ms
airtime with rxdelay 10: SF7 at -5 dB goes from score 0.750 to 0.188 and from
129 ms to 1799 ms delay; SF12 at -10 dB goes from 0.375 to 0.750 and from
993 ms to 129 ms. At SF10 nothing changes.
@marcelverdult
marcelverdult force-pushed the upstream-candidate/lr-packet-score-sf branch from 8833660 to 02f08ee Compare November 12, 2026 12:12

This branch has not been deployed

No deployments
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