Skip to content
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

Ufs serve fix - makes it work better on esp32cam (ai thinker style) #21486

Merged
merged 2 commits into from
May 24, 2024

Conversation

btsimonh
Copy link
Contributor

Description:

Related issue (if applicable): fixes #21473

This changes the rarely used UFSServe code enabled by #ifdef UFILESYS_STATIC_SERVING to be like the file download code.

For me, this makes the file serving much more reliable on slower devices like the ESP Chip Id 3667140 (ESP32-D0WDQ6 v1.0)

Prior to this change, I would see a random main loop hang on accessing files.

I have tested with >5000 file downloads on ESP32S3 and >1500 downloads on esp32cam (ai thinker style), and had better results.
I don't think this is a complete fix, as I have had one device lose connection (unfortunately without serial) - but this could have been something else.

This PR also adds yield() in file list from the GUI. This is tested and does not cause a watchdog on a 1500 file folder. (the main thread is hung during this time - many seconds). I'm not sure if there can be a better solution whilst the webserver can handle a single client. One would be a re-write of the JS to poll for more files - but this may not help as even finding files in a large folder takes a lot of time. Having this many files in a folder on an IOT device seems unusual, so it may be better to document and live with it.

Checklist:

  • The pull request is done against the latest development branch
  • Only relevant files were touched
  • Only one feature/fix was added per PR and the code change compiles without warnings
  • The code change is tested and works with Tasmota core ESP8266 V.2.7.6
  • The code change is tested and works with Tasmota core ESP32 V.3.0.0
  • I accept the CLA.

NOTE: The code change must pass CI tests. Your PR cannot be merged unless tests pass

This removes the use of server.streamFile, and provides a much more reliable download.
Make UFSServe always use this function, regardless of auth requirement.  (i.e. no use of the original in the original class, as it still uses streaming.)
Note that UFSServe is enab;ed with #define UFILESYS_STATIC_SERVING
@btsimonh
Copy link
Contributor Author

@Jason2866 - pls comment on the use of yield in file listing.

btsimonh added a commit to btsimonh/TasmotaBerryPLay that referenced this pull request May 24, 2024
@Jason2866
Copy link
Collaborator

yield does give the core time "doing needed" things and resets the WDT.
So probably a good idea :-)
What I do not like very much is the left debug code. Either you think it is needed so keep it active (maybe change to more debug) or remove it completely.

@s-hadinger
Copy link
Collaborator

Looks good to me. Ok to merge

@s-hadinger s-hadinger merged commit 3e0b70a into arendst:development May 24, 2024
59 checks passed
@btsimonh
Copy link
Contributor Author

@Jason2866 - point taken. none of it is active, as it's all hashed out.

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.

SD Card access causes crash in development branch, but not in release branch (CAUSED BY WATCHDOG - see below)
3 participants