swap init order (USB before BLE), add USB ready check and debug prints
This commit is contained in:
+4
-4
@@ -346,14 +346,14 @@ void setup() {
|
||||
switch_driver.set_mux(&mux);
|
||||
switch_driver.begin();
|
||||
|
||||
Serial.println("[INIT] Initializing BLE MIDI...");
|
||||
delay(1000);
|
||||
ble_midi_transport.begin();
|
||||
|
||||
Serial.println("[INIT] Initializing USB MIDI...");
|
||||
midi_transport.begin();
|
||||
delay(500);
|
||||
|
||||
Serial.println("[INIT] Initializing BLE MIDI...");
|
||||
delay(1000);
|
||||
ble_midi_transport.begin();
|
||||
|
||||
Serial.println("[INIT] Registering MIDI callbacks...");
|
||||
controller.begin();
|
||||
|
||||
|
||||
@@ -91,7 +91,15 @@ void UsbMidiTransport::send_note_off(uint8_t channel, uint8_t note, uint8_t velo
|
||||
}
|
||||
|
||||
void UsbMidiTransport::send_cc(uint8_t channel, uint8_t cc, uint8_t value) {
|
||||
if (!initialized) return;
|
||||
if (!initialized) {
|
||||
Serial.println("[MIDI DBG] send_cc: not initialized");
|
||||
return;
|
||||
}
|
||||
if (!TinyUSBDevice.ready()) {
|
||||
Serial.println("[MIDI DBG] send_cc: USB not ready");
|
||||
return;
|
||||
}
|
||||
Serial.println("[MIDI DBG] send_cc: calling writePacket...");
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user