forked from electro/esp-irblaster
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
820 B
44 lines
820 B
3 years ago
|
//
|
||
|
// Created by MightyPork on 2018/12/08.
|
||
|
//
|
||
|
|
||
|
#include "console/cmd_common.h"
|
||
|
|
||
|
#include "freertos/FreeRTOS.h"
|
||
|
#include "freertos/task.h"
|
||
|
|
||
|
#include "application.h"
|
||
|
#include <console/cmddef.h>
|
||
|
|
||
|
|
||
|
/** 'restart' command restarts the program */
|
||
|
static int cmd_restart(console_ctx_t *ctx, cmd_signature_t *reg)
|
||
|
{
|
||
|
static struct {
|
||
|
struct arg_end *end;
|
||
|
} cmd_args;
|
||
|
|
||
|
if (reg) {
|
||
|
cmd_args.end = arg_end(1);
|
||
|
|
||
|
reg->argtable = &cmd_args;
|
||
|
reg->command = "restart";
|
||
|
reg->help = "Restart the emulator";
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
console_printf("Restarting...\r\n");
|
||
|
|
||
|
// try to cleanly close all connections
|
||
|
telnetsrv_kick_all();
|
||
|
vTaskDelay(pdMS_TO_TICKS(100));
|
||
|
|
||
|
esp_restart();
|
||
|
}
|
||
|
|
||
|
void register_cmd_restart(void)
|
||
|
{
|
||
|
console_cmd_register(cmd_restart, "restart");
|
||
|
}
|
||
|
|