/* * SPDX-FileCopyrightText: 2022 Helmut Pozimski * * SPDX-License-Identifier: GPL-2.0-only */ #include #include #include #include #include #include #include "wifi.h" #include "configuration.h" #include "ds3231.h" #include "tm1637.h" #include "time_sync.h" #include "time_display.h" void app_main(void) { struct tm current_time; ESP_ERROR_CHECK(nvs_flash_init()); ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); wifi_init(); wifi_start(); ds3231_init(DS3231_SDA_PIN, DS3231_SCL_PIN); tm1637_init(TM1637_CLK_PIN, TM1637_DIO_PIN, true, 1); ds3231_read_date_time(¤t_time); sntp_start(21600); if (current_time.tm_year == 0) { await_sntp_sync(); } xTaskCreate(display_update_task, "display_update_task", 2048, NULL, 7, NULL); }