#include #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include #include "nvs_flash.h" #include "lwip/err.h" #include "lwip/sys.h" #include "esp_wifi.h" #include "esp_log.h" #include "esp_vfs_fat.h" #include "APlib.h" #include "HTTPServe.h" #include void app_main(void) { 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); wifi_config_t wifi_config = wifi_config_generator("CO2Sense","testtest",1); wifi_init_softap(wifi_config); const esp_vfs_fat_mount_config_t mount_config = { .max_files = 10, .format_if_mount_failed = false, .allocation_unit_size = CONFIG_WL_SECTOR_SIZE }; esp_err_t err; err = esp_vfs_fat_rawflash_mount("/http", "http", &mount_config); if (err != ESP_OK) { ESP_LOGE("MAIN", "Failed to mount FATFS (%s)", esp_err_to_name(err)); return; } HTTP_serve_config_t serv_config = { .mountpoint = "/http", .getUri = "/*", .postUri = "/*", }; ESP_ERROR_CHECK(start_server(serv_config)); while(1){ vTaskDelay(100 / portTICK_PERIOD_MS); } }