 void displaySetup()
 {
   M5.begin();
-  onDisplay();
-}
-
-void onDisplay()
+  onDisplay(MAINSCREEN);
+}
+
+void onDisplay(lcdScreens screen)
 {
   int actuLine = 0;
   M5.Lcd.fillScreen(TFT_BLACK);
   M5.Lcd.setFreeFont(FF9);
-  outLCD(1, prgTitle + " " + prgVersion, TFT_BLUE);
-  outLCD(2, "Delay to Start: " + String(delayToStart), TFT_WHITE);
-  outLCD(3, "Number of Shots: " + String(numberOfShots), TFT_WHITE);
-  outLCD(4, "Interval: " + String(delayBetweenShots), TFT_WHITE);
-  if (startPin > -1)
-    outLCD(5, "Wait for GPIO" + String(startPin), TFT_WHITE);
-  outLCD(6, "START", TFT_YELLOW);
-  outLCD(7, "STOP", TFT_YELLOW);
-  outLCD(8, "ONE SHOT", TFT_YELLOW);
-  outLCD(9, "RESET", TFT_YELLOW);
-  outLCD(10, "Remaining delay: " + String(currentDelayToStart), TFT_GREEN);
-  outLCD(11, "Remaining shots: " + String(currentNShots), TFT_GREEN);
+  outLCD(1, screenHeaderLine, TFT_BLUE);
+  actuScreen = screen;
+  switch (screen)
+  {
+    case MAINSCREEN:
+      {
+        outLCD(2, "Delay to Start: " + String(delayToStart), TFT_WHITE);
+        outLCD(3, "Number of Shots: " + String(numberOfShots), TFT_WHITE);
+        outLCD(4, "Interval: " + String(delayBetweenShots), TFT_WHITE);
+        if (startPin > -1)
+          outLCD(5, "Wait for GPIO" + String(startPin), TFT_WHITE);
+        outLCD(6, "START", TFT_YELLOW);
+        outLCD(7, "STOP", TFT_YELLOW);
+        outLCD(8, "ONE SHOT", TFT_YELLOW);
+        outLCD(9, "RESET", TFT_YELLOW);
+        outLCD(10, "Remaining delay: " + String(currentDelayToStart), TFT_GREEN);
+        outLCD(11, "Remaining shots: " + String(currentNShots), TFT_GREEN);
+        lastDialogLine = 9;
+        break;
+      }
+    case CONFIGSCREEN:
+      {
+        outLCD(2, "WIFI ON", TFT_YELLOW);
+        outLCD(3, "WIFI OFF", TFT_YELLOW);
+        outLCD(4, "EXIT Configuration", TFT_YELLOW);
+        lastDialogLine = 4;
+        break;
+      }
+  }
+}
+
+void changeValueOrExecFunction(int upDownFactor, lcdScreens screen, int lineNumber)
+{
+  switch (screen)
+  {
+    case MAINSCREEN:
+      {
+        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;
+        }
+        break;
+      }
+    case CONFIGSCREEN:
+      {
+        switch (lineNumber)
+        {
+          case 2: wifiON = true; setupWiFi(); break;
+          case 3: ESP.restart(); break;
+          case 4: onDisplay(MAINSCREEN); break;
+        }
+        break;
+      }
+  }
 }
 
 void outLCD(int lineNumber, String outStr, int textColor)

      if (currentDelayToStart > 0) // Start delay
      {
        currentDelayToStart--;
        onDisplay();
      }
      else if (currentDelayBetweenShots > 0)
        if ((secCounter % currentDelayBetweenShots ) == 0) // Delay between shots

            currentNShots--;
            NumberOfShotsSinceStart++;
          }
          onDisplay(MAINSCREEN);
        }
    }
  }
