PaulStoffregen / USBHost_t36

USB Host Library for Teensy 3.6 and 4.0
166 stars 85 forks source link

Update DriveInfo.ino #116

Closed wwatson4506 closed 1 year ago

wwatson4506 commented 1 year ago

Fix intermittent drive init failure. Ran into a situation where a USB drive would fail to initialize properly. This showed up in two files. driveInfo.ino in the USBHost_t36 library and in an example sketch of mine copyFileUSB.ino. The drive init portion in setup() was incorrect:

Serial.print("\nInitializing USB MSC drive..."); // Wait for the drive to start. while (!myDrive) { myusb.Task(); } This waited for the drive to appear which it did. But sometimes the filesystem portion was not ready and any disk operation would fail. So changed it to:

Serial.print("\nWaiting for partition to...");

while (!myFiles) { myusb.Task(); } Tested ok without issue.