Big storage system changes, hopefully major bug fixes, collab and test branch

Hold on, it’s gonna get really weird! I’m about to push updates from @phdussud for reentrancy and for juggling the file system between PC USB MSD disk and the terminal. It’s going to be a bit disconcerting until you get used to it, but it works really well. I’ve written some docs to help smooth over the transition, will push them soon.

New storage behavior:

  1. The USB MSC disk will be read and writable when a terminal is not connected
  2. While a terminal is connected the USB disk with detach, and reattach as a read only drive
  3. When files or directories are added, changed, or deleted via the terminal, the USB MSC disk with detach and reattach so the host operating system on the PC sees the changed contents

This keeps everything in sync, but it takes a bit of getting used to.

The updates have been installed in the lower level FatFS code and should take effect everywhere.

I also enabled FatFS mini mode, which will share a single 2K buffer instead of putting multiples on the stack. This should fix a lot of the crashes doing file system stuff, but I’ll need to see if it works for everyone or just me.

These are big changes, so I created a new auto build “test” for testing before going to main.

A new branch called “contrib” is also being compiled and posted in the forum. This is to speed up the acceptance of pull requests.

Test firmware branch compiles.

Not entirely sure that ‘contrib’ is needed, maybe pull request against test? Easier to keep two branches in sync than 3.

@ian I see the change in f_close()
I think that if we only call refreshusbmsdrive() when the file is open in write mode it would be a better user experience. Less unmount remount. The following code would work:

if (fp->flag & FA_WRITE) refresh_usbmsdrive();

1 Like

My thought as well. I have not hunted down the variable and flag.

Edit: I mistook your pseudo code :slight_smile: hunting down the variable and flag is on my list.

Edit 2: oh that seems right. Thank you.

:grinning: Right, real, usable code served to you.

1 Like

I mean ‘’‘flag’‘’ just seemed too on the nose after I posted and reviewed the first time. :rofl: