Fix USB MIDI enumeration: switch from ARDUINO_USB_MODE=1 to 0 (matches working Adafruit TinyUSB example), add explicit TinyUSBDevice.begin(0) and detach/attach re-enumeration, remove conflicting tusb_config.h
This commit is contained in:
+3
-2
@@ -7,12 +7,13 @@ board = esp32-s3-devkitc-1
|
||||
framework = arduino
|
||||
|
||||
lib_deps =
|
||||
adafruit/Adafruit TinyUSB Library@^2.0.0
|
||||
adafruit/Adafruit TinyUSB Library@^3.1.0
|
||||
fastled/FastLED@^3.9.0
|
||||
|
||||
build_flags =
|
||||
-DARDUINO_USB_MODE=1
|
||||
-DARDUINO_USB_MODE=0
|
||||
-DARDUINO_USB_CDC_ON_BOOT=1
|
||||
-DUSE_TINYUSB=1
|
||||
|
||||
monitor_speed = 115200
|
||||
|
||||
|
||||
@@ -82,6 +82,12 @@ void handle_serial_command(const String& cmd) {
|
||||
mux.set_led_color(1, 255, 255, 255);
|
||||
mux.show();
|
||||
Serial.println("[CMD] Pixel 1 WHITE (max brightness)");
|
||||
} else if (cmd == "usb") {
|
||||
Serial.printf("[CMD] USB mounted: %s\n", TinyUSBDevice.mounted() ? "YES" : "NO");
|
||||
Serial.printf("[CMD] USB VID:PID = 0x%04X:0x%04X\n", TinyUSBDevice.vid(), TinyUSBDevice.pid());
|
||||
Serial.printf("[CMD] USB manufacturer: %s\n", TinyUSBDevice.manufacturerDescriptor());
|
||||
Serial.printf("[CMD] USB product: %s\n", TinyUSBDevice.productDescriptor());
|
||||
Serial.printf("[CMD] USB serial: %s\n", TinyUSBDevice.serialDescriptor());
|
||||
} else if (cmd == "gpiotest") {
|
||||
Serial.println("[CMD] === Raw GPIO Test ===");
|
||||
uint8_t pins[] = {9, 10, 11, 12};
|
||||
@@ -122,6 +128,7 @@ void handle_serial_command(const String& cmd) {
|
||||
Serial.println(" read - raw button read");
|
||||
Serial.println(" red/green/blue - solid colour");
|
||||
Serial.println(" pixel0/pixel1 - single pixel test");
|
||||
Serial.println(" usb - USB connection status and descriptor info");
|
||||
Serial.println(" gpiotest - raw GPIO pin diagnostic");
|
||||
Serial.println(" rawled - bit-bang WS2812 (no library)");
|
||||
Serial.println(" anim - re-run startup animation from loop");
|
||||
|
||||
+11
-1
@@ -13,15 +13,25 @@ UsbMidiTransport::~UsbMidiTransport() {
|
||||
bool UsbMidiTransport::begin() {
|
||||
Serial.println("[MIDI] Setting up USB MIDI device...");
|
||||
|
||||
if (!TinyUSBDevice.isInitialized()) {
|
||||
TinyUSBDevice.begin(0);
|
||||
}
|
||||
|
||||
TinyUSBDevice.setManufacturerDescriptor("Ashley Strahle");
|
||||
TinyUSBDevice.setProductDescriptor("Loopy Foot Controller");
|
||||
TinyUSBDevice.setSerialDescriptor("LFMIDI001");
|
||||
|
||||
if (!usb_midi.begin(32)) {
|
||||
if (!usb_midi.begin()) {
|
||||
Serial.println("[MIDI] ERROR: USB MIDI init failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (TinyUSBDevice.mounted()) {
|
||||
TinyUSBDevice.detach();
|
||||
delay(10);
|
||||
TinyUSBDevice.attach();
|
||||
}
|
||||
|
||||
initialized = true;
|
||||
Serial.println("[MIDI] USB MIDI ready - enumerating...");
|
||||
return true;
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
#ifndef TUSB_CONFIG_H
|
||||
#define TUSB_CONFIG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define CFG_TUD_MIDI 1
|
||||
#define CFG_TUD_MIDI_RX_BUFSIZE 64
|
||||
#define CFG_TUD_MIDI_TX_BUFSIZE 64
|
||||
|
||||
#define CFG_TUD_CDC 0
|
||||
#define CFG_TUD_MSC 0
|
||||
#define CFG_TUD_HID 0
|
||||
#define CFG_TUD_NET 0
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user