#include "stdio.h"
#include "esp_system.h"
#include "nvs_flash.h"
#include "esp_event.h"
#include "esp_netif.h"
#include "freertos/FreeRTOS.h"
#include "esp_err.h"
#include "esp_log.h"
#include "wifi_connect.h"
#include "mqtt_connect.h"
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);
connect_wifi();
vTaskDelay(pdMS_TO_TICKS(2000));
mqtt_app_start();
while (1)
{
vTaskDelay(pdMS_TO_TICKS(1000));
}
}