From c098292a53e795b393708dcde2a4e2468c1da3c1 Mon Sep 17 00:00:00 2001 From: MuddledBox <101580720+MuddledBox@users.noreply.github.com> Date: Thu, 17 Mar 2022 04:49:36 -0500 Subject: [PATCH] CLI Enhancement: Added Debug (#1030) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Initial commit for Debug in CLI Added Debug as option in CLI * Update cli_commands.c Whoops, swapped the printf, now working as expected! * Fixing Menu Update Now menu should update Co-authored-by: SG Co-authored-by: あく --- applications/cli/cli_commands.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/applications/cli/cli_commands.c b/applications/cli/cli_commands.c index 2e6078f2..53595a08 100644 --- a/applications/cli/cli_commands.c +++ b/applications/cli/cli_commands.c @@ -5,6 +5,7 @@ #include #include #include +#include // Close to ISO, `date +'%Y-%m-%d %H:%M:%S %u'` #define CLI_DATE_FORMAT "%.4d-%.2d-%.2d %.2d:%.2d:%.2d %d" @@ -146,6 +147,20 @@ void cli_command_vibro(Cli* cli, string_t args, void* context) { } } +void cli_command_debug(Cli* cli, string_t args, void* context) { + if(!string_cmp(args, "0")) { + furi_hal_rtc_reset_flag(FuriHalRtcFlagDebug); + loader_update_menu(); + printf("Debug disabled."); + } else if(!string_cmp(args, "1")) { + furi_hal_rtc_set_flag(FuriHalRtcFlagDebug); + loader_update_menu(); + printf("Debug enabled."); + } else { + cli_print_usage("debug", "<1|0>", string_get_cstr(args)); + } +} + void cli_command_led(Cli* cli, string_t args, void* context) { // Get first word as light name NotificationMessage notification_led_message; @@ -348,6 +363,7 @@ void cli_commands_init(Cli* cli) { cli_add_command(cli, "date", CliCommandFlagParallelSafe, cli_command_date, NULL); cli_add_command(cli, "log", CliCommandFlagParallelSafe, cli_command_log, NULL); + cli_add_command(cli, "debug", CliCommandFlagDefault, cli_command_debug, NULL); cli_add_command(cli, "ps", CliCommandFlagParallelSafe, cli_command_ps, NULL); cli_add_command(cli, "free", CliCommandFlagParallelSafe, cli_command_free, NULL); cli_add_command(cli, "free_blocks", CliCommandFlagParallelSafe, cli_command_free_blocks, NULL);