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:
@@ -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);
|
||||
|
Reference in New Issue
Block a user