Skip to content

Conversation

@sensei-hacker
Copy link
Member

Summary

Two fixes for issues that cause the MSP decoder to enter a bad state, requiring disconnect/reconnect to recover.

Changes

1. Reset decoder state on exception (msp.js)

  • Added try-finally in _dispatch_message() to ensure decoder state (message_length_received, state) is always reset
  • Previously, if processData() threw an exception, the decoder remained in a non-IDLE state
  • Subsequent bytes would be misinterpreted, causing CRC failures and corrupted communication

2. Fix incorrect send_message parameter (MSPHelper.js)

  • Removed erroneous 5th parameter from MSP.send_message() call in loadLogicConditions()
  • The 5th parameter is protocolVersion (a number), not an error callback
  • Passing a function caused "Invalid MSP protocol version" exception
  • This exception propagated to the isolated context, breaking serial communication

Testing

  • Verified Mixer tab loads correctly without errors
  • Confirmed packet error counter stays at 0
  • Serial communication remains stable after tab navigation

The 5th parameter of MSP.send_message() is protocolVersion (a number),
not an error callback. Passing a function caused 'Invalid MSP protocol
version' exception which propagated to the isolated context, breaking
serial communication until reconnect.
@sensei-hacker sensei-hacker merged commit d0ded94 into iNavFlight:maintenance-9.x Dec 24, 2025
6 checks passed
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