#include "wlan.h" #include "credentials.h" #include void wlan_connection() { if (WiFi.SSID() != SSID) { WiFi.begin(SSID, PSK); WiFi.persistent(true); WiFi.setAutoConnect(true); WiFi.setAutoReconnect(true); } while (WiFi.status() != WL_CONNECTED) { delay(1000); Serial.print("."); } Serial.println("WiFi connected"); Serial.println(WiFi.localIP()); } void mqtt_connection(char *server, int port, char *fingerprint) { WiFiClientSecure client; client.connect(server, port); } void enter_deep_sleep(const int start_time) { int elapsed = millis() - start_time; if (elapsed >= WIFI_TIMEOUT) { WiFi.disconnect(); } ESP.deepSleep(SLEEP_TIME, WAKE_RF_DEFAULT); }