Added code to release USB id on CLCD.

master
Marcio Teixeira 6 years ago
parent 0845bc8521
commit ff936a5f92

@ -93,8 +93,15 @@ bool Sd2Card::usbHostReady() {
// Marlin will call this to learn whether an SD card is inserted.
bool Sd2Card::isInserted() {
if(usbHostReady()) {
const uint8_t lastUsbTaskState = usb.getUsbTaskState();
usb.Task();
return usb.getUsbTaskState() == USB_STATE_RUNNING;
const uint8_t newUsbTaskState = usb.getUsbTaskState();
if(lastUsbTaskState == USB_STATE_RUNNING && newUsbTaskState != USB_STATE_RUNNING) {
// the user pulled the flash drive. Make sure the bulk storage driver releases the address
SERIAL_ECHOLNPGM("Drive removed\n");
bulk.Release();
}
return newUsbTaskState == USB_STATE_RUNNING;
}
}

@ -94,7 +94,7 @@ typedef MAX3421e<P10, P9> MAX3421E; // Official Arduinos (UNO, Duemilanove, Mega
#define USB_RETRY_LIMIT 3 // 3 retry limit for a transfer
#define USB_SETTLE_DELAY 200 //settle delay in milliseconds
#define USB_NUMDEVICES 16 //number of USB devices
#define USB_NUMDEVICES 2 //number of USB devices (changed by marcio@alephobjects.com)
//#define HUB_MAX_HUBS 7 // maximum number of hubs that can be attached to the host controller
#define HUB_PORT_RESET_DELAY 20 // hub port reset delay 10 ms recomended, can be up to 20 ms

Loading…
Cancel
Save