 /*--------------------------------------------------
-  ANI Camera Remote by Andreas Niggemann, 2017
+  ANI Camera Remote by Andreas Niggemann, 2018
   Versions:
   20170607 Base functions
   20170613 Shot counter for WebGUI


void process()
{
  if ((currentExecMode == NONE) || (currentExecMode == TIMELAPSESTOP) || (currentExecMode == WAITFORGPIO))
    return;
  unsigned long currentTimeSlotMillis = millis();
  if ((currentTimeSlotMillis - previousTimeSlotMillis) > timeSlot) // 250 ms time slot
  {

  checkAndProcessStartPin();
  processKeyboard();
  processWebClient();
}

void setupWiFi()
{
  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]);
}

void processWebClient()
{
  String sResponse, sHeader, sParam = "";

  client = server.available(); // Check if a client has connected
  String sRequest = getRequest(client);
  if (sRequest != "") // There is a request
  {
    bool pathOK = checkPathAndGetParameters(sRequest, sParam); // get parameters from request, check path
    if (pathOK) // generate the html page
    {
      if (sParam != "")
      {
        extractParams(sParam);
        process_mode();
      }
      sResponse = generateHTMLPage(delayToStart, numberOfShots, delayBetweenShots);
      generateOKHTML(sResponse, sHeader);
    }
    else // 404 if error
      generateErrorHTML(sResponse, sHeader);
    clientOutAndStop(sHeader, sResponse);
  }
  else
    client.stop(); // stop client, if request is empty
}

void setAndDoProcessMode(execModes newExecMode)
{
  currentExecMode = newExecMode;
  process_mode();
}

void process_mode()
