Add reboot command and late terminal activation

This commit is contained in:
2026-08-23 16:14:19 +02:00
parent f9d3e9ece5
commit 0dcc0d20d4
8 changed files with 86 additions and 2 deletions
+39
View File
@@ -0,0 +1,39 @@
/* SPDX-License-Identifier: GPL-3.0-only */
/* Root-level system lifecycle commands for the physical administration console. */
#include "system_console.h"
#include <stdio.h>
#include "esp_console.h"
#include "esp_system.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
static int command_reboot(int argc, char **argv)
{
(void)argv;
if (argc != 1) {
printf("Usage: reboot\n");
return 1;
}
printf("Rebooting now; unsaved RAM-only configuration changes will be lost.\n");
fflush(stdout);
/* Give the UART driver time to transmit the acknowledgement before reset. */
vTaskDelay(pdMS_TO_TICKS(100U));
esp_restart();
return 0;
}
esp_err_t system_console_register_commands(void)
{
const esp_console_cmd_t command = {
.command = "reboot",
.help = "Restart the ESP32; unsaved RAM-only configuration is lost",
.hint = NULL,
.func = &command_reboot,
.argtable = NULL,
};
return esp_console_cmd_register(&command);
}