diff --git a/src/main.cpp b/src/main.cpp index 84febfe..9ffe7d4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -71,8 +71,16 @@ void ICACHE_FLASH_ATTR sendValues() { WiFi.forceSleepWake(); WiFi.begin(ssid, password); Serial.print("Connecting to wifi"); + int tries = 0; while (WiFi.status() != WL_CONNECTED) { + tries++; Serial.print("."); + if (tries > 20) { + Serial.println(" [ERROR]"); + Serial.println("Retrying in 1 minute.."); + delay(postingInterval); + ESP.restart(); + } delay(500); } Serial.println(" [CONNECTED]"); @@ -199,7 +207,7 @@ void setup() { sds.mode_mon_300(); Wire.begin(BMP_SDA, BMP_SCL); - if (!bmp.begin()) { + if (!bmp.begin(BMP085_MODE_STANDARD)) { Serial.println("No valid BMP085 sensor!"); }