From 5a9cfb5b50a35ef323b4d8d2895cc22d29d4ba03 Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Wed, 27 Jun 2018 23:08:58 +0200 Subject: [PATCH] fix memory leak (heap) --- src/main.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index c457f37..635b302 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -260,12 +260,7 @@ void ICACHE_FLASH_ATTR sendValues() { WiFi.forceSleepWake(); delay(1); // yield(); - WiFi.persistent(false); // don't load and save credentials to flash WiFi.mode(WIFI_STA); - wifiMulti.addAP("nether.net", PWD_NETHERNET); - wifiMulti.addAP("LNet", PWD_LNET); - wifiMulti.addAP("hw1_gast", PWD_HW1); - wifiMulti.addAP("Freifunk", ""); if ( ip != INADDR_NONE && dns != INADDR_NONE && gateway != INADDR_NONE && subnet != INADDR_NONE && ((ip[0] == 192 && ip[1] == 168) || (ip[0] == 172 && ip[1] == 16)) @@ -430,8 +425,14 @@ void setup() { geigeraverage.clear(); - previousMillis = rtcMillis(); + //WiFi.persistent(false); // don't load and save credentials to flash + WiFi.mode(WIFI_STA); + wifiMulti.addAP("nether.net", PWD_NETHERNET); + wifiMulti.addAP("LNet", PWD_LNET); + wifiMulti.addAP("hw1_gast", PWD_HW1); + wifiMulti.addAP("Freifunk", ""); + previousMillis = rtcMillis(); DEBUG_MSG("ready.\n"); //Serial.flush(); } @@ -446,6 +447,8 @@ void loop() { geiger_counts = 0; } DEBUG_MSG("sleeping now... (%u)\n", currentMillis); + DEBUG_MSG("heap: %d\n", ESP.getFreeHeap()); + delay(10); lightsleep(); delay(10); // debounce?