 void generateOKHTML(String& sResp, String& sHead)
 {
   sResp += "<FONT SIZE=-3>Andreas Niggemann " + String(versionMonth) + "/" + String(versionYear) + "<BR></body></html>";
-
   sHead = "HTTP/1.1 200 OK\r\n"
           "Content-Length: " + String(sResp.length()) + "\r\n"
           "Content-Type: text/html\r\n"
           "Connection: close\r\n"
           "\r\n";
-}
-
-String getRequest(WiFiClient webclient)
-{
-  String retVal = "";
-  if (webclient)
-  {
-    unsigned long timeout = millis() + 250;
-    while (!webclient.available() && (millis() < timeout) )
-      delay(1);
-    retVal = webclient.readStringUntil('\r'); // Read the first line of the request
-    webclient.flush();
-  }
-  return retVal;
 }
 
 bool checkPathAndGetParameters(String sReq, String& sPar)

  20170720 Bugfix: Restarting timelapse after reconnect removed
  20170720 Information is displayed all the time, refresh button
  20170720 Autorefresh setting added
  --------------------------------------------------*/

#include <ESP8266WiFi.h>

  }
}

void extractParams(String params)
{
  params[0] = ' ';
  params.trim();
  params.toUpperCase();
  if (params.length() > 0)
  {
    params += "&";
    if ((currentExecMode == TIMELAPSERUNNING) || (currentExecMode == REFRESH)) // Only refresh and stop allowed in timelapse mode
    {
      if (params.indexOf("REFRESH") >= 0) // Refresh webGUI
        currentExecMode = REFRESH;
      if (params.indexOf("STOP") >= 0) // STOP timelapse
        currentExecMode = TIMELAPSESTOP;
    }
    else // blocked if timelapse running
    {
      if (params.indexOf("RESET") >= 0) // RESET form
        currentExecMode = RESET;
      else if (params.indexOf("SINGLE_SHOT") >= 0) // single shot
        currentExecMode = ONESHOT;
      else if ((params.indexOf("WAITFORGPIO") >= 0) && (startPin > -1)) // Wait for signal on input pin
      {
        currentExecMode = WAITFORGPIO;
        setTimelapseParams(params);
      }
      else if ((params.indexOf("DELAYTOSTART") >= 0) && (currentNShots <= 0)) // Switch to timelapse
      {
        currentExecMode = TIMELAPSESTART;
        setTimelapseParams(params);
      }
    }
  }
}

void setTimelapseParams(String params) // Set timelapse parameters for modes WAITFORGPIO and START
{
  String par = params + " ";
  int idx = par.indexOf("&"); // Find element delimiter
  while (idx > 2)
  {
    String elem = par.substring(0, idx);
    par = par.substring(idx + 1, par.length());
    int idx2 = elem.indexOf("=");
    if (idx2 > 1)
    {
      String elemName = elem.substring(0, idx2); // Variable name
      String elemValue = elem.substring(idx2 + 1, elem.length()); // Variable value
      if (elemName == "DELAYTOSTART")
        delayToStart = elemValue.toInt();
      if (elemName == "NUMBEROFSHOTS")
        numberOfShots = elemValue.toInt();
      if (elemName == "DELAYBETWEENSHOTS")
        delayBetweenShots = elemValue.toInt();
    }
    idx = par.indexOf("&");
  }
}

String generateHTMLPage(unsigned long sDelay, unsigned long nShots, unsigned long interval)
{
  String refreshLine = "";
  String stateNotInTimelapse = "enabled";
  String buttonState = "disabled";
  String waitForGPIOLine = "";
  String waitForGPIOLineHint = "";
  // disable webGUI elements while in timelapse
  if (((currentExecMode == TIMELAPSERUNNING) || (currentExecMode == REFRESH)) && (currentNShots > 0))
  {
    buttonState = "enabled";
    stateNotInTimelapse = "disabled";
  }
  else if (currentExecMode == WAITFORGPIO)
    currentAutorefresh = autorefresh;
  else
    currentAutorefresh = 0;
  if (currentAutorefresh > 0)
    refreshLine = "<meta http-equiv=\"refresh\" content=\"" + String(currentAutorefresh) + "; URL=http://" + myIPStr + "/\">";
  if (startPin > -1) // webGUI elements für GPIO if defined
  {
    waitForGPIOLine = "<input type=submit value=\"Wait for GPIO" + String(startPin) + "\" " + stateNotInTimelapse + " name=WAITFORGPIO>";
    waitForGPIOLineHint = "<FONT SIZE=-2>GPIO" + String(startPin) + " input LOW starts timelapse<BR>";
  }
  // HTML here
  String retVal = "<html><head><title>ANI Camera Remote</title>" + refreshLine + ""
                  "<style>table, th, td { border: 0px solid black;} button, input[type=number], input[type=submit]"
                  "{width:120px;height:20px;font-size:12pt;}</style></head><body>"
                  "<font color=\"#000000\"><body bgcolor=\"#c0c0c0\">"
                  "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=yes\">"
                  "<h2>" + prgTitle + " V" + prgVersion + "</h2>"
                  "<table style=\"font-size:16px;\">"
                  "<tr><td>Timelapse</td><td><a href=?function=RESET><button " + stateNotInTimelapse + ">Reset</button></a></td></tr>"
                  "<form method=GET>"
                  "<tr><td>Delay to start:</td><td><input " + stateNotInTimelapse + " id=delayToStart name=delayToStart type=number min=0 step=1 value=" + String(sDelay) + "> sec</td></tr>"
