[FL-2415] Storage: blocking file open (#1078)
* Storage: correct replacement for "/any" path in path holder * Unit tests: storage, blocking file open test * File stream: error getter * Storage: common copy and common remove now executes in external thread * Filesystems: got rid of unused functions * Storage: untangle dependencies, ram-frendly filesystem api * iButton: context assertions * Storage: pubsub messages * Storage: wait for the file to close if it was open * Storage: fix folder copying * Storage: unit test * Storage: pubsub documentation * Fix merge error * Fix memleak in storage test * Storage: remove unused define Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -11,6 +11,8 @@
|
||||
#define ICON_SD_MOUNTED &I_SDcardMounted_11x8
|
||||
#define ICON_SD_ERROR &I_SDcardFail_11x8
|
||||
|
||||
#define TAG "Storage"
|
||||
|
||||
static void storage_app_sd_icon_draw_callback(Canvas* canvas, void* context) {
|
||||
furi_assert(canvas);
|
||||
furi_assert(context);
|
||||
@@ -63,15 +65,14 @@ void storage_tick(Storage* app) {
|
||||
}
|
||||
}
|
||||
|
||||
if(app->storage[ST_EXT].status != app->prev_ext_storage_status) {
|
||||
app->prev_ext_storage_status = app->storage[ST_EXT].status;
|
||||
furi_pubsub_publish(app->pubsub, &app->storage[ST_EXT].status);
|
||||
}
|
||||
|
||||
// storage not enabled but was enabled (sd card unmount)
|
||||
if(app->storage[ST_EXT].status == StorageStatusNotReady && app->sd_gui.enabled == true) {
|
||||
app->sd_gui.enabled = false;
|
||||
view_port_enabled_set(app->sd_gui.view_port, false);
|
||||
|
||||
FURI_LOG_I(TAG, "SD card unmount");
|
||||
StorageEvent event = {.type = StorageEventTypeCardUnmount};
|
||||
furi_pubsub_publish(app->pubsub, &event);
|
||||
}
|
||||
|
||||
// storage enabled (or in error state) but was not enabled (sd card mount)
|
||||
@@ -83,6 +84,16 @@ void storage_tick(Storage* app) {
|
||||
app->sd_gui.enabled == false) {
|
||||
app->sd_gui.enabled = true;
|
||||
view_port_enabled_set(app->sd_gui.view_port, true);
|
||||
|
||||
if(app->storage[ST_EXT].status == StorageStatusOK) {
|
||||
FURI_LOG_I(TAG, "SD card mount");
|
||||
StorageEvent event = {.type = StorageEventTypeCardMount};
|
||||
furi_pubsub_publish(app->pubsub, &event);
|
||||
} else {
|
||||
FURI_LOG_I(TAG, "SD card mount error");
|
||||
StorageEvent event = {.type = StorageEventTypeCardMountError};
|
||||
furi_pubsub_publish(app->pubsub, &event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user