wwatson4506 / UsbMscFat

Teensy 36/40/41 Compatiblility Layer for MSC and SdFat
MIT License
9 stars 3 forks source link

issues with examples / difference between msc.begin and previous method #19

Open strud opened 2 years ago

strud commented 2 years ago

I am playing with some of your examples (eg listfileUSB.ino) and I am trying to get my head around how the object MSC is being declared?

for example, the line:

if (!MSC.begin(&msDrive1)) {

My compiler is upset about this not being declared anywhere, but it is not explicitly declared in your example.

Maybe it is my configuration, I am using VS code and Platform IO. This repo has been inserted into my lib folder.

The other issue (probably related) is that I can get a USB device 'loaded' using the previous builtin library and this code;

//USB MSC related USBHost myusb; USBHub hub1(myusb); USBHub hub2(myusb);

msController msDrive1(myusb); msController msDrive2(myusb); static uint8_t mscError = 0;

msDevice msDrive(myusb); UsbFs msc; .... ....

      Serial.printf(F("Initializing USB Drive(s)\n"));
      myusb.begin();
      if(mscError = msDrive1.mscInit())
        Serial.printf(F("msDrive1 not connected: Code: %d\n\n"),  mscError);
      else
        Serial.printf(F("msDrive1  connected\n"));

.....

but using your example code the equivalent fails (same hardware etc)

      myusb.begin();
      if (!msc.begin(&msDrive)) {
          Serial.println("initialization failed!");
      }
      else Serial.println("initialization done.");

Suggestions?

wwatson4506 commented 2 years ago

I recently added another branch that may not be compatible with the original branch. GitHub set it as the default branch and I did not catch that. I just set the default branch back to USbMscFat instead of UsbMscFat-decouple. That may be the problem. MSC is a moving target right now so things may change in Teensyduino in the future. Please keep that in mind:)

strud commented 2 years ago

Hi wwatson4506 Many thanks for that, much appreciated. Will try this tonight.

Craig

strud commented 2 years ago

So it was mostly positive although I did get a compilation error within your lib.


In file included from src\main.cpp:10:0: lib\UsbMscFat\src/mscFS.h:44:7: error: cannot derive from 'final' base 'File' in derived type 'MSCFile' class MSCFile : public File ^ lib\UsbMscFat\src/mscFS.h: In member function 'virtual File MSCFile::openNextFile(uint8_t)': lib\UsbMscFat\src/mscFS.h:122:42: error: no matching function for call to 'File::File(MSCFile*)' if (file) return File(new MSCFile(file)); ^

Code the compiler is upset with (inside mscFS.h) :


class MSCClass : public FS { public: MSCClass() { } bool begin(msController pDrive, bool setCwv = true, uint8_t part = 1) { return mscfs.begin(pDrive, setCwv, part); } File open(const char filepath, uint8_t mode = FILE_READ) { oflag_t flags = O_READ; if (mode == FILE_WRITE) {flags = O_RDWR | O_CREAT | O_AT_END; _cached_usedSize_valid = false; } else if (mode == FILE_WRITE_BEGIN) {flags = O_RDWR | O_CREAT; _cached_usedSize_valid = false; } MSCFAT_FILE file = mscfs.open(filepath, flags); if (file) return File(new MSCFile(file)); //error here CS 7/3/22 return File(); }


strud commented 2 years ago

Oh and this macro seems not to be defined:

lib\UsbMscFat\src\PFsLib\PFsExFatFormatter.cpp: In member function 'bool PFsExFatFormatter::format(PFsVolume&, uint8_t, print_t)': lib\UsbMscFat\src\PFsLib\PFsExFatFormatter.cpp:105:5: error: 'DBG_FAIL_MACRO' was not declared in this scope DBG_FAIL_MACRO;

wwatson4506 commented 2 years ago

Sorry. Now I think I see whats going on. What version of Arduino and Teensyduino are you using? To use this library you should use Arduino 1.8.19 and Tennsyduino 1.56. You will also need this version of UsbMscFat: https://github.com/KurtE/UsbMscFat/tree/FS_Integration. Again these libraries are in a state of development and may not be used or compatible with Teensyduino in the future:)

strud commented 2 years ago

I believe my Teensyduino and Arduino are upto date, but I am not using that version of UsbMscFat, will change to that and report back my tonight.

Thanks again

On Tue, Mar 8, 2022 at 12:01 PM Warren Watson @.***> wrote:

Sorry. Now I think I see whats going on. What version of Arduino and Teensyduino are you using? To use this library you should use Arduino 1.8.19 and Tennsyduino 1.56. You will also need this version of UsbMscFat: https://github.com/KurtE/UsbMscFat/tree/FS_Integration. Again these libraries are in a state of development and may not be used or compatible with Teensyduino in the future:)

— Reply to this email directly, view it on GitHub https://github.com/wwatson4506/UsbMscFat/issues/19#issuecomment-1061298974, or unsubscribe https://github.com/notifications/unsubscribe-auth/APYI7F7M2UX6EMCTCK3E2TTU62RGTANCNFSM5QAXO4XQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

strud commented 2 years ago

So the main issue I'm having now is that the macro: DBG_FAIL_MACRO is not defined anywhere.....

It seems to be used in this file only: PFsLib\PFsExFatFormatter.cpp

Looks like there is a missing include maybe? Is there something else I should be including or defining?

On Tue, Mar 8, 2022 at 1:20 PM Craig Strudwicke @.***> wrote:

I believe my Teensyduino and Arduino are upto date, but I am not using that version of UsbMscFat, will change to that and report back my tonight.

Thanks again

On Tue, Mar 8, 2022 at 12:01 PM Warren Watson @.***> wrote:

Sorry. Now I think I see whats going on. What version of Arduino and Teensyduino are you using? To use this library you should use Arduino 1.8.19 and Tennsyduino 1.56. You will also need this version of UsbMscFat: https://github.com/KurtE/UsbMscFat/tree/FS_Integration. Again these libraries are in a state of development and may not be used or compatible with Teensyduino in the future:)

— Reply to this email directly, view it on GitHub https://github.com/wwatson4506/UsbMscFat/issues/19#issuecomment-1061298974, or unsubscribe https://github.com/notifications/unsubscribe-auth/APYI7F7M2UX6EMCTCK3E2TTU62RGTANCNFSM5QAXO4XQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>