main.cc 818 B

1234567891011121314151617181920212223242526272829303132
  1. #include <esp_log.h>
  2. #include <esp_err.h>
  3. #include <nvs.h>
  4. #include <nvs_flash.h>
  5. #include <driver/gpio.h>
  6. #include <esp_event.h>
  7. #include "application.h"
  8. #include "system_info.h"
  9. #define TAG "main"
  10. extern "C" void app_main(void)
  11. {
  12. // Initialize the default event loop
  13. ESP_ERROR_CHECK(esp_event_loop_create_default());
  14. // Initialize NVS flash for WiFi configuration
  15. esp_err_t ret = nvs_flash_init();
  16. if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
  17. ESP_LOGW(TAG, "Erasing NVS flash to fix corruption");
  18. ESP_ERROR_CHECK(nvs_flash_erase());
  19. ret = nvs_flash_init();
  20. }
  21. ESP_ERROR_CHECK(ret);
  22. // Launch the application
  23. // Application::GetInstance().Start();
  24. // The main thread will exit and release the stack memory
  25. }