[FL-1179] Debug menu & main menu cleanup (#426)

* Debug apps moved into its own menu category, APP_DEBUG flag added
* Menu power icon added
* Added APP_DEBUG flag to flash_core1 bash script
* Removed commented section in app-loader

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
its your bedtime 2021-04-28 13:43:21 +03:00 committed by GitHub
parent 317bfba024
commit dfcf0ea0eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 77 additions and 44 deletions

View File

@ -91,29 +91,7 @@ int32_t app_loader(void* p) {
}
});
with_value_mutex(
menu_mutex, (Menu * menu) {
menu_item_add(
menu, menu_item_alloc_function("U2F", assets_icons_get(A_U2F_14), NULL, NULL));
menu_item_add(
menu,
menu_item_alloc_function(
"File Manager", assets_icons_get(A_FileManager_14), NULL, NULL));
menu_item_add(
menu, menu_item_alloc_function("Games", assets_icons_get(A_Games_14), NULL, NULL));
menu_item_add(
menu,
menu_item_alloc_function(
"Passport",
assets_icons_get(A_Passport_14),
app_loader_menu_callback,
(void*)&FLIPPER_SCENE_APPS[0]));
menu_item_add(
menu,
menu_item_alloc_function("Settings", assets_icons_get(A_Settings_14), NULL, NULL));
});
// plugins
// Plugins
with_value_mutex(
menu_mutex, (Menu * menu) {
MenuItem* menu_plugins =
@ -143,6 +121,37 @@ int32_t app_loader(void* p) {
menu_item_add(menu, menu_plugins);
});
#ifdef APP_DEBUG
with_value_mutex(
menu_mutex, (Menu * menu) {
MenuItem* menu_debug =
menu_item_alloc_menu("Debug tools", assets_icons_get(A_Settings_14));
for(size_t i = 0; i < FLIPPER_DEBUG_APPS_COUNT; i++) {
// Add menu item
menu_item_subitem_add(
menu_debug,
menu_item_alloc_function(
FLIPPER_DEBUG_APPS[i].name,
assets_icons_get(FLIPPER_DEBUG_APPS[i].icon),
app_loader_menu_callback,
(void*)&FLIPPER_DEBUG_APPS[i]));
// Add cli command
string_t cli_name;
string_init_set_str(cli_name, "app_");
string_cat_str(cli_name, FLIPPER_DEBUG_APPS[i].name);
cli_add_command(
state.cli,
string_get_cstr(cli_name),
app_loader_cli_callback,
(void*)&FLIPPER_DEBUG_APPS[i]);
string_clear(cli_name);
}
menu_item_add(menu, menu_debug);
});
#endif
printf("[app loader] start\r\n");

View File

@ -180,12 +180,13 @@ const size_t FLIPPER_APPS_COUNT = sizeof(FLIPPER_APPS) / sizeof(FlipperApplicati
// Plugin menu
const FlipperApplication FLIPPER_PLUGINS[] = {
#ifdef BUILD_EXAMPLE_BLINK
{.app = application_blink, .name = "blink", .stack_size = 1024, .icon = A_Plugins_14},
#ifdef BUILD_MUSIC_PLAYER
{.app = music_player, .name = "music player", .stack_size = 1024, .icon = A_Plugins_14},
#endif
#ifdef BUILD_EXAMPLE_INPUT_DUMP
{.app = application_input_dump, .name = "input dump", .stack_size = 1024, .icon = A_Plugins_14},
#ifdef BUILD_FLOOPPER_BLOOPPER
{.app = floopper_bloopper, .name = "Floopper Bloopper", .stack_size = 1024, .icon = A_Games_14},
#endif
#ifdef BUILD_SPEAKER_DEMO
@ -195,6 +196,20 @@ const FlipperApplication FLIPPER_PLUGINS[] = {
.icon = A_Plugins_14},
#endif
};
const size_t FLIPPER_PLUGINS_COUNT = sizeof(FLIPPER_PLUGINS) / sizeof(FlipperApplication);
// Plugin menu
const FlipperApplication FLIPPER_DEBUG_APPS[] = {
#ifdef BUILD_EXAMPLE_BLINK
{.app = application_blink, .name = "blink", .stack_size = 1024, .icon = A_Plugins_14},
#endif
#ifdef BUILD_EXAMPLE_INPUT_DUMP
{.app = application_input_dump, .name = "input dump", .stack_size = 1024, .icon = A_Plugins_14},
#endif
#ifdef BUILD_SD_TEST
{.app = sd_card_test, .name = "sd_card_test", .stack_size = 4096, .icon = A_Plugins_14},
#endif
@ -203,14 +218,6 @@ const FlipperApplication FLIPPER_PLUGINS[] = {
{.app = application_vibro, .name = "vibro", .stack_size = 1024, .icon = A_Plugins_14},
#endif
#ifdef BUILD_MUSIC_PLAYER
{.app = music_player, .name = "music player", .stack_size = 1024, .icon = A_Plugins_14},
#endif
#ifdef BUILD_FLOOPPER_BLOOPPER
{.app = floopper_bloopper, .name = "Floopper Bloopper", .stack_size = 1024, .icon = A_Games_14},
#endif
#ifdef BUILD_SDNFC
{.app = sdnfc, .name = "sdnfc", .stack_size = 1024, .icon = A_Plugins_14},
#endif
@ -225,8 +232,9 @@ const FlipperApplication FLIPPER_PLUGINS[] = {
};
const size_t FLIPPER_PLUGINS_COUNT = sizeof(FLIPPER_PLUGINS) / sizeof(FlipperApplication);
const size_t FLIPPER_DEBUG_APPS_COUNT = sizeof(FLIPPER_DEBUG_APPS) / sizeof(FlipperApplication);
#ifdef APP_DOLPHIN
const FlipperApplication FLIPPER_SCENE =
{.app = scene_app, .name = "Scenes", .stack_size = 1024, .icon = A_Games_14};
@ -237,3 +245,5 @@ const FlipperApplication FLIPPER_SCENE_APPS[] = {
};
const size_t FLIPPER_SCENE_APPS_COUNT = sizeof(FLIPPER_SCENE_APPS) / sizeof(FlipperApplication);
#endif

View File

@ -28,6 +28,12 @@ extern const size_t FLIPPER_APPS_COUNT;
extern const FlipperApplication FLIPPER_PLUGINS[];
extern const size_t FLIPPER_PLUGINS_COUNT;
/* Debug menu apps
* Spawned by app-loader
*/
extern const FlipperApplication FLIPPER_DEBUG_APPS[];
extern const size_t FLIPPER_DEBUG_APPS_COUNT;
/* Seperate scene app holder
* Spawned by app-loader
*/

View File

@ -19,22 +19,29 @@ APP_CLI = 1
APP_SD_FILESYSTEM = 1
BUILD_IRDA = 1
APP_DOLPHIN = 1
BUILD_EXAMPLE_BLINK = 1
BUILD_EXAMPLE_UART_WRITE = 1
BUILD_EXAMPLE_INPUT_DUMP = 1
BUILD_SUBGHZ = 1
BUILD_LF_RFID = 1
BUILD_SPEAKER_DEMO = 1
BUILD_VIBRO_DEMO = 1
BUILD_SD_TEST = 1
BUILD_GPIO_DEMO = 1
BUILD_MUSIC_PLAYER = 1
BUILD_FLOOPPER_BLOOPPER = 1
BUILD_IBUTTON = 1
endif
APP_DEBUG ?=0
ifeq ($(APP_DEBUG), 1)
CFLAGS += -DAPP_DEBUG
BUILD_GUI_TEST = 1
BUILD_KEYPAD_TEST = 1
BUILD_SD_TEST = 1
BUILD_VIBRO_DEMO = 1
BUILD_SPEAKER_DEMO = 1
BUILD_EXAMPLE_BLINK = 1
BUILD_EXAMPLE_UART_WRITE = 1
BUILD_EXAMPLE_INPUT_DUMP = 1
endif
APP_NFC ?= 0
ifeq ($(APP_NFC), 1)
APP_MENU = 1

View File

@ -102,7 +102,7 @@ Power* power_alloc() {
power->cli = furi_record_open("cli");
power_cli_init(power->cli);
power->menu = menu_item_alloc_menu("Power", NULL);
power->menu = menu_item_alloc_menu("Power", assets_icons_get(A_Power_14));
menu_item_subitem_add(
power->menu, menu_item_alloc_function("Off", NULL, power_menu_off_callback, power));
menu_item_subitem_add(

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

View File

@ -0,0 +1 @@
3

View File

@ -6,4 +6,4 @@ rm bootloader/.obj/f*/flash || true
make -C bootloader -j9 flash
rm firmware/.obj/f*/flash || true
make -C firmware -j9 APP_RELEASE=1 flash
make -C firmware -j9 APP_RELEASE=1 APP_DEBUG=1 flash