Repository navigation
Suku sysex and rtm rx - #304
Merged
Merged
Conversation
Adds state machine to properly handle USB MIDI SysEx and Real-Time Messages. Platform code simplified to pass raw USB packets to common state machine in grid_usb.c. Key changes: - Three separate RX buffers: normal MIDI, SysEx (raw bytes), RTM (raw bytes) - State machine handles SysEx assembly with direct SWSR writes - RTM messages processed immediately, even during SysEx reception - Enums added for USB MIDI CIN codes and MIDI message types - All magic numbers replaced with descriptive enum values - grid_midi_rx_push() signature changed to accept raw USB packet bytes Platform updates: - ESP32 and SAMD51 code simplified to pass raw USB MIDI packets - Single implementation shared across all platforms Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Extracts helper functions to improve readability and maintainability: - grid_midi_rx_push_rtm() - Handle Real-Time Messages - grid_midi_rx_push_sysex() - Handle SysEx with switch statement - grid_midi_should_filter_sync() - Sync message filtering logic - grid_midi_rx_push_normal() - Handle normal MIDI messages Main function reduced from ~20 decision points to 4-5, making it easier to understand and maintain. Each helper has a single, clear responsibility. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…ling Fixed two critical issues in grid_midi_sysex_process_complete: - Calculate payload offset correctly: msg.offset + GRID_CLASS_MIDISYSEX_PAYLOAD_offset + i*2 - Update msg.length after writing payload to prevent frame_end from overwriting data Added debug print statements for monitoring MIDI message flow. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…eter_raw Changed from grid_msg_set_parameter to grid_msg_set_parameter_raw for setting BRC_SX and BRC_SY in both grid_midi_rx_pop and grid_midi_sysex_process_complete. After grid_msg_init_brc, msg.offset points past the header, so grid_msg_set_parameter writes to the wrong location. grid_msg_set_parameter_raw writes at absolute positions, which is required for header fields. This fixes the sysex decoder rejection where sx==sy==DEFAULT_POSITION (127) instead of GLOBAL_POSITION (0), allowing sysexrx_cb to trigger correctly on modules. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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.
No description provided.