 
 // Create webserver on webServerPort
 WiFiServer server(webServerPort);
-
 WiFiClient client;
 
 void setup()
 {
+  displaySetup();
+
   pinMode(triggerPin, OUTPUT); // setup GPIO as camera trigger
   trigger(OFF);
   if (startPin > -1)
     pinMode(startPin, INPUT_PULLUP); // Setup GPIO input for start signal
 
-  WiFi.mode(WIFI_AP); // AP mode for connections
-  WiFi.softAP(ssid, password);
-  server.begin();
-  IPAddress ip = WiFi.softAPIP();
-  myIPStr = String(ip[0]) + '.' + String(ip[1]) + '.' + String(ip[2]) + '.' + String(ip[3]);
+  setupWiFi();
 
   checkAndProcessAutoStart();
 }

                  ;
  if (refreshLine != "")
    retVal += "<FONT SIZE=-2>Page will refresh every " + String(currentAutorefresh) +  " seconds<BR>";
  return retVal;
}


  20170722 Input pin as timelapse start
  20170724 Setting for autostart timelapse mode
  20170724 Calculate remaining time
  20180503 Preparatory work for M5Stack (display and keyboard)
  --------------------------------------------------*/
#ifdef ESP32
#include <M5Stack.h>
#include <WiFi.h>
#include <Free_Fonts.h>
#else
#include <ESP8266WiFi.h>
#endif

//--------------------------------------------------
// Settings:
