Add RESTART command for master and slaves via ESP-NOW.
UART RESTART (client_id 0 = local reboot, >0 = unicast); dashboard and CLI hooks; delayed esp_restart after response. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
#include "pod_reboot.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_system.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
|
||||
static const char *TAG = "[REBOOT]";
|
||||
|
||||
#define POD_RESTART_DELAY_MS 150
|
||||
|
||||
static void restart_task(void *param) {
|
||||
(void)param;
|
||||
vTaskDelay(pdMS_TO_TICKS(POD_RESTART_DELAY_MS));
|
||||
ESP_LOGI(TAG, "restarting");
|
||||
esp_restart();
|
||||
}
|
||||
|
||||
void pod_schedule_restart(void) {
|
||||
if (xTaskCreate(restart_task, "pod_restart", 2048, NULL, 5, NULL) != pdPASS) {
|
||||
ESP_LOGE(TAG, "failed to create restart task");
|
||||
esp_restart();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user