mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-12 17:08:36 -07:00
Start storage service first to load xtreme early
This commit is contained in:
@@ -15,7 +15,6 @@
|
|||||||
#include "desktop/views/desktop_view_pin_timeout.h"
|
#include "desktop/views/desktop_view_pin_timeout.h"
|
||||||
#include "desktop_i.h"
|
#include "desktop_i.h"
|
||||||
#include "helpers/pin_lock.h"
|
#include "helpers/pin_lock.h"
|
||||||
#include <xtreme/private.h>
|
|
||||||
|
|
||||||
#define TAG "Desktop"
|
#define TAG "Desktop"
|
||||||
|
|
||||||
@@ -347,9 +346,6 @@ int32_t desktop_srv(void* p) {
|
|||||||
furi_hal_rtc_reset_flag(FuriHalRtcFlagResetPin);
|
furi_hal_rtc_reset_flag(FuriHalRtcFlagResetPin);
|
||||||
}
|
}
|
||||||
|
|
||||||
XTREME_SETTINGS_LOAD();
|
|
||||||
XTREME_ASSETS_LOAD();
|
|
||||||
|
|
||||||
Desktop* desktop = desktop_alloc();
|
Desktop* desktop = desktop_alloc();
|
||||||
|
|
||||||
bool loaded = DESKTOP_SETTINGS_LOAD(&desktop->settings);
|
bool loaded = DESKTOP_SETTINGS_LOAD(&desktop->settings);
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ Dolphin* dolphin_alloc() {
|
|||||||
dolphin->state = dolphin_state_alloc();
|
dolphin->state = dolphin_state_alloc();
|
||||||
dolphin->event_queue = furi_message_queue_alloc(8, sizeof(DolphinEvent));
|
dolphin->event_queue = furi_message_queue_alloc(8, sizeof(DolphinEvent));
|
||||||
dolphin->pubsub = furi_pubsub_alloc();
|
dolphin->pubsub = furi_pubsub_alloc();
|
||||||
int32_t butthurt = XTREME_SETTINGS_WAIT()->butthurt_timer;
|
int32_t butthurt = XTREME_SETTINGS()->butthurt_timer;
|
||||||
dolphin->butthurt_timer = xTimerCreate(
|
dolphin->butthurt_timer = xTimerCreate(
|
||||||
NULL,
|
NULL,
|
||||||
(butthurt > 0) ? (butthurt * 1000) : -1,
|
(butthurt > 0) ? (butthurt * 1000) : -1,
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#include <xtreme.h>
|
#include <xtreme.h>
|
||||||
#include "gui_i.h"
|
#include "gui_i.h"
|
||||||
#include <assets_icons.h>
|
#include <assets_icons.h>
|
||||||
|
#include <storage/storage.h>
|
||||||
|
#include <storage/storage_i.h>
|
||||||
|
|
||||||
#define TAG "GuiSrv"
|
#define TAG "GuiSrv"
|
||||||
|
|
||||||
@@ -589,6 +591,10 @@ Gui* gui_alloc() {
|
|||||||
furi_check(gui->input_events);
|
furi_check(gui->input_events);
|
||||||
furi_pubsub_subscribe(gui->input_events, gui_input_events_callback, gui);
|
furi_pubsub_subscribe(gui->input_events, gui_input_events_callback, gui);
|
||||||
|
|
||||||
|
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||||
|
gui_add_view_port(gui, storage->sd_gui.view_port, GuiLayerStatusBarLeft);
|
||||||
|
furi_record_close(RECORD_STORAGE);
|
||||||
|
|
||||||
return gui;
|
return gui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ App(
|
|||||||
name="RGB Backlight",
|
name="RGB Backlight",
|
||||||
apptype=FlipperAppType.SERVICE,
|
apptype=FlipperAppType.SERVICE,
|
||||||
entry_point="rgb_backlight_srv",
|
entry_point="rgb_backlight_srv",
|
||||||
|
order=10,
|
||||||
sdk_headers=[
|
sdk_headers=[
|
||||||
"rgb_backlight.h",
|
"rgb_backlight.h",
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ App(
|
|||||||
requires=["storage_settings"],
|
requires=["storage_settings"],
|
||||||
provides=["storage_start"],
|
provides=["storage_start"],
|
||||||
stack_size=3 * 1024,
|
stack_size=3 * 1024,
|
||||||
order=44,
|
order=0,
|
||||||
sdk_headers=["storage.h"],
|
sdk_headers=["storage.h"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -54,10 +54,6 @@ Storage* storage_app_alloc() {
|
|||||||
view_port_draw_callback_set(app->sd_gui.view_port, storage_app_sd_icon_draw_callback, app);
|
view_port_draw_callback_set(app->sd_gui.view_port, storage_app_sd_icon_draw_callback, app);
|
||||||
view_port_enabled_set(app->sd_gui.view_port, false);
|
view_port_enabled_set(app->sd_gui.view_port, false);
|
||||||
|
|
||||||
Gui* gui = furi_record_open(RECORD_GUI);
|
|
||||||
gui_add_view_port(gui, app->sd_gui.view_port, GuiLayerStatusBarLeft);
|
|
||||||
furi_record_close(RECORD_GUI);
|
|
||||||
|
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ App(
|
|||||||
conflicts=["desktop"],
|
conflicts=["desktop"],
|
||||||
entry_point="updater_srv",
|
entry_point="updater_srv",
|
||||||
stack_size=2 * 1024,
|
stack_size=2 * 1024,
|
||||||
order=130,
|
order=120,
|
||||||
)
|
)
|
||||||
|
|
||||||
App(
|
App(
|
||||||
|
|||||||
@@ -325,7 +325,6 @@ Function,-,SystemInit,void,
|
|||||||
Function,+,XTREME_ASSETS,XtremeAssets*,
|
Function,+,XTREME_ASSETS,XtremeAssets*,
|
||||||
Function,+,XTREME_SETTINGS,XtremeSettings*,
|
Function,+,XTREME_SETTINGS,XtremeSettings*,
|
||||||
Function,+,XTREME_SETTINGS_SAVE,void,
|
Function,+,XTREME_SETTINGS_SAVE,void,
|
||||||
Function,+,XTREME_SETTINGS_WAIT,XtremeSettings*,
|
|
||||||
Function,-,_Exit,void,int
|
Function,-,_Exit,void,int
|
||||||
Function,-,__assert,void,"const char*, int, const char*"
|
Function,-,__assert,void,"const char*, int, const char*"
|
||||||
Function,+,__assert_func,void,"const char*, int, const char*, const char*"
|
Function,+,__assert_func,void,"const char*, int, const char*, const char*"
|
||||||
|
|||||||
|
@@ -4,6 +4,7 @@
|
|||||||
#include <furi_hal_version.h>
|
#include <furi_hal_version.h>
|
||||||
#include <furi_hal_memory.h>
|
#include <furi_hal_memory.h>
|
||||||
#include <furi_hal_rtc.h>
|
#include <furi_hal_rtc.h>
|
||||||
|
#include <xtreme/private.h>
|
||||||
|
|
||||||
#define TAG "Flipper"
|
#define TAG "Flipper"
|
||||||
|
|
||||||
@@ -27,23 +28,31 @@ static void flipper_print_version(const char* target, const Version* version) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void flipper_start_service(const FlipperApplication* service) {
|
||||||
|
FURI_LOG_D(TAG, "Starting service %s", service->name);
|
||||||
|
|
||||||
|
FuriThread* thread =
|
||||||
|
furi_thread_alloc_ex(service->name, service->stack_size, service->app, NULL);
|
||||||
|
furi_thread_mark_as_service(thread);
|
||||||
|
furi_thread_set_appid(thread, service->appid);
|
||||||
|
|
||||||
|
furi_thread_start(thread);
|
||||||
|
}
|
||||||
|
|
||||||
void flipper_init() {
|
void flipper_init() {
|
||||||
flipper_print_version("Firmware", furi_hal_version_get_firmware_version());
|
flipper_print_version("Firmware", furi_hal_version_get_firmware_version());
|
||||||
|
|
||||||
FURI_LOG_I(TAG, "Boot mode %d, starting services", furi_hal_rtc_get_boot_mode());
|
FURI_LOG_I(TAG, "Boot mode %d, starting services", furi_hal_rtc_get_boot_mode());
|
||||||
|
|
||||||
for(size_t i = 0; i < FLIPPER_SERVICES_COUNT; i++) {
|
// Start storage service first, thanks OFW :/
|
||||||
FURI_LOG_D(TAG, "Starting service %s", FLIPPER_SERVICES[i].name);
|
flipper_start_service(&FLIPPER_SERVICES[0]);
|
||||||
|
|
||||||
FuriThread* thread = furi_thread_alloc_ex(
|
XTREME_SETTINGS_LOAD();
|
||||||
FLIPPER_SERVICES[i].name,
|
XTREME_ASSETS_LOAD();
|
||||||
FLIPPER_SERVICES[i].stack_size,
|
|
||||||
FLIPPER_SERVICES[i].app,
|
|
||||||
NULL);
|
|
||||||
furi_thread_mark_as_service(thread);
|
|
||||||
furi_thread_set_appid(thread, FLIPPER_SERVICES[i].appid);
|
|
||||||
|
|
||||||
furi_thread_start(thread);
|
// Everything else
|
||||||
|
for(size_t i = 1; i < FLIPPER_SERVICES_COUNT; i++) {
|
||||||
|
flipper_start_service(&FLIPPER_SERVICES[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
FURI_LOG_I(TAG, "Startup complete");
|
FURI_LOG_I(TAG, "Startup complete");
|
||||||
@@ -65,4 +74,4 @@ void vApplicationGetTimerTaskMemory(
|
|||||||
*tcb_ptr = memmgr_alloc_from_pool(sizeof(StaticTask_t));
|
*tcb_ptr = memmgr_alloc_from_pool(sizeof(StaticTask_t));
|
||||||
*stack_ptr = memmgr_alloc_from_pool(sizeof(StackType_t) * configTIMER_TASK_STACK_DEPTH);
|
*stack_ptr = memmgr_alloc_from_pool(sizeof(StackType_t) * configTIMER_TASK_STACK_DEPTH);
|
||||||
*stack_size = configTIMER_TASK_STACK_DEPTH;
|
*stack_size = configTIMER_TASK_STACK_DEPTH;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,13 +148,6 @@ void XTREME_ASSETS_LOAD() {
|
|||||||
xtreme_assets.is_nsfw = strncmp(xtreme_settings->asset_pack, "NSFW", strlen("NSFW")) == 0;
|
xtreme_assets.is_nsfw = strncmp(xtreme_settings->asset_pack, "NSFW", strlen("NSFW")) == 0;
|
||||||
|
|
||||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||||
int32_t timeout = 5000;
|
|
||||||
while(timeout > 0) {
|
|
||||||
if(storage_sd_status(storage) == FSE_OK) break;
|
|
||||||
furi_delay_ms(250);
|
|
||||||
timeout -= 250;
|
|
||||||
}
|
|
||||||
|
|
||||||
FileInfo info;
|
FileInfo info;
|
||||||
FuriString* path = furi_string_alloc();
|
FuriString* path = furi_string_alloc();
|
||||||
furi_string_printf(path, XTREME_ASSETS_PATH "/%s", xtreme_settings->asset_pack);
|
furi_string_printf(path, XTREME_ASSETS_PATH "/%s", xtreme_settings->asset_pack);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
void XTREME_ASSETS_LOAD();
|
|
||||||
void XTREME_SETTINGS_LOAD();
|
void XTREME_SETTINGS_LOAD();
|
||||||
|
void XTREME_ASSETS_LOAD();
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
#define TAG "XtremeSettings"
|
#define TAG "XtremeSettings"
|
||||||
|
|
||||||
XtremeSettings xtreme_settings = {
|
XtremeSettings xtreme_settings = {
|
||||||
.loaded = false,
|
|
||||||
.asset_pack = "",
|
.asset_pack = "",
|
||||||
.anim_speed = 100, // 100%
|
.anim_speed = 100, // 100%
|
||||||
.cycle_anims = 0, // Meta.txt
|
.cycle_anims = 0, // Meta.txt
|
||||||
@@ -89,8 +88,6 @@ void XTREME_SETTINGS_LOAD() {
|
|||||||
}
|
}
|
||||||
flipper_format_free(file);
|
flipper_format_free(file);
|
||||||
furi_record_close(RECORD_STORAGE);
|
furi_record_close(RECORD_STORAGE);
|
||||||
|
|
||||||
xtreme_settings.loaded = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void XTREME_SETTINGS_SAVE() {
|
void XTREME_SETTINGS_SAVE() {
|
||||||
@@ -131,12 +128,3 @@ void XTREME_SETTINGS_SAVE() {
|
|||||||
XtremeSettings* XTREME_SETTINGS() {
|
XtremeSettings* XTREME_SETTINGS() {
|
||||||
return &xtreme_settings;
|
return &xtreme_settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
XtremeSettings* XTREME_SETTINGS_WAIT() {
|
|
||||||
if(furi_hal_is_normal_boot()) {
|
|
||||||
while(!xtreme_settings.loaded) {
|
|
||||||
furi_delay_ms(50);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return &xtreme_settings;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ extern "C" {
|
|||||||
#define XTREME_ASSETS_PACK_NAME_LEN 32
|
#define XTREME_ASSETS_PACK_NAME_LEN 32
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
bool loaded;
|
|
||||||
char asset_pack[XTREME_ASSETS_PACK_NAME_LEN];
|
char asset_pack[XTREME_ASSETS_PACK_NAME_LEN];
|
||||||
uint32_t anim_speed;
|
uint32_t anim_speed;
|
||||||
int32_t cycle_anims;
|
int32_t cycle_anims;
|
||||||
@@ -41,7 +40,6 @@ typedef struct {
|
|||||||
|
|
||||||
void XTREME_SETTINGS_SAVE();
|
void XTREME_SETTINGS_SAVE();
|
||||||
XtremeSettings* XTREME_SETTINGS();
|
XtremeSettings* XTREME_SETTINGS();
|
||||||
XtremeSettings* XTREME_SETTINGS_WAIT();
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
bool is_nsfw;
|
bool is_nsfw;
|
||||||
|
|||||||
Reference in New Issue
Block a user