Cli: fix memleak, add more commands. (#244)

* Cli: add statndard applications, fix memory leak, add reset and reset to dfu.

* Lib: pass proper data pointer to osMessageQueueGet

* App-loader: optional cli

* Format sources
This commit is contained in:
あく
2020-11-17 20:08:31 +03:00
committed by GitHub
parent 459b61720c
commit d57b7fd448
10 changed files with 96 additions and 32 deletions

View File

@@ -87,17 +87,32 @@ void power_free(Power* power) {
}
void power_cli_poweroff(string_t args, void* context) {
cli_print("Poweroff in 5 seconds");
osDelay(5000);
cli_print("Poweroff in 3 seconds");
osDelay(3000);
api_hal_power_off();
}
void power_cli_reset(string_t args, void* context) {
cli_print("NVIC System Reset in 3 seconds");
osDelay(3000);
NVIC_SystemReset();
}
void power_cli_dfu(string_t args, void* context) {
cli_print("NVIC System Reset to DFU mode in 3 seconds");
api_hal_boot_set_mode(ApiHalBootModeDFU);
osDelay(3000);
NVIC_SystemReset();
}
void power_task(void* p) {
(void)p;
Power* power = power_alloc();
if(power->cli) {
cli_add_command(power->cli, "poweroff", power_cli_poweroff, power);
cli_add_command(power->cli, "reset", power_cli_reset, power);
cli_add_command(power->cli, "dfu", power_cli_dfu, power);
}
FuriRecordSubscriber* gui_record = furi_open_deprecated("gui", false, false, NULL, NULL, NULL);