Fix hard faults when handling large MSP responses over CRSF#11369
Open
KeithCoreDumped wants to merge 3 commits intoiNavFlight:maintenance-9.xfrom
Open
Fix hard faults when handling large MSP responses over CRSF#11369KeithCoreDumped wants to merge 3 commits intoiNavFlight:maintenance-9.xfrom
KeithCoreDumped wants to merge 3 commits intoiNavFlight:maintenance-9.xfrom
Conversation
…r size when connected via TCP
… initialization when connected via TCP
Branch Targeting SuggestionYou've targeted the
If This is an automated suggestion to help route contributions to the appropriate branch. |
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.
Description
Resolves hard faults and connection hangs when the INAV Configurator requests large datasets (e.g., Mixer configuration on the Mixer tab) via an ELRS WiFi TCP connection.
System Architecture
graph LR A["INAV<br/>Configurator<br/>(TCP Client)"] -->|MSP Request| B["ELRS WiFi<br/>TCP Server<br/>:5761"] B -->|MSP in CRSF Req| C C -->|MSP in CRSF Res| B B -->|MSP Response| A subgraph FC["INAV Flight Controller"] C["CRSF<br/>Handler"] -->|MSP Request| D["MSP<br/>Handler"] D -->|MSP Response| C endRoot Cause
The original MSP-over-CRSF implementation assumed small payloads. When requesting large datasets (like the 432-byte Mixer config), this caused:
CRSF_MSP_RX_BUF_SIZE(128 bytes), leading to hard faults.uint8_toverflows insizeandbufferBytesRemaining, corrupting MSP headers and packet tracking.initSharedMsp().Investigation
Fixes & Memory Impact
CRSF_MSP_RX_BUF_SIZEandCRSF_MSP_TX_BUF_SIZEto 512 bytes (safely accommodates max known payloads).sizeandbufferBytesRemainingfromuint8_ttouint16_t.initSharedMsp()and pointer resets inprocessMspPacket().Expected Behavior & Verification
NEUTRONRCF435MINIwith an ESP8285 ELRS RX (v3.6.2).MSP2_INAV_SERVO_MIXERloads successfully with a valid CRC.