mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-06-29 21:52:03 -07:00
Workaround double load on boot of asset packs, settings...
This commit is contained in:
@@ -60,7 +60,7 @@ Storage* storage_app_alloc(void) {
|
||||
#include <furi/flipper.h>
|
||||
#include <toolbox/run_parallel.h>
|
||||
|
||||
static int32_t sd_mount_handler(void* context) {
|
||||
static int32_t sd_mount_callback(void* context) {
|
||||
Storage* app = context;
|
||||
StorageEvent event = {.type = StorageEventTypeCardMount};
|
||||
|
||||
@@ -108,7 +108,7 @@ void storage_tick(Storage* app) {
|
||||
#ifndef FURI_RAM_EXEC
|
||||
// Can't use pubsub for migration and can't lockup storage thread,
|
||||
// see more explanation in flipper_mount_callback()
|
||||
run_parallel(sd_mount_handler, app, 3 * 1024);
|
||||
run_parallel(sd_mount_callback, app, 3 * 1024);
|
||||
#else
|
||||
StorageEvent event = {.type = StorageEventTypeCardMount};
|
||||
furi_pubsub_publish(app->pubsub, &event);
|
||||
|
||||
@@ -123,11 +123,18 @@ void flipper_migrate_files() {
|
||||
// service is deadlocked processing pubsub and cannot process file operations
|
||||
// So instead storage runs this function in background thread and then
|
||||
// dispatches the pubsub event to everyone else
|
||||
bool skip_double_mount = false;
|
||||
void flipper_mount_callback(const void* message, void* context) {
|
||||
UNUSED(context);
|
||||
const StorageEvent* event = message;
|
||||
|
||||
if(event->type == StorageEventTypeCardMount) {
|
||||
// Workaround to avoid double load on boot but also have animated boot screen
|
||||
if(skip_double_mount) {
|
||||
skip_double_mount = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// Migrate locations before other services load on SD insert
|
||||
flipper_migrate_files();
|
||||
|
||||
@@ -180,6 +187,9 @@ void flipper_init(void) {
|
||||
FURI_LOG_D(TAG, "SD Card not ready, skipping early init");
|
||||
// Init on SD insert done by storage using flipper_mount_callback()
|
||||
} else {
|
||||
// Workaround to avoid double load on boot but also have animated boot screen
|
||||
skip_double_mount = true;
|
||||
|
||||
canvas_draw_icon(canvas, 39, 43, &I_dir_10px);
|
||||
canvas_commit(canvas);
|
||||
flipper_migrate_files();
|
||||
|
||||
Reference in New Issue
Block a user