Fix button-to-MIDI latency: remove blocking serial, reduce debounce, faster loop
Latency sources fixed: - debounce 50ms -> 5ms (switch_stub.cpp:15) - Removed [MIDI OUT] Serial.printf from send_cc() (midi_transport.cpp:93-98) - Removed [APP] Switch pressed/released prints from update() (app_task.cpp:39,43) - Removed [APP] Switch -> CC print from process_switch_event() (app_task.cpp:140-143) - loop() delay 10ms -> 1ms (main.cpp:390) Serial output at 115200 baud was taking 2-5ms per printf call in the critical button-to-MIDI path, adding 7-15ms+ total latency per button press. All removed from hot path.
This commit is contained in:
@@ -94,7 +94,6 @@ void UsbMidiTransport::send_cc(uint8_t channel, uint8_t cc, uint8_t value) {
|
||||
if (!initialized) return;
|
||||
uint8_t packet[4] = {0x0B, (uint8_t)(0xB0 | (channel - 1)), cc, value};
|
||||
usb_midi.writePacket(packet);
|
||||
Serial.printf("[MIDI OUT] Ch:%d CC:%d:%d\n", channel, cc, value);
|
||||
}
|
||||
|
||||
bool UsbMidiTransport::is_connected() {
|
||||
|
||||
Reference in New Issue
Block a user