mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-06-10 19:23:31 -07:00
Add XTREME_SETTINGS_WAIT() for race conditions
This commit is contained in:
@@ -323,6 +323,7 @@ Function,-,SystemInit,void,
|
||||
Function,+,XTREME_ASSETS,XtremeAssets*,
|
||||
Function,+,XTREME_SETTINGS,XtremeSettings*,
|
||||
Function,+,XTREME_SETTINGS_SAVE,void,
|
||||
Function,+,XTREME_SETTINGS_WAIT,XtremeSettings*,
|
||||
Function,-,_Exit,void,int
|
||||
Function,-,__assert,void,"const char*, int, const char*"
|
||||
Function,+,__assert_func,void,"const char*, int, const char*, const char*"
|
||||
|
||||
|
+13
-1
@@ -6,6 +6,7 @@
|
||||
#define TAG "XtremeSettings"
|
||||
|
||||
XtremeSettings xtreme_settings = {
|
||||
.loaded = false,
|
||||
.asset_pack = "",
|
||||
.anim_speed = 100, // 100%
|
||||
.cycle_anims = 0, // Meta.txt
|
||||
@@ -27,7 +28,7 @@ XtremeSettings xtreme_settings = {
|
||||
.favorite_timeout = 0, // OFF
|
||||
.bad_bt = false, // USB
|
||||
.bad_bt_remember = false, // OFF
|
||||
.butthurt_timer = 43200, // 12 H
|
||||
.butthurt_timer = 21600, // 6 H
|
||||
.rgb_backlight = false, // OFF
|
||||
};
|
||||
|
||||
@@ -88,6 +89,8 @@ void XTREME_SETTINGS_LOAD() {
|
||||
}
|
||||
flipper_format_free(file);
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
xtreme_settings.loaded = true;
|
||||
}
|
||||
|
||||
void XTREME_SETTINGS_SAVE() {
|
||||
@@ -128,3 +131,12 @@ void XTREME_SETTINGS_SAVE() {
|
||||
XtremeSettings* 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;
|
||||
}
|
||||
|
||||
+3
-1
@@ -13,6 +13,7 @@ extern "C" {
|
||||
#define XTREME_ASSETS_PACK_NAME_LEN 32
|
||||
|
||||
typedef struct {
|
||||
bool loaded;
|
||||
char asset_pack[XTREME_ASSETS_PACK_NAME_LEN];
|
||||
uint32_t anim_speed;
|
||||
int32_t cycle_anims;
|
||||
@@ -38,8 +39,9 @@ typedef struct {
|
||||
bool rgb_backlight;
|
||||
} XtremeSettings;
|
||||
|
||||
XtremeSettings* XTREME_SETTINGS();
|
||||
void XTREME_SETTINGS_SAVE();
|
||||
XtremeSettings* XTREME_SETTINGS();
|
||||
XtremeSettings* XTREME_SETTINGS_WAIT();
|
||||
|
||||
typedef struct {
|
||||
bool is_nsfw;
|
||||
|
||||
Reference in New Issue
Block a user