Open
Conversation
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.
Summary
This change makes MeshCore's SX126x-family receive path error-aware at the wrapper boundary instead of relying exclusively on RadioLib's high-level packet-length helper.
For SX1262, SX1268, LLCC68, and STM32WLx integrations, MeshCore now reads receive metadata through a dedicated low-level hook path that can propagate failures from
GET_RX_BUFFER_STATUSand the subsequent buffer read. The common wrapper logic treats those failures as receive errors instead of collapsing them into a benign-looking empty packet.The result is that SX126x-family boards no longer silently treat metadata-read failures as "no packet" when a receive interrupt has already fired.
Problem Addressed
MeshCore's generic
RadioLibWrapper::recvRaw()usedgetPacketLength()before callingreadData(). On SX126x-family radios, that path depended on RadioLib behavior that can fail open when receive metadata cannot be read successfully.In practice, that means a real metadata-read failure can be misinterpreted as a valid zero-length outcome, which causes MeshCore to drop the receive event without incrementing receive-error stats and without surfacing that the radio operation failed.
This change closes that gap for the SX126x-family radios MeshCore actively uses.
Approach
The implementation adds a wrapper hook for metadata-aware raw reads and uses it only where MeshCore has the radio-specific knowledge needed to do better than the generic
PhysicalLayerAPI:tryReadData(...)path that:The shared SX126x receive logic is centralized in one helper so the four supported SX126x-family classes do not diverge.
Why This Tradeoff Is Good
This is a deliberate middle path between two broader alternatives:
Those alternatives are reasonable long-term directions, but they are larger in scope and carry more compatibility and maintenance risk.
This change is a good tradeoff because it:
Broader RadioLib Error-Model Context
The larger problem behind this bug is that some RadioLib convenience APIs return only values, not values plus status. Once a helper such as
getPacketLength()collapses an SPI or command failure into an ordinary-looking value, MeshCore no longer has enough information at the wrapper layer to tell the difference between:That limitation is not uniform across all radios. In some places RadioLib still exposes lower-level operations with a real error channel, and in others the higher-level helper has already erased it. That is why a full library-wide fix would likely require a broader RadioLib API refactor rather than just more MeshCore wrapper code.
This PR does not claim to solve that general problem. It addresses one concrete case where MeshCore can recover correctness locally: the SX126x-family receive path still gives MeshCore enough low-level access to read buffer metadata directly and preserve the failure signal. That makes this a bounded fix with clear value, while leaving room for a larger RadioLib-side cleanup later if the project wants a consistent error-aware model across all radio families.
Validation
Heltec_v3_repeaterbuildwio-e5_repeaterbuildNotes
This PR intentionally does not try to solve the broader RadioLib error-model problem across every radio family. It addresses the concrete SX126x-family receive-metadata failure mode in MeshCore with a bounded change that is easy to review and reason about.