   #endif
 
   #ifdef SERIAL_VERBOSE
-    Serial.println("Configuring access point...");
-  #endif
-
-  // WiFi.softAP(AP_SSID);
-  display.print("- AP\n");
-  display.display();
-  WiFi.softAP(AP_SSID, AP_PWD);
+    Serial.println("Connecting to WIFI...");
+  #endif
+
+  /* Explicitly set the ESP8266 to be a WiFi-client, otherwise, it by default,
+     would try to act as both a client and an access-point and could cause
+     network-issues with your other WiFi-devices on your WiFi-network. */
+  WiFi.disconnect();
+  WiFi.setAutoConnect(true);
+  WiFi.mode(WIFI_STA);
+  WiFi.config(staticIp, defaultGateway, netmask);
+  WiFi.begin(WLAN_SSID, WLAN_PWD);
 
   // IPAddress myIP = WiFi.softAPIP();
   #ifdef SERIAL_VERBOSE

    Serial.println("Setting up matrix");
  #endif
  setupMatrix();
  display.print("- Matrix\n");
  display.display();
  #ifdef SERIAL_VERBOSE
    Serial.println("Matrix test");
  #endif

#include "ESP8266WebServer.h"
#include "Adafruit_GFX.h"
#include "Adafruit_LEDBackpack.h"
#include <SimpleTimer.h>
#include <ArduinoJson.h>

// #define SERIAL_VERBOSE

const char *WLAN_SSID = "Pukpukus";
const char *WLAN_PWD  = "********";
// NETWORK: Static IP details
// @see https://forum.arduino.cc/index.php?topic=460595.0
IPAddress staticIp(      1, 2, 3, 4);
IPAddress defaultGateway(1, 2, 3, 1);
IPAddress netmask(255, 255, 255, 0);

bool CABIN_1_CLOSED = false;
bool CABIN_2_CLOSED = false;
uint32_t CABIN_1_CLOSED_COUNTER = 0;
uint32_t CABIN_2_CLOSED_COUNTER = 0;
bool CABIN_1_WAS_OPENED = true;
bool CABIN_2_WAS_OPENED = true;
uint8_t CABIN_TOTAL_COUNT = 2; // we got total 2 cabins

uint32_t TS_UPTIME_PREVIOUS = 0;
uint32_t TS_UPTIME_OVERLAPS = 0;
uint32_t TS_LAST_UPDATED = 0;
uint32_t TS_LAST_UPDATED_OVERLAPS = 0;

// need this to correct "burn" effect
uint8_t CURRENT_MATRIX_COLOR = 0;

// https://www.adafruit.com/product/902
Adafruit_BicolorMatrix matrix = Adafruit_BicolorMatrix();
