 
 	  http.end();
 	*/
-	lastButtonPressed += pause_in_ms; // a little false since we are doing other, stuff, but, meh
+	lastButtonPressed += pauseInMs; // a little false since we are doing other, stuff, but, meh
 	if (lastButtonPressed >= POWERSAVE_IN_MS)
 	{
-		pause_in_ms = PAUSE_POWERSAVE_IN_MS;
-		displayOn   = false;
+		pauseInMs = PAUSE_POWERSAVE_IN_MS;
+		displayOn = false;
 		u8g2.noDisplay();
 	}
 
-	delay(pause_in_ms);
-}
+	delay(pauseInMs);
+}

};

WiFiConnection wifiConnection;

void setup()
{
#if !FINAL
	Serial.begin(115200);
	Serial.println();
#endif

	pinMode(D3, INPUT_PULLUP);
	attachInterrupt(digitalPinToInterrupt(D3), button_pressed, FALLING);

	dht.begin();
	u8g2.begin();
	wifiConnection.checkWiFi();
}

extern "C" void esp_schedule();

extern void delay_end(void* arg);

void button_pressed()
{
	DEBUG_PRINTLN("Button pressed!");
	lastButtonPressed = 0;
	displayOn         = true;
	pause_in_ms       = PAUSE_ACTIVE_IN_MS;
	u8g2.display();
	esp_schedule(); // we use a trick here to wakeup the main loop
}

void display()
{
	String          displayData;
	sensors_event_t event;
	dht.temperature().getEvent(&event);
	if (isnan(event.temperature))
	{
		DEBUG_PRINTLN("Error reading temperature!");
		displayData += "NaN";
	} else
	{
		DEBUG_PRINT("Temperature: ");
		DEBUG_PRINT(event.temperature);
		DEBUG_PRINTLN(" *C");
		displayData += (int)event.temperature;
		displayData += "°C";
	}
	displayData += " - ";
	dht.humidity().getEvent(&event);
	if (isnan(event.relative_humidity))
	{
		DEBUG_PRINTLN("Error reading humidity!");
		displayData += "NaN";
	} else
	{
		DEBUG_PRINT("Humidity: ");
		DEBUG_PRINT(event.relative_humidity);
		DEBUG_PRINTLN("%");
		displayData += (int)event.relative_humidity;
		displayData += "%";
	}



#include <U8g2lib.h>

#include "Secrets.h"

#define FINAL 0

