Fix crash/reboot: remove conflicting TinyUSB core sources from Adafruit lib instead of allow-multiple-definition
This commit is contained in:
+19
-1
@@ -1,3 +1,21 @@
|
||||
Import("env")
|
||||
import os
|
||||
|
||||
env.Append(LINKFLAGS=["-Wl,--allow-multiple-definition"])
|
||||
lib_path = os.path.join(
|
||||
env.subst("$PROJECT_DIR"),
|
||||
".pio", "libdeps", env.subst("$PIOENV"),
|
||||
"Adafruit TinyUSB Library", "src"
|
||||
)
|
||||
|
||||
conflicting = [
|
||||
"tusb.c",
|
||||
"common/tusb_fifo.c",
|
||||
"device/usbd.c",
|
||||
"device/usbd_control.c",
|
||||
]
|
||||
|
||||
for f in conflicting:
|
||||
path = os.path.join(lib_path, f)
|
||||
if os.path.exists(path):
|
||||
os.remove(path)
|
||||
print(f"[extra_script] Removed {f} (provided by ESP32 core libarduino_tinyusb.a)")
|
||||
|
||||
+2
-14
@@ -13,27 +13,15 @@ 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()) {
|
||||
Serial.println("[MIDI] ERROR: USB MIDI init failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (TinyUSBDevice.mounted()) {
|
||||
TinyUSBDevice.detach();
|
||||
delay(10);
|
||||
TinyUSBDevice.attach();
|
||||
}
|
||||
Serial.printf("[MIDI] USB VID:PID=%04X:%04X\r\n",
|
||||
TinyUSBDevice.idVendor(), TinyUSBDevice.idProduct());
|
||||
|
||||
initialized = true;
|
||||
Serial.println("[MIDI] USB MIDI ready - enumerating...");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user