// app_main.c #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "esp_log.h" #include "nvs_flash.h" #include "wifi_http.h" // 引入wifi_http.c中的头文件 #include "http_request.h" // 引入http_request.c中的头文件 #include "camera.h" static const char *TAG = "app_main"; // 主函数 void app_main(void) { // 初始化NVS esp_err_t ret = nvs_flash_init(); if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) { ESP_ERROR_CHECK(nvs_flash_erase()); ret = nvs_flash_init(); } ESP_ERROR_CHECK(ret); // 初始化Wi-Fi并连接 wifi_init_sta(); // 等待Wi-Fi连接 vTaskDelay(10000 / portTICK_PERIOD_MS); xTaskCreate(take_photo, "take_photo", 1024 * 50, NULL, 20, NULL); }