diff --git a/include/espidf/spsp_wifi_station.hpp b/include/espidf/spsp_wifi_station.hpp index 5d843ec..c9d8067 100644 --- a/include/espidf/spsp_wifi_station.hpp +++ b/include/espidf/spsp_wifi_station.hpp @@ -45,7 +45,7 @@ namespace SPSP::WiFi // Timing std::chrono::milliseconds initTimeout = std::chrono::seconds(20); //!< Timeout for connecting to AP - std::chrono::milliseconds sntpTimeout = std::chrono::seconds(5); //!< Timeout for initial time synchronization using SNTP server + std::chrono::milliseconds sntpTimeout = std::chrono::seconds(20); //!< Timeout for initial time synchronization using SNTP server }; /** diff --git a/src/espidf/spsp_wifi_station.cpp b/src/espidf/spsp_wifi_station.cpp index c8095a5..c018b49 100644 --- a/src/espidf/spsp_wifi_station.cpp +++ b/src/espidf/spsp_wifi_station.cpp @@ -88,14 +88,14 @@ namespace SPSP::WiFi sntpConfig.num_of_servers = 1; sntpConfig.servers[0] = m_config.sntpServer.c_str(); - esp_netif_sntp_init(&sntpConfig); + SPSP_ERROR_CHECK(esp_netif_sntp_init(&sntpConfig), + ConnectionError("SNTP init failed")); // Block - if (esp_netif_sntp_sync_wait( - pdMS_TO_TICKS(m_config.sntpTimeout.count()) - ) != ESP_OK) { - throw ConnectionError("SNTP synchronization timeout"); - } + SPSP_ERROR_CHECK( + esp_netif_sntp_sync_wait(pdMS_TO_TICKS(m_config.sntpTimeout.count())), + ConnectionError("SNTP synchronization timeout") + ); } m_initialized = true;