CLI Enhancement: Added Debug (#1030)

* 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 <who.just.the.doctor@gmail.com>
Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
MuddledBox 2022-03-17 04:49:36 -05:00 committed by GitHub
parent eed49bf863
commit c098292a53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,6 +5,7 @@
#include <task_control_block.h> #include <task_control_block.h>
#include <time.h> #include <time.h>
#include <notification/notification_messages.h> #include <notification/notification_messages.h>
#include <loader/loader.h>
// Close to ISO, `date +'%Y-%m-%d %H:%M:%S %u'` // Close to ISO, `date +'%Y-%m-%d %H:%M:%S %u'`
#define CLI_DATE_FORMAT "%.4d-%.2d-%.2d %.2d:%.2d:%.2d %d" #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) { void cli_command_led(Cli* cli, string_t args, void* context) {
// Get first word as light name // Get first word as light name
NotificationMessage notification_led_message; 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, "date", CliCommandFlagParallelSafe, cli_command_date, NULL);
cli_add_command(cli, "log", CliCommandFlagParallelSafe, cli_command_log, 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, "ps", CliCommandFlagParallelSafe, cli_command_ps, NULL);
cli_add_command(cli, "free", CliCommandFlagParallelSafe, cli_command_free, NULL); cli_add_command(cli, "free", CliCommandFlagParallelSafe, cli_command_free, NULL);
cli_add_command(cli, "free_blocks", CliCommandFlagParallelSafe, cli_command_free_blocks, NULL); cli_add_command(cli, "free_blocks", CliCommandFlagParallelSafe, cli_command_free_blocks, NULL);