diff --git a/ReadMe.md b/ReadMe.md index ad8bd5303..2af12aa6a 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -162,7 +162,7 @@ Finally, you will have **`firmware/.obj/f7/full.dfu`** file that can be distribu * power-observer - power debug tool * scened-app-example - c++ application example * storage - storage service, internal + sdcard - * storage-settings - storage settings app + * storage_settings - storage settings app * subghz - subghz application, 433 fobs and etc * tests - unit tests and etc - assets - assets used by applications and services diff --git a/applications/power/power_cli.c b/applications/power/power_cli.c index 63c0fda53..515d4fcb6 100644 --- a/applications/power/power_cli.c +++ b/applications/power/power_cli.c @@ -18,18 +18,6 @@ void power_cli_dfu(Cli* cli, string_t args, void* context) { power_reboot(PowerBootModeDfu); } -void power_cli_factory_reset(Cli* cli, string_t args, void* context) { - printf("All data will be lost. Are you sure (y/n)?\r\n"); - char c = cli_getc(cli); - if(c == 'y' || c == 'Y') { - printf("Data will be wiped after reboot.\r\n"); - furi_hal_bootloader_set_flags(FuriHalBootloaderFlagFactoryReset); - power_reboot(PowerBootModeNormal); - } else { - printf("Safe choice.\r\n"); - } -} - void power_cli_info(Cli* cli, string_t args, void* context) { furi_hal_power_dump_state(); } @@ -59,8 +47,6 @@ void power_cli_init() { cli_add_command(cli, "poweroff", CliCommandFlagParallelSafe, power_cli_poweroff, NULL); cli_add_command(cli, "reboot", CliCommandFlagParallelSafe, power_cli_reboot, NULL); - cli_add_command( - cli, "factory_reset", CliCommandFlagParallelSafe, power_cli_factory_reset, NULL); cli_add_command(cli, "dfu", CliCommandFlagParallelSafe, power_cli_dfu, NULL); cli_add_command(cli, "power_info", CliCommandFlagParallelSafe, power_cli_info, NULL); cli_add_command(cli, "power_otg", CliCommandFlagParallelSafe, power_cli_otg, NULL); diff --git a/applications/storage/storage-cli.c b/applications/storage/storage-cli.c index 144259933..fc80864bd 100644 --- a/applications/storage/storage-cli.c +++ b/applications/storage/storage-cli.c @@ -1,23 +1,16 @@ #include +#include + #include #include #include #include #include -#include +#include #define MAX_NAME_LENGTH 255 -void storage_cli(Cli* cli, string_t args, void* context); - -// app cli function -void storage_cli_init() { - Cli* cli = furi_record_open("cli"); - cli_add_command(cli, "storage", CliCommandFlagDefault, storage_cli, NULL); - furi_record_close("cli"); -} - -void storage_cli_print_usage() { +static void storage_cli_print_usage() { printf("Usage:\r\n"); printf("storage \r\n"); printf("The path must start with /int or /ext\r\n"); @@ -39,11 +32,11 @@ void storage_cli_print_usage() { printf("\tstat\t - info about file or dir\r\n"); }; -void storage_cli_print_error(FS_Error error) { +static void storage_cli_print_error(FS_Error error) { printf("Storage error: %s\r\n", storage_error_get_desc(error)); } -void storage_cli_info(Cli* cli, string_t path) { +static void storage_cli_info(Cli* cli, string_t path) { Storage* api = furi_record_open("storage"); if(string_cmp_str(path, "/int") == 0) { @@ -81,7 +74,7 @@ void storage_cli_info(Cli* cli, string_t path) { furi_record_close("storage"); }; -void storage_cli_format(Cli* cli, string_t path) { +static void storage_cli_format(Cli* cli, string_t path) { if(string_cmp_str(path, "/int") == 0) { storage_cli_print_error(FSE_NOT_IMPLEMENTED); } else if(string_cmp_str(path, "/ext") == 0) { @@ -107,7 +100,7 @@ void storage_cli_format(Cli* cli, string_t path) { } }; -void storage_cli_list(Cli* cli, string_t path) { +static void storage_cli_list(Cli* cli, string_t path) { if(string_cmp_str(path, "/") == 0) { printf("\t[D] int\r\n"); printf("\t[D] ext\r\n"); @@ -143,7 +136,7 @@ void storage_cli_list(Cli* cli, string_t path) { } } -void storage_cli_read(Cli* cli, string_t path) { +static void storage_cli_read(Cli* cli, string_t path) { Storage* api = furi_record_open("storage"); File* file = storage_file_alloc(api); @@ -173,7 +166,7 @@ void storage_cli_read(Cli* cli, string_t path) { furi_record_close("storage"); } -void storage_cli_write(Cli* cli, string_t path) { +static void storage_cli_write(Cli* cli, string_t path) { Storage* api = furi_record_open("storage"); File* file = storage_file_alloc(api); @@ -227,7 +220,7 @@ void storage_cli_write(Cli* cli, string_t path) { furi_record_close("storage"); } -void storage_cli_read_chunks(Cli* cli, string_t path, string_t args) { +static void storage_cli_read_chunks(Cli* cli, string_t path, string_t args) { Storage* api = furi_record_open("storage"); File* file = storage_file_alloc(api); @@ -265,7 +258,7 @@ void storage_cli_read_chunks(Cli* cli, string_t path, string_t args) { furi_record_close("storage"); } -void storage_cli_write_chunk(Cli* cli, string_t path, string_t args) { +static void storage_cli_write_chunk(Cli* cli, string_t path, string_t args) { Storage* api = furi_record_open("storage"); File* file = storage_file_alloc(api); @@ -301,7 +294,7 @@ void storage_cli_write_chunk(Cli* cli, string_t path, string_t args) { furi_record_close("storage"); } -void storage_cli_stat(Cli* cli, string_t path) { +static void storage_cli_stat(Cli* cli, string_t path) { Storage* api = furi_record_open("storage"); if(string_cmp_str(path, "/") == 0) { @@ -340,7 +333,7 @@ void storage_cli_stat(Cli* cli, string_t path) { furi_record_close("storage"); } -void storage_cli_copy(Cli* cli, string_t old_path, string_t args) { +static void storage_cli_copy(Cli* cli, string_t old_path, string_t args) { Storage* api = furi_record_open("storage"); string_t new_path; string_init(new_path); @@ -360,7 +353,7 @@ void storage_cli_copy(Cli* cli, string_t old_path, string_t args) { furi_record_close("storage"); } -void storage_cli_remove(Cli* cli, string_t path) { +static void storage_cli_remove(Cli* cli, string_t path) { Storage* api = furi_record_open("storage"); FS_Error error = storage_common_remove(api, string_get_cstr(path)); @@ -371,7 +364,7 @@ void storage_cli_remove(Cli* cli, string_t path) { furi_record_close("storage"); } -void storage_cli_rename(Cli* cli, string_t old_path, string_t args) { +static void storage_cli_rename(Cli* cli, string_t old_path, string_t args) { Storage* api = furi_record_open("storage"); string_t new_path; string_init(new_path); @@ -391,7 +384,7 @@ void storage_cli_rename(Cli* cli, string_t old_path, string_t args) { furi_record_close("storage"); } -void storage_cli_mkdir(Cli* cli, string_t path) { +static void storage_cli_mkdir(Cli* cli, string_t path) { Storage* api = furi_record_open("storage"); FS_Error error = storage_common_mkdir(api, string_get_cstr(path)); @@ -402,7 +395,7 @@ void storage_cli_mkdir(Cli* cli, string_t path) { furi_record_close("storage"); } -void storage_cli_md5(Cli* cli, string_t path) { +static void storage_cli_md5(Cli* cli, string_t path) { Storage* api = furi_record_open("storage"); File* file = storage_file_alloc(api); @@ -439,7 +432,7 @@ void storage_cli_md5(Cli* cli, string_t path) { furi_record_close("storage"); } -void storage_cli(Cli* cli, string_t args, void* context) { +static void storage_cli(Cli* cli, string_t args, void* context) { string_t cmd; string_t path; string_init(cmd); @@ -527,3 +520,23 @@ void storage_cli(Cli* cli, string_t args, void* context) { string_clear(path); string_clear(cmd); } + +static void storage_cli_factory_reset(Cli* cli, string_t args, void* context) { + printf("All data will be lost. Are you sure (y/n)?\r\n"); + char c = cli_getc(cli); + if(c == 'y' || c == 'Y') { + printf("Data will be wiped after reboot.\r\n"); + furi_hal_bootloader_set_flags(FuriHalBootloaderFlagFactoryReset); + power_reboot(PowerBootModeNormal); + } else { + printf("Safe choice.\r\n"); + } +} + +void storage_cli_init() { + Cli* cli = furi_record_open("cli"); + cli_add_command(cli, "storage", CliCommandFlagDefault, storage_cli, NULL); + cli_add_command( + cli, "factory_reset", CliCommandFlagParallelSafe, storage_cli_factory_reset, NULL); + furi_record_close("cli"); +} diff --git a/applications/storage-settings/scenes/storage-settings-scene.c b/applications/storage_settings/scenes/storage_settings_scene.c similarity index 85% rename from applications/storage-settings/scenes/storage-settings-scene.c rename to applications/storage_settings/scenes/storage_settings_scene.c index ea4c3f00f..3591ae1ff 100644 --- a/applications/storage-settings/scenes/storage-settings-scene.c +++ b/applications/storage_settings/scenes/storage_settings_scene.c @@ -1,23 +1,23 @@ -#include "storage-settings-scene.h" +#include "storage_settings_scene.h" // Generate scene on_enter handlers array #define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_enter, void (*const storage_settings_on_enter_handlers[])(void*) = { -#include "storage-settings-scene-config.h" +#include "storage_settings_scene_config.h" }; #undef ADD_SCENE // Generate scene on_event handlers array #define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_event, bool (*const storage_settings_on_event_handlers[])(void* context, SceneManagerEvent event) = { -#include "storage-settings-scene-config.h" +#include "storage_settings_scene_config.h" }; #undef ADD_SCENE // Generate scene on_exit handlers array #define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_exit, void (*const storage_settings_on_exit_handlers[])(void* context) = { -#include "storage-settings-scene-config.h" +#include "storage_settings_scene_config.h" }; #undef ADD_SCENE diff --git a/applications/storage-settings/scenes/storage-settings-scene.h b/applications/storage_settings/scenes/storage_settings_scene.h similarity index 81% rename from applications/storage-settings/scenes/storage-settings-scene.h rename to applications/storage_settings/scenes/storage_settings_scene.h index 86ade12da..5b4fb736f 100644 --- a/applications/storage-settings/scenes/storage-settings-scene.h +++ b/applications/storage_settings/scenes/storage_settings_scene.h @@ -5,7 +5,7 @@ // Generate scene id and total number #define ADD_SCENE(prefix, name, id) StorageSettings##id, typedef enum { -#include "storage-settings-scene-config.h" +#include "storage_settings_scene_config.h" StorageSettingsSceneNum, } StorageSettingsScene; #undef ADD_SCENE @@ -14,16 +14,16 @@ extern const SceneManagerHandlers storage_settings_scene_handlers; // Generate scene on_enter handlers declaration #define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_enter(void*); -#include "storage-settings-scene-config.h" +#include "storage_settings_scene_config.h" #undef ADD_SCENE // Generate scene on_event handlers declaration #define ADD_SCENE(prefix, name, id) \ bool prefix##_scene_##name##_on_event(void* context, SceneManagerEvent event); -#include "storage-settings-scene-config.h" +#include "storage_settings_scene_config.h" #undef ADD_SCENE // Generate scene on_exit handlers declaration #define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_exit(void* context); -#include "storage-settings-scene-config.h" +#include "storage_settings_scene_config.h" #undef ADD_SCENE diff --git a/applications/storage-settings/scenes/storage-settings-benchmark.c b/applications/storage_settings/scenes/storage_settings_scene_benchmark.c similarity index 90% rename from applications/storage-settings/scenes/storage-settings-benchmark.c rename to applications/storage_settings/scenes/storage_settings_scene_benchmark.c index 454e3a394..e7cfd826a 100644 --- a/applications/storage-settings/scenes/storage-settings-benchmark.c +++ b/applications/storage_settings/scenes/storage_settings_scene_benchmark.c @@ -1,4 +1,4 @@ -#include "../storage-settings.h" +#include "../storage_settings.h" #define BENCH_DATA_SIZE 4096 #define BENCH_COUNT 6 @@ -12,7 +12,7 @@ static void view_dispatcher_send_custom_event(app->view_dispatcher, result); } -static bool storage_settings_bench_write( +static bool storage_settings_scene_bench_write( Storage* api, uint16_t size, const uint8_t* data, @@ -43,7 +43,7 @@ static bool storage_settings_bench_write( } static bool - storage_settings_bench_read(Storage* api, uint16_t size, uint8_t* data, uint32_t* speed) { + storage_settings_scene_bench_read(Storage* api, uint16_t size, uint8_t* data, uint32_t* speed) { File* file = storage_file_alloc(api); bool result = true; *speed = -1; @@ -71,7 +71,7 @@ static bool return result; } -static void storage_settings_benchmark(StorageSettings* app) { +static void storage_settings_scene_benchmark(StorageSettings* app) { DialogEx* dialog_ex = app->dialog_ex; uint8_t* bench_data; dialog_ex_set_header(dialog_ex, "Preparing data...", 64, 32, AlignCenter, AlignCenter); @@ -87,7 +87,8 @@ static void storage_settings_benchmark(StorageSettings* app) { dialog_ex_set_header(dialog_ex, "Benchmarking...", 64, 32, AlignCenter, AlignCenter); for(size_t i = 0; i < BENCH_COUNT; i++) { - if(!storage_settings_bench_write(app->fs_api, bench_size[i], bench_data, &bench_w_speed[i])) + if(!storage_settings_scene_bench_write( + app->fs_api, bench_size[i], bench_data, &bench_w_speed[i])) break; if(i > 0) string_cat_printf(app->text_string, "\n"); @@ -96,7 +97,8 @@ static void storage_settings_benchmark(StorageSettings* app) { dialog_ex_set_text( dialog_ex, string_get_cstr(app->text_string), 0, 32, AlignLeft, AlignCenter); - if(!storage_settings_bench_read(app->fs_api, bench_size[i], bench_data, &bench_r_speed[i])) + if(!storage_settings_scene_bench_read( + app->fs_api, bench_size[i], bench_data, &bench_r_speed[i])) break; string_cat_printf(app->text_string, "R %luK", bench_r_speed[i]); @@ -126,7 +128,7 @@ void storage_settings_scene_benchmark_on_enter(void* context) { AlignCenter); dialog_ex_set_left_button_text(dialog_ex, "Back"); } else { - storage_settings_benchmark(app); + storage_settings_scene_benchmark(app); notification_message(app->notification, &sequence_blink_green_100); } } diff --git a/applications/storage-settings/scenes/storage-settings-scene-config.h b/applications/storage_settings/scenes/storage_settings_scene_config.h similarity index 77% rename from applications/storage-settings/scenes/storage-settings-scene-config.h rename to applications/storage_settings/scenes/storage_settings_scene_config.h index 1191a3764..7628d1432 100644 --- a/applications/storage-settings/scenes/storage-settings-scene-config.h +++ b/applications/storage_settings/scenes/storage_settings_scene_config.h @@ -5,4 +5,5 @@ ADD_SCENE(storage_settings, format_confirm, FormatConfirm) ADD_SCENE(storage_settings, formatting, Formatting) ADD_SCENE(storage_settings, sd_info, SDInfo) ADD_SCENE(storage_settings, internal_info, InternalInfo) -ADD_SCENE(storage_settings, benchmark, Benchmark) \ No newline at end of file +ADD_SCENE(storage_settings, benchmark, Benchmark) +ADD_SCENE(storage_settings, factory_reset, FactoryReset) \ No newline at end of file diff --git a/applications/storage-settings/scenes/storage-settings-scene-eject-confirm.c b/applications/storage_settings/scenes/storage_settings_scene_eject_confirm.c similarity index 98% rename from applications/storage-settings/scenes/storage-settings-scene-eject-confirm.c rename to applications/storage_settings/scenes/storage_settings_scene_eject_confirm.c index ec40352de..8fc6c8714 100644 --- a/applications/storage-settings/scenes/storage-settings-scene-eject-confirm.c +++ b/applications/storage_settings/scenes/storage_settings_scene_eject_confirm.c @@ -1,4 +1,4 @@ -#include "../storage-settings.h" +#include "../storage_settings.h" static void storage_settings_scene_unmount_confirm_dialog_callback(DialogExResult result, void* context) { diff --git a/applications/storage-settings/scenes/storage-settings-scene-ejected.c b/applications/storage_settings/scenes/storage_settings_scene_ejected.c similarity index 98% rename from applications/storage-settings/scenes/storage-settings-scene-ejected.c rename to applications/storage_settings/scenes/storage_settings_scene_ejected.c index 8fb53570d..08208f871 100755 --- a/applications/storage-settings/scenes/storage-settings-scene-ejected.c +++ b/applications/storage_settings/scenes/storage_settings_scene_ejected.c @@ -1,4 +1,4 @@ -#include "../storage-settings.h" +#include "../storage_settings.h" static void storage_settings_scene_unmounted_dialog_callback(DialogExResult result, void* context) { diff --git a/applications/storage_settings/scenes/storage_settings_scene_factory_reset.c b/applications/storage_settings/scenes/storage_settings_scene_factory_reset.c new file mode 100644 index 000000000..5409a33e3 --- /dev/null +++ b/applications/storage_settings/scenes/storage_settings_scene_factory_reset.c @@ -0,0 +1,90 @@ +#include "../storage_settings.h" +#include +#include + +#define STORAGE_SETTINGS_SCENE_FACTORY_RESET_CONFIRM_COUNT 5 + +static void + storage_settings_scene_factory_reset_dialog_callback(DialogExResult result, void* context) { + StorageSettings* app = context; + + view_dispatcher_send_custom_event(app->view_dispatcher, result); +} + +void storage_settings_scene_factory_reset_on_enter(void* context) { + StorageSettings* app = context; + DialogEx* dialog_ex = app->dialog_ex; + + dialog_ex_set_context(dialog_ex, app); + dialog_ex_set_result_callback(dialog_ex, storage_settings_scene_factory_reset_dialog_callback); + + dialog_ex_set_left_button_text(dialog_ex, "Back"); + dialog_ex_set_right_button_text(dialog_ex, "Erase"); + + dialog_ex_set_header(dialog_ex, "Confirm Factory Reset", 64, 10, AlignCenter, AlignCenter); + dialog_ex_set_text( + dialog_ex, + "Internal storage will be erased\r\nData and setting will be lost", + 64, + 32, + AlignCenter, + AlignCenter); + + view_dispatcher_switch_to_view(app->view_dispatcher, StorageSettingsViewDialogEx); +} + +bool storage_settings_scene_factory_reset_on_event(void* context, SceneManagerEvent event) { + StorageSettings* app = context; + bool consumed = false; + + uint32_t counter = + scene_manager_get_scene_state(app->scene_manager, StorageSettingsFactoryReset); + + if(event.type == SceneManagerEventTypeCustom) { + switch(event.event) { + case DialogExResultLeft: + scene_manager_set_scene_state(app->scene_manager, StorageSettingsFactoryReset, 0); + consumed = scene_manager_previous_scene(app->scene_manager); + break; + case DialogExResultRight: + counter++; + if(counter < STORAGE_SETTINGS_SCENE_FACTORY_RESET_CONFIRM_COUNT) { + string_printf( + app->text_string, + "%ld presses left", + STORAGE_SETTINGS_SCENE_FACTORY_RESET_CONFIRM_COUNT - counter); + dialog_ex_set_text( + app->dialog_ex, + string_get_cstr(app->text_string), + 64, + 32, + AlignCenter, + AlignCenter); + scene_manager_set_scene_state( + app->scene_manager, StorageSettingsFactoryReset, counter); + } else { + furi_hal_bootloader_set_flags(FuriHalBootloaderFlagFactoryReset); + power_reboot(PowerBootModeNormal); + } + + consumed = true; + break; + } + } + return consumed; +} + +void storage_settings_scene_factory_reset_on_exit(void* context) { + StorageSettings* app = context; + DialogEx* dialog_ex = app->dialog_ex; + + dialog_ex_set_header(dialog_ex, NULL, 0, 0, AlignCenter, AlignCenter); + dialog_ex_set_text(dialog_ex, NULL, 0, 0, AlignCenter, AlignTop); + dialog_ex_set_icon(dialog_ex, 0, 0, NULL); + dialog_ex_set_left_button_text(dialog_ex, NULL); + dialog_ex_set_right_button_text(dialog_ex, NULL); + dialog_ex_set_result_callback(dialog_ex, NULL); + dialog_ex_set_context(dialog_ex, NULL); + + string_reset(app->text_string); +} diff --git a/applications/storage-settings/scenes/storage-settings-scene-format-confirm.c b/applications/storage_settings/scenes/storage_settings_scene_format_confirm.c similarity index 98% rename from applications/storage-settings/scenes/storage-settings-scene-format-confirm.c rename to applications/storage_settings/scenes/storage_settings_scene_format_confirm.c index 92a8d532d..a80215bc8 100644 --- a/applications/storage-settings/scenes/storage-settings-scene-format-confirm.c +++ b/applications/storage_settings/scenes/storage_settings_scene_format_confirm.c @@ -1,4 +1,4 @@ -#include "../storage-settings.h" +#include "../storage_settings.h" static void storage_settings_scene_format_confirm_dialog_callback(DialogExResult result, void* context) { diff --git a/applications/storage-settings/scenes/storage-settings-scene-formatting.c b/applications/storage_settings/scenes/storage_settings_scene_formatting.c similarity index 98% rename from applications/storage-settings/scenes/storage-settings-scene-formatting.c rename to applications/storage_settings/scenes/storage_settings_scene_formatting.c index 9a82491d6..143bda95a 100755 --- a/applications/storage-settings/scenes/storage-settings-scene-formatting.c +++ b/applications/storage_settings/scenes/storage_settings_scene_formatting.c @@ -1,4 +1,4 @@ -#include "../storage-settings.h" +#include "../storage_settings.h" static const NotificationMessage message_green_165 = { .type = NotificationMessageTypeLedGreen, diff --git a/applications/storage-settings/scenes/storage-settings-scene-internal-info.c b/applications/storage_settings/scenes/storage_settings_scene_internal_info.c similarity index 98% rename from applications/storage-settings/scenes/storage-settings-scene-internal-info.c rename to applications/storage_settings/scenes/storage_settings_scene_internal_info.c index 8a8316108..1fb05ca58 100644 --- a/applications/storage-settings/scenes/storage-settings-scene-internal-info.c +++ b/applications/storage_settings/scenes/storage_settings_scene_internal_info.c @@ -1,4 +1,4 @@ -#include "../storage-settings.h" +#include "../storage_settings.h" #include static void diff --git a/applications/storage-settings/scenes/storage-settings-scene-sd-info.c b/applications/storage_settings/scenes/storage_settings_scene_sd_info.c similarity index 98% rename from applications/storage-settings/scenes/storage-settings-scene-sd-info.c rename to applications/storage_settings/scenes/storage_settings_scene_sd_info.c index c82d2f14a..297041a58 100644 --- a/applications/storage-settings/scenes/storage-settings-scene-sd-info.c +++ b/applications/storage_settings/scenes/storage_settings_scene_sd_info.c @@ -1,4 +1,4 @@ -#include "../storage-settings.h" +#include "../storage_settings.h" static void storage_settings_scene_sd_info_dialog_callback(DialogExResult result, void* context) { StorageSettings* app = context; diff --git a/applications/storage-settings/scenes/storage-settings-scene-start.c b/applications/storage_settings/scenes/storage_settings_scene_start.c similarity index 85% rename from applications/storage-settings/scenes/storage-settings-scene-start.c rename to applications/storage_settings/scenes/storage_settings_scene_start.c index f3c42b086..595c73f14 100644 --- a/applications/storage-settings/scenes/storage-settings-scene-start.c +++ b/applications/storage_settings/scenes/storage_settings_scene_start.c @@ -1,4 +1,4 @@ -#include "../storage-settings.h" +#include "../storage_settings.h" enum StorageSettingsStartSubmenuIndex { StorageSettingsStartSubmenuIndexInternalInfo, @@ -6,6 +6,7 @@ enum StorageSettingsStartSubmenuIndex { StorageSettingsStartSubmenuIndexUnmount, StorageSettingsStartSubmenuIndexFormat, StorageSettingsStartSubmenuIndexBenchy, + StorageSettingsStartSubmenuIndexFactoryReset }; static void storage_settings_scene_start_submenu_callback(void* context, uint32_t index) { @@ -48,6 +49,12 @@ void storage_settings_scene_start_on_enter(void* context) { StorageSettingsStartSubmenuIndexBenchy, storage_settings_scene_start_submenu_callback, app); + submenu_add_item( + submenu, + "Factory Reset", + StorageSettingsStartSubmenuIndexFactoryReset, + storage_settings_scene_start_submenu_callback, + app); submenu_set_selected_item( submenu, scene_manager_get_scene_state(app->scene_manager, StorageSettingsStart)); @@ -93,6 +100,14 @@ bool storage_settings_scene_start_on_event(void* context, SceneManagerEvent even scene_manager_next_scene(app->scene_manager, StorageSettingsBenchmark); consumed = true; break; + case StorageSettingsStartSubmenuIndexFactoryReset: + scene_manager_set_scene_state( + app->scene_manager, + StorageSettingsStart, + StorageSettingsStartSubmenuIndexFactoryReset); + scene_manager_next_scene(app->scene_manager, StorageSettingsFactoryReset); + consumed = true; + break; } } return consumed; diff --git a/applications/storage-settings/storage-settings.c b/applications/storage_settings/storage_settings.c similarity index 98% rename from applications/storage-settings/storage-settings.c rename to applications/storage_settings/storage_settings.c index 8e18071b4..ac61cd3b8 100644 --- a/applications/storage-settings/storage-settings.c +++ b/applications/storage_settings/storage_settings.c @@ -1,4 +1,4 @@ -#include "storage-settings.h" +#include "storage_settings.h" static bool storage_settings_custom_event_callback(void* context, uint32_t event) { furi_assert(context); diff --git a/applications/storage-settings/storage-settings.h b/applications/storage_settings/storage_settings.h similarity index 94% rename from applications/storage-settings/storage-settings.h rename to applications/storage_settings/storage_settings.h index f79066c72..c9490aebb 100644 --- a/applications/storage-settings/storage-settings.h +++ b/applications/storage_settings/storage_settings.h @@ -13,7 +13,7 @@ #include #include -#include "scenes/storage-settings-scene.h" +#include "scenes/storage_settings_scene.h" #ifdef __cplusplus extern "C" {