From b75b58decaea6cb7461c40dd2061c8f3f69d2d36 Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Fri, 28 Aug 2026 00:39:01 +0200 Subject: [PATCH] Remove file mutex usage --- Apps/Diceware/main/Source/Diceware.cpp | 5 ----- Apps/Diceware/manifest.properties | 4 ++-- Apps/EpubReader/main/Source/EpubReaderAsync.cpp | 13 ++----------- Apps/EpubReader/manifest.properties | 4 ++-- Apps/TodoList/main/Source/TodoList.cpp | 10 ---------- Apps/TodoList/manifest.properties | 4 ++-- 6 files changed, 8 insertions(+), 32 deletions(-) diff --git a/Apps/Diceware/main/Source/Diceware.cpp b/Apps/Diceware/main/Source/Diceware.cpp index f8a70b5..28f9100 100644 --- a/Apps/Diceware/main/Source/Diceware.cpp +++ b/Apps/Diceware/main/Source/Diceware.cpp @@ -4,7 +4,6 @@ #include #include #include -#include #include #include @@ -39,17 +38,13 @@ static std::string readWordAtLine(const int lineIndex) { return ""; } - struct FileMutex mutex; - file_mutex_get(&mutex, path); std::string word; - file_mutex_lock(&mutex); FILE* file = fopen(path, "r"); if (file != nullptr) { skipNewlines(file, lineIndex); word = readWord(file); fclose(file); } else { ESP_LOGE(TAG, "Failed to open %s", path); } - file_mutex_unlock(&mutex); return word; } diff --git a/Apps/Diceware/manifest.properties b/Apps/Diceware/manifest.properties index 28aba26..50dc940 100644 --- a/Apps/Diceware/manifest.properties +++ b/Apps/Diceware/manifest.properties @@ -2,6 +2,6 @@ manifest.version=0.2 target.sdk=0.8.0-dev target.platforms=esp32,esp32s3,esp32c6,esp32p4 app.id=tactility.diceware -app.version.name=0.12.0 -app.version.code=12 +app.version.name=0.13.0 +app.version.code=13 app.name=Diceware diff --git a/Apps/EpubReader/main/Source/EpubReaderAsync.cpp b/Apps/EpubReader/main/Source/EpubReaderAsync.cpp index fe4d2ab..2bda16d 100644 --- a/Apps/EpubReader/main/Source/EpubReaderAsync.cpp +++ b/Apps/EpubReader/main/Source/EpubReaderAsync.cpp @@ -1,6 +1,5 @@ #include "EpubReader.h" #include -#include #include #include #include @@ -112,15 +111,9 @@ void asyncSwitchToBrowser(void* data) { void backgroundOpenTask(void* data) { auto* a = static_cast(data); - // Acquire the filesystem lock before any SD card I/O - prevents concurrent - // SDMMC access from the background and LVGL tasks (bus errors 0x107/0x108). - struct FileMutex mutex; - file_mutex_get(&mutex, a->filePath.c_str()); - file_mutex_lock(&mutex); - if (isTextFile(a->filePath)) { - // Read the entire text file here (under the lock) so asyncOpenComplete - // only needs to update UI state - no SD I/O on the LVGL task. + // Read the entire text file here so asyncOpenComplete only needs to + // update UI state - no SD I/O on the LVGL task. FILE* f = fopen(a->filePath.c_str(), "r"); if (f) { char buf[512]; @@ -140,8 +133,6 @@ void backgroundOpenTask(void* data) { a->epub = EpubService::open(a->filePath); } - file_mutex_unlock(&mutex); - // Signal the LVGL task that the work is done lv_async_call(asyncOpenComplete, a); vTaskDelete(nullptr); diff --git a/Apps/EpubReader/manifest.properties b/Apps/EpubReader/manifest.properties index 57aeae8..c57d841 100644 --- a/Apps/EpubReader/manifest.properties +++ b/Apps/EpubReader/manifest.properties @@ -2,7 +2,7 @@ manifest.version=0.2 target.sdk=0.8.0-dev target.platforms=esp32s3,esp32p4 app.id=tactility.epubreader -app.version.name=0.9.0 -app.version.code=9 +app.version.name=0.10.0 +app.version.code=10 app.name=Epub Reader app.description=Epub and text file reader. Requires PSRAM! diff --git a/Apps/TodoList/main/Source/TodoList.cpp b/Apps/TodoList/main/Source/TodoList.cpp index ebe6c9a..d9de501 100644 --- a/Apps/TodoList/main/Source/TodoList.cpp +++ b/Apps/TodoList/main/Source/TodoList.cpp @@ -1,7 +1,6 @@ #include "TodoList.h" #include #include -#include #include #include #include @@ -62,9 +61,6 @@ void saveTodos(Context* ctx) { char savePath[256]; if (!getSaveFilePath(savePath, sizeof(savePath))) return; - struct FileMutex mutex; - file_mutex_get(&mutex, savePath); - file_mutex_lock(&mutex); FILE* f = fopen(savePath, "w"); if (f) { for (int i = 0; i < ctx->count; i++) { @@ -72,17 +68,12 @@ void saveTodos(Context* ctx) { } fclose(f); } - file_mutex_unlock(&mutex); } void loadTodos(Context* ctx) { char savePath[256]; if (!getSaveFilePath(savePath, sizeof(savePath))) return; - struct FileMutex mutex; - file_mutex_get(&mutex, savePath); - - file_mutex_lock(&mutex); ctx->count = 0; FILE* f = fopen(savePath, "r"); if (f) { @@ -103,7 +94,6 @@ void loadTodos(Context* ctx) { } fclose(f); } - file_mutex_unlock(&mutex); } /* ── UI Helpers ───────────────────────────────────────────────────── */ diff --git a/Apps/TodoList/manifest.properties b/Apps/TodoList/manifest.properties index fe93745..b37a692 100644 --- a/Apps/TodoList/manifest.properties +++ b/Apps/TodoList/manifest.properties @@ -2,7 +2,7 @@ manifest.version=0.2 target.sdk=0.8.0-dev target.platforms=esp32,esp32s3,esp32c6,esp32p4 app.id=tactility.todolist -app.version.name=0.11.0 -app.version.code=11 +app.version.name=0.12.0 +app.version.code=12 app.name=Todo List app.description=Simple task list manager