|
|
@ -72,27 +72,6 @@ volatile unsigned long geiger_counts = 0; |
|
|
|
unsigned long geiger_previousMillis; |
|
|
|
|
|
|
|
void ICACHE_FLASH_ATTR sendValues() { |
|
|
|
WiFi.forceSleepWake(); |
|
|
|
WiFi.mode(WIFI_STA); |
|
|
|
wifiMulti.addAP("nether.net", "password1"); |
|
|
|
wifiMulti.addAP("LNet", "password2"); |
|
|
|
wifiMulti.addAP("Freifunk", ""); |
|
|
|
int tries = 0; |
|
|
|
while (wifiMulti.run() != 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]"); |
|
|
|
Serial.print("IP address: "); |
|
|
|
Serial.println(WiFi.localIP()); |
|
|
|
|
|
|
|
float temperature = dht.readTemperature(); |
|
|
|
float humidity = dht.readHumidity(); |
|
|
|
|
|
|
@ -176,6 +155,29 @@ void ICACHE_FLASH_ATTR sendValues() { |
|
|
|
char buffer[500]; |
|
|
|
array.printTo(buffer, sizeof(buffer)); |
|
|
|
|
|
|
|
WiFi.forceSleepWake(); |
|
|
|
delay(1); // yield();
|
|
|
|
WiFi.persistent(false); // don't load and save credentials to flash
|
|
|
|
WiFi.mode(WIFI_STA); |
|
|
|
wifiMulti.addAP("nether.net", "password1"); |
|
|
|
wifiMulti.addAP("LNet", "password2"); |
|
|
|
wifiMulti.addAP("Freifunk", ""); |
|
|
|
int tries = 0; |
|
|
|
while (wifiMulti.run() != 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]"); |
|
|
|
Serial.print("IP address: "); |
|
|
|
Serial.println(WiFi.localIP()); |
|
|
|
|
|
|
|
int httpCode = 0; |
|
|
|
for (int tries=0; tries<3 && httpCode != HTTP_CODE_CREATED; tries++) { |
|
|
|
|
|
|
@ -204,6 +206,7 @@ void ICACHE_FLASH_ATTR sendValues() { |
|
|
|
WiFi.disconnect(); |
|
|
|
WiFi.mode(WIFI_OFF); |
|
|
|
WiFi.forceSleepBegin(); |
|
|
|
delay(1); // yield();
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|