Files
xiaozhi-esp32/main/main.cc

33 lines
826 B
C++
Raw Permalink Normal View History

2024-10-03 06:39:22 +08:00
#include <esp_log.h>
#include <esp_err.h>
#include <nvs.h>
#include <nvs_flash.h>
#include <driver/gpio.h>
#include <esp_event.h>
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
2024-08-31 18:00:23 +08:00
2024-11-05 20:15:00 +08:00
#include "application.h"
#include "system_info.h"
2024-08-31 18:00:23 +08:00
#define TAG "main"
extern "C" void app_main(void)
{
// Initialize the default event loop
ESP_ERROR_CHECK(esp_event_loop_create_default());
// Initialize NVS flash for WiFi configuration
esp_err_t ret = nvs_flash_init();
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
2024-11-15 04:44:53 +08:00
ESP_LOGW(TAG, "Erasing NVS flash to fix corruption");
2024-08-31 18:00:23 +08:00
ESP_ERROR_CHECK(nvs_flash_erase());
ret = nvs_flash_init();
}
ESP_ERROR_CHECK(ret);
2025-01-13 06:49:01 +08:00
// Launch the application
2025-08-02 01:27:14 +08:00
auto& app = Application::GetInstance();
app.Start();
2024-08-31 18:00:23 +08:00
}