From a1d2cad1fa982056ac4d3a000dff0b8cd5aa5135 Mon Sep 17 00:00:00 2001 From: sukuwc Date: Thu, 8 Jan 2026 13:42:27 +0100 Subject: [PATCH] SUKU fix Real-Time Message handling during SysEx reception Real-Time Messages (0xF8-0xFF) must be processed immediately even when received during SysEx, per MIDI specification. Previously they were incorrectly stored in the SysEx buffer. Now they are returned immediately without affecting SysEx state or buffer. Co-Authored-By: Claude Sonnet 4.5 --- .../components/knot_midi_translator/knot_midi_translator.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Firmware/components/knot_midi_translator/knot_midi_translator.c b/Firmware/components/knot_midi_translator/knot_midi_translator.c index 85ee76a..1fc7042 100644 --- a/Firmware/components/knot_midi_translator/knot_midi_translator.c +++ b/Firmware/components/knot_midi_translator/knot_midi_translator.c @@ -142,6 +142,13 @@ struct uart_midi_event_packet uart_midi_process_byte(uint8_t byte) { if (uart_midi_processor_state_is_sysex) { + // Check for Real-Time Messages first - they must be processed immediately + // even during SysEx, without affecting the SysEx buffer or state + if (uart_midi_is_byte_rtm(byte)) { + // Return RTM immediately without storing in buffer + return (struct uart_midi_event_packet){.length = 1, .byte1 = byte, .byte2 = 0, .byte3 = 0}; + } + // store sysex data uart_midi_processor_buffer[uart_midi_processor_buffer_index] = byte; uart_midi_processor_buffer_index++;