Repository navigation
Score packets at the spreading factor the radio reports - #3808
Open
marcelverdult wants to merge 1 commit into
Open
marcelverdult wants to merge 1 commit into
marcelverdult wants to merge 1 commit into
Conversation
marcelverdult
force-pushed
the
upstream-candidate/lr-packet-score-sf
branch
from
November 11, 2026 10:53
49ed34b to
2facb91
Compare
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
force-pushed
the
upstream-candidate/lr-packet-score-sf
branch
from
November 11, 2026 11:41
2facb91 to
8833660
Compare
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
force-pushed
the
upstream-candidate/lr-packet-score-sf
branch
from
November 12, 2026 12:12
8833660 to
02f08ee
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 throughgetSpreadingFactor().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 callsgetSpreadingFactor(). The five wrappers that overrode it (SX1262, SX1268, SX1276, LLCC68, STM32WLx) return the same member fromgetSpreadingFactor(), so their overrides are removed. A wrapper that reports no factor falls back to the build'sLORA_SF.Compatibility
The score feeds logging and
calcRxDelay().rx_delay_baseis 0 by default, so a default configuration only changes what is logged. Withrxdelayabove 0, the rebroadcast delay of LR boards changes. For a 64 byte packet with 500 ms airtime andrxdelay10: 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.