## Summary Fix https://github.com/crosspoint-reader/crosspoint-reader/issues/1137 Introducing `HalFile`, a thin wrapper around `FsFile` that uses a global mutex to protect file operations. To test this PR, place the code below somewhere in the code base (I placed it in `onGoToRecentBooks`) ```cpp static auto testTask = [](void* param) { for (int i = 0; i < 10; i++) { String json = Storage.readFile("/.crosspoint/settings.json"); LOG_DBG("TEST_TASK", "Read settings.json, bytes read: %u", json.length()); } vTaskDelete(nullptr); }; xTaskCreate(testTask, "test0", 8192, nullptr, 1, nullptr); xTaskCreate(testTask, "test1", 8192, nullptr, 1, nullptr); xTaskCreate(testTask, "test2", 8192, nullptr, 1, nullptr); xTaskCreate(testTask, "test3", 8192, nullptr, 1, nullptr); delay(1000); ``` It will reliably lead to crash on `master`, but will function correctly with this PR. A macro renaming trick is used to avoid changing too many downstream code files. --- ### AI Usage While CrossPoint doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it helps set the right context for reviewers. Did you use AI tools to help write this code? **PARTIALLY**, only to help with tedious copy-paste tasks --------- Co-authored-by: Zach Nelson <zach@zdnelson.com>
This directory is intended for project specific (private) libraries.
PlatformIO will compile them to static libraries and link into the executable file.
The source code of each library should be placed in a separate directory
("lib/your_library_name/[Code]").
For example, see the structure of the following example libraries `Foo` and `Bar`:
|--lib
| |
| |--Bar
| | |--docs
| | |--examples
| | |--src
| | |- Bar.c
| | |- Bar.h
| | |- library.json (optional. for custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
| |
| |--Foo
| | |- Foo.c
| | |- Foo.h
| |
| |- README --> THIS FILE
|
|- platformio.ini
|--src
|- main.c
Example contents of `src/main.c` using Foo and Bar:
```
#include <Foo.h>
#include <Bar.h>
int main (void)
{
...
}
```
The PlatformIO Library Dependency Finder will find automatically dependent
libraries by scanning project source files.
More information about PlatformIO Library Dependency Finder
- https://docs.platformio.org/page/librarymanager/ldf.html