mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
Fix critical boot modes (dfu / recovery)
This commit is contained in:
@@ -469,7 +469,7 @@ int32_t bt_srv(void* p) {
|
||||
UNUSED(p);
|
||||
Bt* bt = bt_alloc();
|
||||
|
||||
if(furi_hal_rtc_get_boot_mode() != FuriHalRtcBootModeNormal) {
|
||||
if(!furi_hal_is_normal_boot()) {
|
||||
FURI_LOG_W(TAG, "Skipping start in special boot mode");
|
||||
ble_glue_wait_for_c2_start(FURI_HAL_BT_C2_START_TIMEOUT);
|
||||
furi_record_create(RECORD_BT, bt);
|
||||
|
||||
@@ -460,7 +460,7 @@ int32_t cli_srv(void* p) {
|
||||
furi_thread_set_stdout_callback(NULL);
|
||||
}
|
||||
|
||||
if(furi_hal_rtc_get_boot_mode() == FuriHalRtcBootModeNormal) {
|
||||
if(furi_hal_is_normal_boot()) {
|
||||
cli_session_open(cli, &cli_vcp);
|
||||
} else {
|
||||
FURI_LOG_W(TAG, "Skipping start in special boot mode");
|
||||
|
||||
@@ -304,7 +304,7 @@ static bool desktop_check_file_flag(const char* flag_path) {
|
||||
int32_t desktop_srv(void* p) {
|
||||
UNUSED(p);
|
||||
|
||||
if(furi_hal_rtc_get_boot_mode() != FuriHalRtcBootModeNormal) {
|
||||
if(!furi_hal_is_normal_boot()) {
|
||||
FURI_LOG_W(TAG, "Skipping start in special boot mode");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ static void dolphin_update_clear_limits_timer_period(Dolphin* dolphin) {
|
||||
int32_t dolphin_srv(void* p) {
|
||||
UNUSED(p);
|
||||
|
||||
if(furi_hal_rtc_get_boot_mode() != FuriHalRtcBootModeNormal) {
|
||||
if(!furi_hal_is_normal_boot()) {
|
||||
FURI_LOG_W(TAG, "Skipping start in special boot mode");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <flipper_format/flipper_format.h>
|
||||
|
||||
void namechanger_on_system_start() {
|
||||
if(furi_hal_rtc_get_boot_mode() != FuriHalRtcBootModeNormal) {
|
||||
if(!furi_hal_is_normal_boot()) {
|
||||
FURI_LOG_W(TAG, "NameChangerSRV load skipped. Device is in special startup mode.");
|
||||
} else {
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
|
||||
@@ -515,7 +515,7 @@ static void power_check_battery_level_change(Power* power) {
|
||||
int32_t power_srv(void* p) {
|
||||
UNUSED(p);
|
||||
|
||||
if(furi_hal_rtc_get_boot_mode() != FuriHalRtcBootModeNormal) {
|
||||
if(!furi_hal_is_normal_boot()) {
|
||||
FURI_LOG_W(TAG, "Skipping start in special boot mode");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -63,8 +63,7 @@ const char* rgb_backlight_get_color_text(uint8_t index) {
|
||||
|
||||
void rgb_backlight_load_settings(void) {
|
||||
//Не загружать данные из внутренней памяти при загрузке в режиме DFU
|
||||
FuriHalRtcBootMode bm = furi_hal_rtc_get_boot_mode();
|
||||
if(bm == FuriHalRtcBootModeDfu) {
|
||||
if(!furi_hal_is_normal_boot()) {
|
||||
rgb_settings.settings_is_loaded = true;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ void XTREME_ASSETS_LOAD() {
|
||||
xtreme_assets->I_Connected_62x31 = &I_Connected_62x31;
|
||||
xtreme_assets->I_Error_62x31 = &I_Error_62x31;
|
||||
|
||||
if(furi_hal_rtc_get_boot_mode() != FuriHalRtcBootModeNormal) {
|
||||
if(!furi_hal_is_normal_boot()) {
|
||||
FURI_LOG_W(TAG, "Load skipped. Device is in special startup mode.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -15,9 +15,8 @@ void XTREME_SETTINGS_LOAD() {
|
||||
if(xtreme_settings == NULL) {
|
||||
xtreme_settings = malloc(sizeof(XtremeSettings));
|
||||
bool loaded = false;
|
||||
bool skip = furi_hal_rtc_get_boot_mode() != FuriHalRtcBootModeNormal;
|
||||
|
||||
if(skip) {
|
||||
if(!furi_hal_is_normal_boot()) {
|
||||
FURI_LOG_W(TAG, "Load skipped. Device is in special startup mode.");
|
||||
loaded = false;
|
||||
} else {
|
||||
@@ -74,7 +73,7 @@ bool XTREME_SETTINGS_SAVE() {
|
||||
XTREME_SETTINGS_LOAD();
|
||||
}
|
||||
|
||||
if(furi_hal_rtc_get_boot_mode() != FuriHalRtcBootModeNormal) {
|
||||
if(!furi_hal_is_normal_boot()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,12 @@
|
||||
|
||||
#define TAG "FuriHal"
|
||||
|
||||
bool normal_boot = false;
|
||||
|
||||
bool furi_hal_is_normal_boot() {
|
||||
return normal_boot;
|
||||
}
|
||||
|
||||
void furi_hal_init_early() {
|
||||
furi_hal_cortex_init_early();
|
||||
furi_hal_clock_init_early();
|
||||
@@ -26,6 +32,7 @@ void furi_hal_deinit_early() {
|
||||
}
|
||||
|
||||
void furi_hal_init() {
|
||||
normal_boot = true;
|
||||
furi_hal_mpu_init();
|
||||
furi_hal_clock_init();
|
||||
furi_hal_console_init();
|
||||
|
||||
@@ -1261,6 +1261,7 @@ Function,-,furi_hal_init_early,void,
|
||||
Function,-,furi_hal_interrupt_init,void,
|
||||
Function,+,furi_hal_interrupt_set_isr,void,"FuriHalInterruptId, FuriHalInterruptISR, void*"
|
||||
Function,+,furi_hal_interrupt_set_isr_ex,void,"FuriHalInterruptId, uint16_t, FuriHalInterruptISR, void*"
|
||||
Function,-,furi_hal_is_normal_boot,_Bool,
|
||||
Function,+,furi_hal_light_blink_set_color,void,Light
|
||||
Function,+,furi_hal_light_blink_start,void,"Light, uint8_t, uint16_t, uint16_t"
|
||||
Function,+,furi_hal_light_blink_stop,void,
|
||||
|
||||
|
@@ -6,6 +6,12 @@
|
||||
|
||||
#define TAG "FuriHal"
|
||||
|
||||
bool normal_boot = false;
|
||||
|
||||
bool furi_hal_is_normal_boot() {
|
||||
return normal_boot;
|
||||
}
|
||||
|
||||
void furi_hal_init_early() {
|
||||
furi_hal_cortex_init_early();
|
||||
furi_hal_clock_init_early();
|
||||
@@ -26,6 +32,7 @@ void furi_hal_deinit_early() {
|
||||
}
|
||||
|
||||
void furi_hal_init() {
|
||||
normal_boot = true;
|
||||
furi_hal_mpu_init();
|
||||
furi_hal_clock_init();
|
||||
furi_hal_console_init();
|
||||
|
||||
@@ -42,6 +42,9 @@ struct STOP_EXTERNING_ME {};
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** True if normally with all subsystems */
|
||||
bool furi_hal_is_normal_boot();
|
||||
|
||||
/** Early FuriHal init, only essential subsystems */
|
||||
void furi_hal_init_early();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user