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

  currentTriggerMode =  tMode;
}

#ifdef ESP32
//void setupWiFi() { }
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 displaySetup()
{
  M5.begin();

  M5.Lcd.printf(outStr.c_str());
}

void switchScreenOnOff(lcdState dState)
{
  if (dState == LCDON)
  {
    M5.Lcd.writecommand(ILI9341_DISPON);
    M5.Lcd.setBrightness(20);
  }
  else
  {
    M5.Lcd.writecommand(ILI9341_DISPOFF);
    M5.Lcd.setBrightness(0);
  }
  lcdIsON = (dState == LCDON);
}

void checkInactivity()
{
  unsigned long currentMilliseconds = millis();
  if ((currentMilliseconds - previousMilliseconds) > 1000)
  {
    inactivityCounter++;
    if (inactivityCounter > screenSaverTime)
    {
      inactivityCounter = 0;
      switchScreenOnOff(LCDOFF);
    }
    previousMilliseconds = currentMilliseconds;
  }
}

long limitsUpDown(int upDownFactor, long number, long lowerLimit, int upperLimit)
{
  long retVal = number + upDownFactor;
  retVal = (retVal >= lowerLimit) ? retVal : lowerLimit;
  retVal = (retVal <= upperLimit) ? retVal : upperLimit;
  return retVal;
}

void changeValueOrExecFunction(int upDownFactor, int lineNumber)
{
  switch (lineNumber)
  {
    case 2: delayToStart = limitsUpDown(upDownFactor, delayToStart, 0, LONG_MAX); break;
    case 3: numberOfShots = limitsUpDown(upDownFactor, numberOfShots, 1, LONG_MAX) ; break;
    case 4: delayBetweenShots = limitsUpDown(upDownFactor, delayBetweenShots, 1, LONG_MAX); break;
    case 5: setAndDoProcessMode(WAITFORGPIO); break;
    case 6: setAndDoProcessMode(TIMELAPSESTART); break;
    case 7: setAndDoProcessMode(TIMELAPSESTOP); break;
    case 8: setAndDoProcessMode(ONESHOT); break;
    case 9: setAndDoProcessMode(RESET); break;
  }
}

void processKeyboard()
{
  delay(100);
  bool buttonPressed = M5.BtnA.isPressed() || M5.BtnB.isPressed() || M5.BtnC.isPressed();
  bool plusMinusPressed = M5.BtnA.isPressed() || M5.BtnB.isPressed();
  if (buttonPressed)
  {
    inactivityCounter = 0;
    if (!lcdIsON) // LCD is in screensaver mode so we had to switch it on
      switchScreenOnOff(LCDON);
    else
    {
      int upDownFaktor = (M5.BtnA.isPressed()) ? +1 : -1;
      if (plusMinusPressed)
      {
        upDownFaktor = M5.BtnC.isPressed() ? (upDownFaktor * 10) : upDownFaktor;
        changeValueOrExecFunction(upDownFaktor, highlightLine);
      }
      else if (M5.BtnC.wasPressed()) // Only Button C: Move from line to line
        highlightLine = (highlightLine > 8) ? 2 : highlightLine + 1;
      onDisplay();
    }
  }
  M5.update();
}
#else
// Methods for ESP8266
void displaySetup() { }
void onDisplay() { }
void checkInactivity() { }
void processKeyboard() { }
#endif
