Skip to content

Improve 'listfile' example #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

AnHardt
Copy link
Contributor

@AnHardt AnHardt commented Oct 19, 2020

Searched "forever" why the 'listfile' example did not list deeper directories.
Here the solution.

Improve 'listfile' example by providing a example for a 'ffconf_custom.h' file.

Improve 'listfile' example by providing a example for a 'ffconf_custom.h' file.
@fpistm
Copy link
Member

fpistm commented Oct 20, 2020

Thanks @AnHardt

anyway is it really needed to add the config file as by default it is the same?
I think the comment is enough. Maybe add the official link can be useful:
http://elm-chan.org/fsw/ff/doc/config.html#fs_lock

@AnHardt
Copy link
Contributor Author

AnHardt commented Oct 20, 2020

Copying the right file (ffconf_default_68300.h) to the right place and renaming to the right name (ffconf_custom.h) are the hurdles to take. I thought that's worth an example.
Letting the value of 'fs_lock' at the old value was to demonstrate the issue. Nothing teaches more than seeing and solving the problem by your self, with a bit of help.

For a first time user of STM32SD the effect of 'fs-lock' is surprising. The reason for not opening the file is not available at the STM32SD-libraries level. To get the reason for the error you have to dig into the underlying FatFs-library. Experience with Arduinos SD-library does not help much because almost all other (Arduino) SD-libraries are based on Greimans SdFat-library. The existance of 'ffconf_custom.h' is completely undocumented at STM32SD level.

I think, having a example, is a good idea.

@fpistm
Copy link
Member

fpistm commented Oct 20, 2020

The existance of 'ffconf_custom.h' is completely undocumented at STM32SD level.

Not completely... https://github.com/stm32duino/STM32SD#fatfs

The reason for not opening the file is not available at the STM32SD-libraries level.

Maybe it would be possible to have the reason (I did not check)

I think it is more confusing to add the configuration file as the major user part will not use it and use it by default.
I never met this issue but I guess a better way would be to better handle it.

@AnHardt
Copy link
Contributor Author

AnHardt commented Oct 20, 2020

Do what you want. A PR is just a suggestion.

@fpistm
Copy link
Member

fpistm commented Oct 20, 2020

And also to open discussion. 😉
I have some work to perform on the lib to be more generic and aligned with the Cube but don't know when I will have time for this...

@AnHardt
Copy link
Contributor Author

AnHardt commented Oct 21, 2020

Getting the errors from the underlying lib is not that difficult. On top of my previous changes it could look like AnHardt#1 .
Just to illustrate the idea. Untested! Works for me.


An other idea to avoid the difficulties with the locks is, to switch them off by default (#define _FS_LOCK 0). As far as I know the Arduino SD has no problems with locks or limited directory depths, because there are no locks. Switching off the locks by default would increase the compatibility.
Untested! Works for me.

@fpistm
Copy link
Member

fpistm commented Apr 22, 2021

Switching off the locks by default would increase the compatibility.

I agree. Moreover with the previous FatFS version FS_LOCK is set to 0. I will also integrate your work on getErrorState.
Thanks.
So I close this one.

@fpistm fpistm closed this Apr 22, 2021
fpistm added a commit that referenced this pull request Apr 22, 2021
Aligned with previous FatFS version

Refers to #32

Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants