#include #include "display.h" #include "https_request.h" #include "stock.h" #include "wifi.h" esp_err_t init_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(); } return ret; } void init() { ESP_ERROR_CHECK(init_display()); ESP_ERROR_CHECK(init_nvs()); ESP_ERROR_CHECK(init_wifi()); ESP_ERROR_CHECK(init_https()); ESP_ERROR_CHECK(init_stock()); } extern "C" void app_main() { // TODO: Get internet with GUEST_WLAN const char* TAG = "app_main"; init(); ESP_LOGI(TAG, "Init finished"); ESP_ERROR_CHECK(connect_wifi(WIFI_SSID, WIFI_PASSWORD)); ESP_LOGI(TAG, "Wifi finished"); xTaskCreate(display_stock_task, "display_stock_task", 1024*4, NULL, configMAX_PRIORITIES-1, NULL); xTaskCreate(fetch_stock_task, "fetch_stock_task", 1024*4, NULL, configMAX_PRIORITIES-1, NULL); /* for(;;) { ESP_LOGI("mem", "Free heap=%lu", esp_get_free_heap_size()); vTaskDelay(60000 / portTICK_PERIOD_MS); } */ ESP_LOGI(TAG, "main task finished"); }