diff --git a/applications/main/cfw_app/application.fam b/applications/settings/cfw_app/application.fam similarity index 100% rename from applications/main/cfw_app/application.fam rename to applications/settings/cfw_app/application.fam diff --git a/applications/main/cfw_app/cfw_app.c b/applications/settings/cfw_app/cfw_app.c similarity index 84% rename from applications/main/cfw_app/cfw_app.c rename to applications/settings/cfw_app/cfw_app.c index 55115a77f1f..d7f479ff266 100644 --- a/applications/main/cfw_app/cfw_app.c +++ b/applications/settings/cfw_app/cfw_app.c @@ -64,7 +64,7 @@ bool cfw_app_apply(CfwApp* app) { } if(app->save_subghz) { - furi_hal_subghz_set_is_extended(app->subghz_extend); + furi_hal_subghz_set_extend_settings(app->subghz_extend, app->subghz_bypass); } if(app->save_name) { @@ -75,24 +75,28 @@ bool cfw_app_apply(CfwApp* app) { do { if(!flipper_format_file_open_always(file, NAMESPOOF_PATH)) break; - if(!flipper_format_write_header_cstr(file, NAMESPOOF_HEADER, NAMESPOOF_VERSION)) + + if(!flipper_format_write_header_cstr(file, NAMESPOOF_HEADER, 1)) break; + + if(!flipper_format_write_comment_cstr( + file, "Changing the value below will change your FlipperZero device name.")) + break; + if(!flipper_format_write_comment_cstr( + file, + "Note: This is limited to 8 characters using the following: a-z, A-Z, 0-9, and _")) break; + if(!flipper_format_write_comment_cstr( + file, "It cannot contain any other characters.")) + break; + if(!flipper_format_write_string_cstr(file, "Name", app->device_name)) break; + } while(0); flipper_format_free(file); } } - // if(app->save_level) { - // Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN); - // int32_t xp = app->xp_level > 1 ? dolphin_get_levels()[app->xp_level - 2] : 0; - // dolphin->state->data.icounter = xp + 1; - // dolphin->state->dirty = true; - // dolphin_state_save(dolphin->state); - // furi_record_close(RECORD_DOLPHIN); - // } - if(app->save_backlight) { rgb_backlight_save_settings(); } @@ -101,10 +105,6 @@ bool cfw_app_apply(CfwApp* app) { CFW_SETTINGS_SAVE(); } - // if(app->show_slideshow) { - // callback_reboot(NULL); - // } - if(app->require_reboot) { popup_set_header(app->popup, "Rebooting...", 64, 26, AlignCenter, AlignCenter); popup_set_text(app->popup, "Applying changes...", 64, 40, AlignCenter, AlignCenter); @@ -166,41 +166,9 @@ CfwApp* cfw_app_alloc() { view_dispatcher_add_view(app->view_dispatcher, CfwAppViewPopup, popup_get_view(app->popup)); // Settings init - CfwSettings* cfw_settings = CFW_SETTINGS(); - // app->asset_pack_index = 0; - // CharList_init(app->asset_pack_names); Storage* storage = furi_record_open(RECORD_STORAGE); - // File* folder = storage_file_alloc(storage); - // FileInfo info; - // char* name = malloc(CFW_ASSETS_PACK_NAME_LEN); - // if(storage_dir_open(folder, CFW_ASSETS_PATH)) { - // while(storage_dir_read(folder, &info, name, CFW_ASSETS_PACK_NAME_LEN)) { - // if(info.flags & FSF_DIRECTORY) { - // char* copy = malloc(CFW_ASSETS_PACK_NAME_LEN); - // strlcpy(copy, name, CFW_ASSETS_PACK_NAME_LEN); - // uint idx = 0; - // if(strcmp(copy, "NSFW") != 0) { - // for(; idx < CharList_size(app->asset_pack_names); idx++) { - // char* comp = *CharList_get(app->asset_pack_names, idx); - // if(strcasecmp(copy, comp) < 0 && strcmp(comp, "NSFW") != 0) { - // break; - // } - // } - // } - // CharList_push_at(app->asset_pack_names, idx, copy); - // if(app->asset_pack_index != 0) { - // if(idx < app->asset_pack_index) app->asset_pack_index++; - // } else { - // if(strcmp(copy, CFW_settings->asset_pack) == 0) - // app->asset_pack_index = idx + 1; - // } - // } - // } - // } - // free(name); - // storage_file_free(folder); CharList_init(app->mainmenu_app_names); CharList_init(app->mainmenu_app_paths); @@ -247,7 +215,7 @@ CfwApp* cfw_app_alloc() { flipper_format_free(file); furi_record_close(RECORD_STORAGE); - app->subghz_extend = furi_hal_subghz_get_is_extended(); + furi_hal_subghz_get_extend_settings(&app->subghz_extend, &app->subghz_bypass); strlcpy(app->device_name, furi_hal_version_get_name_ptr(), FURI_HAL_VERSION_ARRAY_NAME_LENGTH); diff --git a/applications/main/cfw_app/cfw_app.h b/applications/settings/cfw_app/cfw_app.h similarity index 92% rename from applications/main/cfw_app/cfw_app.h rename to applications/settings/cfw_app/cfw_app.h index e9a55a50023..ee15a4b481e 100644 --- a/applications/main/cfw_app/cfw_app.h +++ b/applications/settings/cfw_app/cfw_app.h @@ -39,8 +39,6 @@ typedef struct { TextInput* text_input; Popup* popup; - // CharList_t asset_pack_names; - // uint8_t asset_pack_index; CharList_t mainmenu_app_names; CharList_t mainmenu_app_paths; uint8_t mainmenu_app_index; @@ -51,18 +49,16 @@ typedef struct { uint8_t subghz_hopper_index; char subghz_freq_buffer[CFW_SUBGHZ_FREQ_BUFFER_SIZE]; bool subghz_extend; + bool subghz_bypass; char device_name[FURI_HAL_VERSION_ARRAY_NAME_LENGTH]; - // int32_t xp_level; FuriString* version_tag; bool save_mainmenu_apps; bool save_subghz_frequencies; bool save_subghz; bool save_name; - // bool save_level; bool save_backlight; bool save_settings; - // bool show_slideshow; bool require_reboot; } CfwApp; diff --git a/applications/main/cfw_app/cfw_app_10px.png b/applications/settings/cfw_app/cfw_app_10px.png similarity index 100% rename from applications/main/cfw_app/cfw_app_10px.png rename to applications/settings/cfw_app/cfw_app_10px.png diff --git a/applications/main/cfw_app/namespoof.c b/applications/settings/cfw_app/namespoof.c similarity index 100% rename from applications/main/cfw_app/namespoof.c rename to applications/settings/cfw_app/namespoof.c diff --git a/applications/main/cfw_app/namespoof.h b/applications/settings/cfw_app/namespoof.h similarity index 100% rename from applications/main/cfw_app/namespoof.h rename to applications/settings/cfw_app/namespoof.h diff --git a/applications/main/cfw_app/scenes/cfw_app_scene.c b/applications/settings/cfw_app/scenes/cfw_app_scene.c similarity index 100% rename from applications/main/cfw_app/scenes/cfw_app_scene.c rename to applications/settings/cfw_app/scenes/cfw_app_scene.c diff --git a/applications/main/cfw_app/scenes/cfw_app_scene.h b/applications/settings/cfw_app/scenes/cfw_app_scene.h similarity index 100% rename from applications/main/cfw_app/scenes/cfw_app_scene.h rename to applications/settings/cfw_app/scenes/cfw_app_scene.h diff --git a/applications/main/cfw_app/scenes/cfw_app_scene_config.h b/applications/settings/cfw_app/scenes/cfw_app_scene_config.h similarity index 100% rename from applications/main/cfw_app/scenes/cfw_app_scene_config.h rename to applications/settings/cfw_app/scenes/cfw_app_scene_config.h diff --git a/applications/main/cfw_app/scenes/cfw_app_scene_interface.c b/applications/settings/cfw_app/scenes/cfw_app_scene_interface.c similarity index 100% rename from applications/main/cfw_app/scenes/cfw_app_scene_interface.c rename to applications/settings/cfw_app/scenes/cfw_app_scene_interface.c diff --git a/applications/main/cfw_app/scenes/cfw_app_scene_interface_common.c b/applications/settings/cfw_app/scenes/cfw_app_scene_interface_common.c similarity index 100% rename from applications/main/cfw_app/scenes/cfw_app_scene_interface_common.c rename to applications/settings/cfw_app/scenes/cfw_app_scene_interface_common.c diff --git a/applications/main/cfw_app/scenes/cfw_app_scene_interface_lockscreen.c b/applications/settings/cfw_app/scenes/cfw_app_scene_interface_lockscreen.c similarity index 100% rename from applications/main/cfw_app/scenes/cfw_app_scene_interface_lockscreen.c rename to applications/settings/cfw_app/scenes/cfw_app_scene_interface_lockscreen.c diff --git a/applications/main/cfw_app/scenes/cfw_app_scene_interface_mainmenu.c b/applications/settings/cfw_app/scenes/cfw_app_scene_interface_mainmenu.c similarity index 100% rename from applications/main/cfw_app/scenes/cfw_app_scene_interface_mainmenu.c rename to applications/settings/cfw_app/scenes/cfw_app_scene_interface_mainmenu.c diff --git a/applications/main/cfw_app/scenes/cfw_app_scene_interface_mainmenu_add.c b/applications/settings/cfw_app/scenes/cfw_app_scene_interface_mainmenu_add.c similarity index 100% rename from applications/main/cfw_app/scenes/cfw_app_scene_interface_mainmenu_add.c rename to applications/settings/cfw_app/scenes/cfw_app_scene_interface_mainmenu_add.c diff --git a/applications/main/cfw_app/scenes/cfw_app_scene_misc.c b/applications/settings/cfw_app/scenes/cfw_app_scene_misc.c similarity index 100% rename from applications/main/cfw_app/scenes/cfw_app_scene_misc.c rename to applications/settings/cfw_app/scenes/cfw_app_scene_misc.c diff --git a/applications/main/cfw_app/scenes/cfw_app_scene_misc_rename.c b/applications/settings/cfw_app/scenes/cfw_app_scene_misc_rename.c similarity index 100% rename from applications/main/cfw_app/scenes/cfw_app_scene_misc_rename.c rename to applications/settings/cfw_app/scenes/cfw_app_scene_misc_rename.c diff --git a/applications/main/cfw_app/scenes/cfw_app_scene_protocols.c b/applications/settings/cfw_app/scenes/cfw_app_scene_protocols.c similarity index 78% rename from applications/main/cfw_app/scenes/cfw_app_scene_protocols.c rename to applications/settings/cfw_app/scenes/cfw_app_scene_protocols.c index 7cf6d689e18..34ff28f9233 100644 --- a/applications/main/cfw_app/scenes/cfw_app_scene_protocols.c +++ b/applications/settings/cfw_app/scenes/cfw_app_scene_protocols.c @@ -3,6 +3,7 @@ enum VarItemListIndex { VarItemListIndexSubghzFrequencies, VarItemListIndexSubghzExtend, + VarItemListIndexSubghzBypass, }; void cfw_app_scene_protocols_var_item_list_callback(void* context, uint32_t index) { @@ -17,6 +18,13 @@ static void cfw_app_scene_protocols_subghz_extend_changed(VariableItem* item) { app->save_subghz = true; } +static void cfw_app_scene_protocols_subghz_bypass_changed(VariableItem* item) { + CfwApp* app = variable_item_get_context(item); + app->subghz_bypass = variable_item_get_current_value_index(item); + variable_item_set_current_value_text(item, app->subghz_bypass ? "ON" : "OFF"); + app->save_subghz = true; +} + void cfw_app_scene_protocols_on_enter(void* context) { CfwApp* app = context; CfwSettings* cfw_settings = CFW_SETTINGS(); @@ -30,6 +38,11 @@ void cfw_app_scene_protocols_on_enter(void* context) { variable_item_set_current_value_index(item, app->subghz_extend); variable_item_set_current_value_text(item, app->subghz_extend ? "ON" : "OFF"); + item = variable_item_list_add( + var_item_list, "SubGHz Bypass", 2, cfw_app_scene_protocols_subghz_bypass_changed, app); + variable_item_set_current_value_index(item, app->subghz_bypass); + variable_item_set_current_value_text(item, app->subghz_bypass ? "ON" : "OFF"); + variable_item_list_set_enter_callback( var_item_list, cfw_app_scene_protocols_var_item_list_callback, app); diff --git a/applications/main/cfw_app/scenes/cfw_app_scene_protocols_frequencies.c b/applications/settings/cfw_app/scenes/cfw_app_scene_protocols_frequencies.c similarity index 100% rename from applications/main/cfw_app/scenes/cfw_app_scene_protocols_frequencies.c rename to applications/settings/cfw_app/scenes/cfw_app_scene_protocols_frequencies.c diff --git a/applications/main/cfw_app/scenes/cfw_app_scene_protocols_frequencies_add.c b/applications/settings/cfw_app/scenes/cfw_app_scene_protocols_frequencies_add.c similarity index 100% rename from applications/main/cfw_app/scenes/cfw_app_scene_protocols_frequencies_add.c rename to applications/settings/cfw_app/scenes/cfw_app_scene_protocols_frequencies_add.c diff --git a/applications/main/cfw_app/scenes/cfw_app_scene_protocols_frequencies_hopper.c b/applications/settings/cfw_app/scenes/cfw_app_scene_protocols_frequencies_hopper.c similarity index 100% rename from applications/main/cfw_app/scenes/cfw_app_scene_protocols_frequencies_hopper.c rename to applications/settings/cfw_app/scenes/cfw_app_scene_protocols_frequencies_hopper.c diff --git a/applications/main/cfw_app/scenes/cfw_app_scene_protocols_frequencies_static.c b/applications/settings/cfw_app/scenes/cfw_app_scene_protocols_frequencies_static.c similarity index 100% rename from applications/main/cfw_app/scenes/cfw_app_scene_protocols_frequencies_static.c rename to applications/settings/cfw_app/scenes/cfw_app_scene_protocols_frequencies_static.c diff --git a/applications/main/cfw_app/scenes/cfw_app_scene_start.c b/applications/settings/cfw_app/scenes/cfw_app_scene_start.c similarity index 100% rename from applications/main/cfw_app/scenes/cfw_app_scene_start.c rename to applications/settings/cfw_app/scenes/cfw_app_scene_start.c diff --git a/firmware/targets/f7/api_symbols.csv b/firmware/targets/f7/api_symbols.csv index 708658b8565..ec96cbb2fb1 100644 --- a/firmware/targets/f7/api_symbols.csv +++ b/firmware/targets/f7/api_symbols.csv @@ -1479,8 +1479,8 @@ Function,-,furi_hal_subghz_dump_state,void, Function,+,furi_hal_subghz_enable_ext_power,_Bool, Function,+,furi_hal_subghz_flush_rx,void, Function,+,furi_hal_subghz_flush_tx,void, +Function,+,furi_hal_subghz_get_extend_settings,void,"_Bool*, _Bool*" Function,+,furi_hal_subghz_get_external_power_disable,_Bool, -Function,+,furi_hal_subghz_get_is_extended,_Bool, Function,+,furi_hal_subghz_get_lqi,uint8_t, Function,+,furi_hal_subghz_get_radio_type,SubGhzRadioType, Function,+,furi_hal_subghz_get_rolling_counter_mult,uint8_t, @@ -1504,10 +1504,10 @@ Function,+,furi_hal_subghz_rx,void, Function,+,furi_hal_subghz_rx_pipe_not_empty,_Bool, Function,+,furi_hal_subghz_select_radio_type,void,SubGhzRadioType Function,+,furi_hal_subghz_set_async_mirror_pin,void,const GpioPin* +Function,+,furi_hal_subghz_set_extend_settings,void,"_Bool, _Bool" Function,+,furi_hal_subghz_set_external_power_disable,void,_Bool Function,+,furi_hal_subghz_set_frequency,uint32_t,uint32_t Function,+,furi_hal_subghz_set_frequency_and_path,uint32_t,uint32_t -Function,+,furi_hal_subghz_set_is_extended,void,_Bool Function,+,furi_hal_subghz_set_path,void,FuriHalSubGhzPath Function,+,furi_hal_subghz_set_rolling_counter_mult,void,uint8_t Function,+,furi_hal_subghz_set_timestamp_file_names,void,_Bool diff --git a/firmware/targets/f7/furi_hal/furi_hal_subghz.c b/firmware/targets/f7/furi_hal/furi_hal_subghz.c index e682b441841..e6fcd04a98a 100644 --- a/firmware/targets/f7/furi_hal/furi_hal_subghz.c +++ b/firmware/targets/f7/furi_hal/furi_hal_subghz.c @@ -448,21 +448,22 @@ uint32_t furi_hal_subghz_set_frequency_and_path(uint32_t value) { return value; } -bool furi_hal_subghz_get_is_extended() { - bool is_extended = false; +void furi_hal_subghz_get_extend_settings(bool* extend, bool* bypass) { + *extend = false; + *bypass = false; Storage* storage = furi_record_open(RECORD_STORAGE); FlipperFormat* file = flipper_format_file_alloc(storage); if(flipper_format_file_open_existing(file, "/ext/subghz/assets/extend_range.txt")) { - flipper_format_read_bool(file, "use_ext_range_at_own_risk", &is_extended, 1); + flipper_format_read_bool(file, "use_ext_range_at_own_risk", extend, 1); + flipper_format_read_bool(file, "ignore_default_tx_region", bypass, 1); } flipper_format_free(file); furi_record_close(RECORD_STORAGE); - return is_extended; } -void furi_hal_subghz_set_is_extended(bool is_extended) { +void furi_hal_subghz_set_extend_settings(bool extend, bool bypass) { Storage* storage = furi_record_open(RECORD_STORAGE); FlipperFormat* file = flipper_format_file_alloc(storage); @@ -472,7 +473,11 @@ void furi_hal_subghz_set_is_extended(bool is_extended) { if(!flipper_format_write_comment_cstr( file, "Whether to allow extended ranges that can break your flipper")) break; - if(!flipper_format_write_bool(file, "use_ext_range_at_own_risk", &is_extended, 1)) break; + if(!flipper_format_write_bool(file, "use_ext_range_at_own_risk", &extend, 1)) break; + if(!flipper_format_write_comment_cstr( + file, "Whether to ignore the default TX region settings")) + break; + if(!flipper_format_write_bool(file, "ignore_default_tx_region", &bypass, 1)) break; } while(0); flipper_format_free(file); @@ -483,15 +488,7 @@ bool furi_hal_subghz_is_tx_allowed(uint32_t value) { //checking regional settings bool is_extended = false; bool is_allowed = false; - - Storage* storage = furi_record_open(RECORD_STORAGE); - FlipperFormat* fff_data_file = flipper_format_file_alloc(storage); - if(flipper_format_file_open_existing(fff_data_file, "/ext/subghz/assets/extend_range.txt")) { - flipper_format_read_bool(fff_data_file, "use_ext_range_at_own_risk", &is_extended, 1); - flipper_format_read_bool(fff_data_file, "ignore_default_tx_region", &is_allowed, 1); - } - flipper_format_free(fff_data_file); - furi_record_close(RECORD_STORAGE); + furi_hal_subghz_get_extend_settings(&is_extended, &is_allowed); switch(furi_hal_version_get_hw_region()) { case FuriHalVersionRegionEuRu: diff --git a/firmware/targets/f7/furi_hal/furi_hal_subghz.h b/firmware/targets/f7/furi_hal/furi_hal_subghz.h index 8383c27f2de..a292c642f81 100644 --- a/firmware/targets/f7/furi_hal/furi_hal_subghz.h +++ b/firmware/targets/f7/furi_hal/furi_hal_subghz.h @@ -227,15 +227,17 @@ uint32_t furi_hal_subghz_set_frequency_and_path(uint32_t value); /** Read extend and bypass settings values into out params * - * @return is_extended bool + * @param extend pointer to bool for extend + * @param bypass pointer to bool for bypass */ -bool furi_hal_subghz_get_is_extended(); +void furi_hal_subghz_get_extend_settings(bool* extend, bool* bypass); /** Set extend and bypass settings values to file * - * @param is_extended bool for extend + * @param extend bool for extend + * @param bypass bool for bypass */ -void furi_hal_subghz_set_is_extended(bool is_extended); +void furi_hal_subghz_set_extend_settings(bool extend, bool bypass); /** Сheck if transmission is allowed on this frequency with your current config * diff --git a/firmware/targets/f7/src/recovery.c b/firmware/targets/f7/src/recovery.c index f1bfe538377..45c3a049570 100644 --- a/firmware/targets/f7/src/recovery.c +++ b/firmware/targets/f7/src/recovery.c @@ -56,8 +56,8 @@ void flipper_boot_recovery_exec() { } if(!counter) { - furi_hal_rtc_set_flag(FuriHalRtcFlagResetPin); + furi_hal_rtc_set_flag(FuriHalRtcFlagFactoryReset); furi_hal_rtc_set_pin_fails(0); furi_hal_rtc_reset_flag(FuriHalRtcFlagLock); } -} +} \ No newline at end of file diff --git a/firmware/targets/furi_hal_include/furi_hal_rtc.h b/firmware/targets/furi_hal_include/furi_hal_rtc.h index 492cc557049..bd5c968a8fc 100644 --- a/firmware/targets/furi_hal_include/furi_hal_rtc.h +++ b/firmware/targets/furi_hal_include/furi_hal_rtc.h @@ -32,7 +32,6 @@ typedef enum { FuriHalRtcFlagHandOrient = (1 << 4), FuriHalRtcFlagLegacySleep = (1 << 5), FuriHalRtcFlagStealthMode = (1 << 6), - FuriHalRtcFlagResetPin = (1 << 7), } FuriHalRtcFlag; typedef enum { @@ -258,4 +257,4 @@ uint32_t furi_hal_rtc_datetime_to_timestamp(FuriHalRtcDateTime* datetime); #ifdef __cplusplus } -#endif +#endif \ No newline at end of file