 static unsigned int const POWERSAVE_IN_MS       = 20 * 1000;   // 20 secs
 #else
 static unsigned int const PAUSE_POWERSAVE_IN_MS = 1000 * 360; // 10 minutes
-static unsigned int const PAUSE_ACTIVE_IN_MS    = 500;        // half a sec
+static unsigned int const PAUSE_ACTIVE_IN_MS    = 2500;       // half a sec
 static unsigned int const POWERSAVE_IN_MS       = 120 * 1000; // 2 minutes
 #endif
-static unsigned int pauseInMs = PAUSE_ACTIVE_IN_MS;
+static unsigned int const UPLOAD_TIME_IN_MS  = 1000 * 3600 * 4; // 4 hours must be less than 50 days
+static unsigned int       pauseInMs          = PAUSE_ACTIVE_IN_MS;
+static unsigned int       lastUploadTimeInMs = 0;
+static unsigned int       lastMillis         = 0;
 
 static unsigned int const CURRENT_TIME_ZONE_IN_S = 3600; // UTC+1
 
 static unsigned int const SCREEN_WIDTH  = 128;
 static unsigned int const SCREEN_HEIGHT = 32;
+
+static unsigned int const NUM_LAST_SAMPLES = 5;
 
 extern const unsigned char LECertRoot[] PROGMEM;
 extern const unsigned int  LECertRootSize;

	dht.humidity().getEvent(&sensorHumidity);
}

void drawScreen()
{
	String displayData;

        0x84, 0x6D, 0x84, 0x6D, 0xB4, 0x6D, 0xB4, 0x6D, 0xB4, 0x6D, 0xB4, 0x6D, 0xB4, 0x6D, 0x00, 0x00,
    }
};

static char const POST_HEADERS[] = "POST /data HTTP/1.1\r\n"
                                   "Host: " API_HOSTNAME "\r\n"
                                   "Content-Type: application/json\r\n"
                                   "User-Agent: ESP8266\r\n"
                                   "Accept-Encoding: identity;q=1\r\n"
                                   "X-Auth-Token:" API_AUTH_TOKEN "\r\n";

class WiFiConnection
{
