       }
       break;
     //-------------------------------SelectMenu22-----------------------------------------
+    //SET ROLLUP PROGRAM
+    case 22 :
+      if (y < Nbitems) {
+        nr = y;
+        switchmenu(221);
+      }
+      else {
+        switchmenu(2);
+      }
+      break;
+    //-------------------------------SelectMenu221-----------------------------------------
+    //SET INCREMENTS
+    case 221 :
+      if (y < Nbitems) {
+        inc = y;
+        switchmenu(2211);
+      }
+      else {
+        switchmenu(2);
+      }
+      break;
+    //-------------------------------SelectMenu2211-----------------------------------------
     //SET ROTATION TIME
-    case 22 :
-      if (y < Nbitems) {
-        //rotation = y;
-        EEPROM.update(ROTATION, y);
+    case 2211 :
+      if (y < Nbitems) {
+        rot = y*2;
+        switchmenu(22111);
+      }
+      else {
         switchmenu(2);
       }
-      else {
-        switchmenu(2);
-      }
-      break;
-    //-------------------------------SelectMenu23-----------------------------------------
-    //"5", "15", "20", "30", "45", "60", "75", "90", "120", "back"
-    case 23 :
-      int pause;
-      switch (y) {
-        case 1: pause = 5; switchmenu(2); EEPROM.write(PAUSE, pause);break;
-        case 2: pause = 15; switchmenu(2); EEPROM.write(PAUSE, pause); break;
-        case 3: pause = 20; switchmenu(2); EEPROM.write(PAUSE, pause); break;
-        case 4: pause = 30; switchmenu(2); EEPROM.write(PAUSE, pause); break;
-        case 5: pause = 45; switchmenu(2); EEPROM.write(PAUSE, pause); break;
-        case 6: pause = 60; switchmenu(2); EEPROM.write(PAUSE, pause); break;
-        case 7: pause = 75; switchmenu(2); EEPROM.write(PAUSE, pause); break;
-        case 8: pause = 90; switchmenu(2); EEPROM.write(PAUSE, pause); break;
-        case 9: pause = 120; switchmenu(2); EEPROM.write(PAUSE, pause); break;
-        case 10: switchmenu(2); break;
-      }
-      break;
-
-    //-------------------------------SelectMenu3-----------------------------------------
-    case 3 :
-      switch (y) {
-        case 1:
+      break;
+      //-------------------------------SelectMenu22111-----------------------------------------
+      //SET PAUSE TIME
+      case 22111 :
+        switch (y) {
+          case 1: p = 5; switchmenu(221111);break;
+          case 2: p = 15; switchmenu(221111); break;
+          case 3: p = 20; switchmenu(221111); break;
+          case 4: p = 30; switchmenu(221111); break;
+          case 5: p = 45; switchmenu(221111); break;
+          case 6: p = 60; switchmenu(221111); break;
+          case 7: p = 75; switchmenu(221111); break;
+          case 8: p = 90; switchmenu(221111); break;
+          case 9: p = 120; switchmenu(221111); break;
+          case 10: switchmenu(2); break;
+          }
+        break;
+      //-------------------------------SelectMenu221111-----------------------------------------
+      //SET MODIFICATOR
+      case 221111 :
+        if (y < Nbitems) {
+          mod = y-11;
+          switchmenu(2211111);
+        }
+        else {
+          switchmenu(2);
+        }
+      break;
+      //-------------------------------SelectMenu221111-----------------------------------------
+      //SET HYSTERESIS
+      case 2211111 :
+        if (y < Nbitems) {
+          hys = y;
+          switchmenu(22111111);
+        }
+        else {
+          switchmenu(2);
+        }
+      break;
+      //-------------------------------SelectMenu221111-----------------------------------------
+      //SET SAFETY AND UPDATE EEPROM
+      case 22111111 :
+        switch (y){
+          case 1: sfty = true;defineRollup(nr,inc,rot,p,mod,hys,sfty); switchmenu(2);break;
+          case 2: sfty = false;defineRollup(nr,inc,rot,p,mod,hys,sfty); switchmenu(2);break;
+          case 3: switchmenu(2);break;
+        }
+      break;
+    //-------------------------------SelectMenu31-----------------------------------------
+  /*  case 3: Scrollingmenu("FANS*", 3, "Program", "setProgram", "back", "", "", "", "",  "", "", "", currentMenuItem); break;
+    case 31: Scrollingnumbers("#****",(sizeof(fans)+1), currentMenuItem, 1, 1); break;
+    case 32: Scrollingnumbers("#****", (sizeof(fans)+1), currentMenuItem, 1, 1); break;
+    case 321: Scrollingnumbers("MOD**", 22, currentMenuItem, -10, 1); break;
+    case 3211: Scrollingnumbers("HYST*", 6, currentMenuItem, 1, 1); break;
+    case 32111: Scrollingmenu("SAFTY", 3, "Oui", "Non", "back", "", "", "", "",  "", "", "", currentMenuItem); break;
+*/
+
+//-------------------------------SelectMenu3-----------------------------------------
+//État, setProgram
+case 3 :
+  switch (y) {
+    case 1:
+      switchmenu(31); break;
+    case 2:
+      if (sizeof(rollups) == 2){switchmenu(32);}
+      else{switchmenu(0);}
+      break;
+    case 3: switchmenu(0); break;
+  }
+break;
+
+//-------------------------------SelectMenu31-----------------------------------------
+    //PROGRAMME DES FANS
+    case 31 :
+      if (y < Nbitems) {
+        switch(y){
+          case 1 :
           lcd.noBlink();
           clearPrintTitle();
-          lcd.setCursor(0, 1); lcd.print(F("FAN : "));
-          if (digitalRead(FAN[0]) == OFF) {
-            lcd.print(F("OFF"));
-          }
-          else {
-            lcd.print(F("ON"));
-          }
-          lcd.setCursor(0, 2); lcd.print(F("Temp. cible : ")); lcd.print(tempCible+EEPROM.read(VMOD)-10); lcd.print(F("C"));
-          lcd.setCursor(0, 3); lcd.print(F("Hysteresis : ")); lcd.print(EEPROM.read(VHYST)); lcd.print(F("C"));
+          lcd.setCursor(0, 1); lcd.print(F("TA: ")); lcd.print(tempCible + vmodE(0)); lcd.print("C");
+          lcd.setCursor(0, 2); lcd.print(F("H: ")); lcd.print(rhystE(0)); lcd.print(F("C"));
+          lcd.setCursor(0, 3); lcd.print(F("SAFETY: ")); if(fanSafetyE(0)== true){lcd.print(F("Activated"));}else{lcd.print(F("Deactivated"));}
           break;
-        case 2: switchmenu(31); break;
-        case 3: switchmenu(0); break;
-      }
-      break;
-    //-------------------------------SelectMenu31-----------------------------------------
+          case 2 :
+          lcd.setCursor(0, 1); lcd.print(F("TA: ")); lcd.print(tempCible + vmodE(1)); lcd.print("C");
+          lcd.setCursor(0, 2); lcd.print(F("H: ")); lcd.print(rhystE(1)); lcd.print(F("C"));
+          lcd.setCursor(0, 3); lcd.print(F("SAFETY: ")); if(fanSafetyE(1)== true){lcd.print(F("Activated"));}else{lcd.print(F("Deactivated"));}
+          break;
+        }
+      }
+      else {
+        switchmenu(3);
+      }
+      break;
+    //-------------------------------SelectMenu32-----------------------------------------
+    //SET FAN PROGRAM
+    case 32 :
+      if (y < Nbitems) {
+        nr = y;
+        switchmenu(321);
+      }
+      else {
+        switchmenu(3);
+      }
+      break;
+    //-------------------------------SelectMenu321-----------------------------------------
+    //SET MOD
+    case 321 :
+      if (y < Nbitems) {
+        mod = y-11;
+        switchmenu(3211);
+      }
+      else {
+        switchmenu(2);
+      }
+      break;
+    //-------------------------------SelectMenu3211-----------------------------------------
     //SET HYSTERESIS
-    case 31 :
-      if (y < Nbitems) {
-        switchmenu(3);
-        EEPROM.write(1, y);
-      }
-      else {
-        switchmenu(3);
-      }
-      break;
-    //-------------------------------SelectMenu4-----------------------------------------
-    case 4 :
-      switch (y) {
-        case 1:
+    case 3211 :
+      if (y < Nbitems) {
+        hys = y;
+        switchmenu(32111);
+      }
+      else {
+        switchmenu(2);
+      }
+      break;
+      //-------------------------------SelectMenu321111-----------------------------------------
+      //SET SAFETY AND UPDATE EEPROM
+      case 32111 :
+        switch (y){
+          case 1: sfty = true;defineFan(nr,mod,hys,sfty); switchmenu(3);break;
+          case 2: sfty = false;defineFan(nr,mod,hys,sfty); switchmenu(3);break;
+          case 3: switchmenu(3);break;
+        }
+      break;
+
+/*  case 4: Scrollingmenu("HEATR", 3, "Program", "setProgram", "back", "", "", "", "",  "", "", "", currentMenuItem); break;
+    case 41: Scrollingnumbers("ITEM*",(sizeof(fans)+1), currentMenuItem, 1, 1); break;
+    case 42: Scrollingnumbers("ITEM*", (sizeof(fans)+1), currentMenuItem, 1, 1); break;
+    case 421: Scrollingnumbers("MOD**", 22, currentMenuItem, -10, 1); break;
+    case 4211: Scrollingnumbers("HYST*", 6, currentMenuItem, 1, 1); break;
+*/
+
+//-------------------------------SelectMenu4-----------------------------------------
+//État, setProgram
+case 4 :
+  switch (y) {
+    case 1:
+      switchmenu(41); break;
+    case 2:
+      if (sizeof(fans) == 2){switchmenu(42);}
+      else{switchmenu(0);}
+      break;
+    case 3: switchmenu(0); break;
+  }
+break;
+
+//-------------------------------SelectMenu41-----------------------------------------
+    //PROGRAMME DES CHAUFFERETTES
+    case 41 :
+      if (y < Nbitems) {
+        switch(y){
+          case 1 :
           lcd.noBlink();
           clearPrintTitle();
-          lcd.setCursor(0, 1); lcd.print(F("FOURNAISE(1) : "));
-          if (digitalRead(CHAUFFAGE[0]) == OFF) {
-            lcd.print(F("OFF"));
-          }
-          else {
-            lcd.print(F("ON"));
-          }
-          lcd.setCursor(0, 2); lcd.print(F("Temp. cible : ")); lcd.print(tempCible+EEPROM.read(HMOD)-10); lcd.print(F("C"));
-          lcd.setCursor(0, 3); lcd.print(F("Hysteresis : ")); lcd.print(EEPROM.read(HHYST)); lcd.print(F("C"));
+          lcd.setCursor(0, 1); lcd.print(F("TA: ")); lcd.print(tempCible + hmodE(0)); lcd.print("C");
+          lcd.setCursor(0, 2); lcd.print(F("H: ")); lcd.print(hhystE(0)); lcd.print(F("C"));
           break;
-        case 2:
+          case 2 :
+          lcd.setCursor(0, 1); lcd.print(F("TA: ")); lcd.print(tempCible + hmodE(1)); lcd.print("C");
+          lcd.setCursor(0, 2); lcd.print(F("H: ")); lcd.print(hhystE(1)); lcd.print(F("C"));
+          break;
+        }
+      }
+      else {
+        switchmenu(4);
+      }
+      break;
+    //-------------------------------SelectMenu42-----------------------------------------
+    //SET CHAUFFERETTES PROGRAM
+    case 42 :
+      if (y < Nbitems) {
+        nr = y;
+        switchmenu(421);
+      }
+      else {
+        switchmenu(4);
+      }
+      break;
+    //-------------------------------SelectMenu421-----------------------------------------
+    //SET MOD
+    case 421 :
+      if (y < Nbitems) {
+        mod = y-11;
+        switchmenu(4211);
+      }
+      else {
+        switchmenu(4);
+      }
+      break;
+    //-------------------------------SelectMenu4211-----------------------------------------
+    //SET HYSTERESIS
+    case 4211 :
+      if (y < Nbitems) {
+        hys = y;
+        defineHeater(nr,mod,hys);
+        switchmenu(4);
+      }
+      else {
+        switchmenu(4);
+      }
+      break;
+      /*
+      case 5: Scrollingmenu("PROG*", 3, "Timezones", "setTimezones", "back", "", "", "", "",  "", "", "", currentMenuItem); break;
+      case 51: Scrollingnumbers("TIMZ*",(sizeof(nbPrograms)+1),currentMenuItem, 1, 1);break;
+      case 52: Scrollingnumbers("TIMZ*",(sizeof(nbPrograms)+1),currentMenuItem, 1, 1);break;
+      case 521: Scrollingmenu("ITEM*", 3,"SR", "MANUAL", "SS", "", "", "", "",  "", "", "", currentMenuItem);break;
+      case 5211: Scrollingnumbers("HOUR*",25, currentMenuItem, 1, 1); break;
+      case 52111: Scrollingnumbers("MIN***",62, currentMenuItem, 0 , 1); break;
+      case 5212: Scrollingnumbers("MOD***",122, currentMenuItem, -60 , 1); break;
+      case 521111: Scrollingnumbers("TEMP", 42, currentMenuItem, 0, 1);break;
+*/
+      //-------------------------------SelectMenu5-----------------------------------------
+      //État, setProgram
+      case 5 :
+        switch (y) {
+          case 1:
+            switchmenu(51); break;
+          case 2:
+            if (sizeof(nbPrograms) >= 2){switchmenu(52);}
+            else{switchmenu(0);}
+            break;
+          case 3:
+            if (sizeof(nbPrograms) >= 3){switchmenu(52);}
+            else{switchmenu(0);}
+            break;
+          case 4:
+            if (sizeof(nbPrograms) >= 4){switchmenu(52);}
+            else{switchmenu(0);}
+            break;
+          case 5:
+            if (sizeof(nbPrograms) >= 5){switchmenu(52);}
+            else{switchmenu(0);}
+            break;
+          case 6: switchmenu(0); break;
+        }
+      break;
+
+      //-------------------------------SelectMenu41-----------------------------------------
+    //PROGRAMME DES TIMEZONES
+    case 51 :
+        switch(y){
+          case 1 :
           lcd.noBlink();
           clearPrintTitle();
-          lcd.setCursor(0, 1); lcd.print(F("FOURNAISE(2) : "));
-          if (digitalRead(CHAUFFAGE[1]) == OFF) {
-            lcd.print(F("OFF"));
-          }
-          else {
-            lcd.print(F("ON"));
-          }
-          lcd.setCursor(0, 2); lcd.print(F("Temp. cible : ")); lcd.print(tempCible+EEPROM.read(HMOD+1)-10); lcd.print(F("C"));
-          lcd.setCursor(0, 3); lcd.print(F("Hysteresis : ")); lcd.print(EEPROM.read(HHYST+1)); lcd.print(F("C"));
+          lcd.setCursor(0, 1);
+          lcd.setCursor(0, 2);
           break;
-        case 3: switchmenu(41); break;
-        case 4: switchmenu(42); break;
-        case 5: switchmenu(0); break;
-      }
-      break;
-    //-------------------------------SelectMenu41-----------------------------------------
-    //SET HYSTERESIS
-    case 41 :
-      if (y < Nbitems) {
-        switchmenu(4);
-        EEPROM.update(HHYST, y);
-      }
-      else {
-        switchmenu(4);
-      }
-      break;
-    //-------------------------------SelectMenu42-----------------------------------------
-    //SET HYSTERESIS
-    case 42 :
-      if (y < Nbitems) {
-        switchmenu(4);
-        EEPROM.write(HHYST+1, y);
-      }
-      else {
-        switchmenu(4);
-      }
-      break;
-    //-------------------------------SelectMenu5-----------------------------------------
-    //"Programme 1", "Programme 2", "Programme 3", "Modificateurs" "Set Programme 1", "Set Programme 2", "Set Programme 3", "Set Modificateurs", "back"
-    case 5 :/*
-      switch (y) {
-        case 1:
+          case 2 :
           lcd.noBlink();
           clearPrintTitle();
-          lcd.setCursor(0, 1); lcd.print(F("HD: ")); lcd.print(P[0][HEURE]); lcd.print(F(":")); lcd.print(P[0][MINUTE]); lcd.print(F(" | HF: ")); lcd.print(P[1][HEURE]); lcd.print(F(":")); lcd.print(P[1][MINUTE]);
-          //lcd.setCursor(0, 2); lcd.print(F("TEMP.CIBLE : ")); lcd.print(tempCibleE[0]); lcd.print(F("C"));
-          //lcd.setCursor(0,3); lcd.print(F("RAMPING : "));  lcd.print(ramping); lcd.print(F(" min"));
-          break;
-        case 2:
+          lcd.setCursor(0, 1);
+          lcd.setCursor(0, 2);
+          case 3 :
           lcd.noBlink();
           clearPrintTitle();
-          lcd.setCursor(0, 1); lcd.print(F("HD: ")); lcd.print(P[1][HEURE]); lcd.print(F(":")); lcd.print(P[1][MINUTE]); lcd.print(F(" | HF: ")); lcd.print(P[2][HEURE]); lcd.print(F(":")); lcd.print(P[2][HEURE]);
-          //lcd.setCursor(0, 2); lcd.print(F("TEMP.CIBLE : ")); lcd.print(tempCibleE[1]); lcd.print(F("C"));
-          //lcd.setCursor(0,3); lcd.print(F("RAMPING : "));  lcd.print(RAMPING); lcd.print(F(" min"));
-          break;
-        case 3:
+          lcd.setCursor(0, 1);
+          lcd.setCursor(0, 2);
+          case 4 :
           lcd.noBlink();
           clearPrintTitle();
-          lcd.setCursor(0, 1); lcd.print(F("HD: ")); lcd.print(P[2][HEURE]); lcd.print(F(":")); lcd.print(P[2][HEURE]); lcd.print(F(" | HF: ")); lcd.print(P[0][HEURE]); lcd.print(F(":")); lcd.print(P[0][MINUTE]);
-          //lcd.setCursor(0, 2); lcd.print(F("TEMP.CIBLE : ")); lcd.print(tempCibleE[2]); lcd.print(F("C"));
-          //lcd.setCursor(0,3); lcd.print(F("RAMPING : "));  lcd.print(RAMPING); lcd.print(F(" min"));
-          break;
-        case 4:
+          lcd.setCursor(0, 1);
+          lcd.setCursor(0, 2);
+          case 5 :
           lcd.noBlink();
           clearPrintTitle();
-          lcd.setCursor(0, 1); lcd.print(F("TEMP.CIBLE : ")); lcd.print(tempCible);
-          lcd.setCursor(0, 2); lcd.print(F("RMod:")); lcd.print(EEPROM.read(RMOD)-11);
-          lcd.setCursor(8, 2); lcd.print(F("| HMOD[0]:")); lcd.print(EEPROM.read(HMOD)-11);
-          lcd.setCursor(0, 3); lcd.print(F("VMOD[0]:")); lcd.print(EEPROM.read(VMOD)-11);
-          lcd.setCursor(8, 3); lcd.print(F("| HMOD[1]:")); lcd.print(EEPROM.read(HMOD+1)-11);
+          lcd.setCursor(0, 1);
+          lcd.setCursor(0, 2);
           break;
-        case 5: switchmenu(51); break;
-        case 6: switchmenu(52); break;
-        case 7: switchmenu(53); break;
-        case 8: switchmenu(54); break;
-        case 9: switchmenu(55); break;
-        case 10: switchmenu(0); break;
-      }*/
-      break;
-    //-------------------------------SelectMenu51-----------------------------------------
-    case 51:
-      switch (y) {
-        case 1: switchmenu(511);break;
-        case 2: switchmenu(512); break;
-        case 3: switchmenu(5); break;
-      }
-      break;
-    //-------------------------------SelectMenu511-----------------------------------------
-    //SET MINUTES PAST/BEFORE SUNRISE
-    case 511 :
-      if (y < Nbitems) {
-        EEPROM.write(SSMOD, y);
-        switchmenu(51);
-      }
-      else {
-        switchmenu(51);
-      }
-      break;
-    //-------------------------------SelectMenu512-----------------------------------------
-    //SET tempCible
-    case 512 :
-      if (y < Nbitems) {
-        //tempCibleE[0] = y-1;
-        switchmenu(51);
-        //EEPROM.write(TEMP_CIBLEE, y-1);
-      }
-      else {
-        switchmenu(51);
-      }
+          case 6 :
+          switchmenu(5);
+          break;
+        }
       break;
     //-------------------------------SelectMenu52-----------------------------------------
-    case 52:
-      switch (y) {
-        case 1: switchmenu(521);break;
-        case 2: switchmenu(522); break;
-        case 3: switchmenu(5); break;
+    //SET TIMEZONES PROGRAM
+    case 52 :
+      if (y < Nbitems) {
+        nr = y;
+        switchmenu(521);
+      }
+      else {
+        switchmenu(5);
       }
       break;
     //-------------------------------SelectMenu521-----------------------------------------
+    //SET TYPE
+    case 521 :
+      switch(y){
+        case 1:typ = SR;switchmenu(5212);break;
+        case 2:typ = CLOCK;switchmenu(5211);break;
+        case 3:typ = SS;switchmenu(5212);break;
+        case 4:switchmenu(5);break;
+      }
+      break;
+    //-------------------------------SelectMenu5211-----------------------------------------
     //SET HOUR
-    case 521 :
-      if (y < Nbitems) {
-        //P[1][HEURE] = y;
-        switchmenu(5211);
-        //EEPROM.write(7, P[1][HEURE]);
-      }
-      else {
-        switchmenu(52);
-      }
-      break;
-    //-------------------------------SelectMenu5211-----------------------------------------
+    case 5211 :
+      t = rtc.getTime();
+      sunTime[HEURE] = t.hour;
+      myLord.DST(sunTime);
+        if ((t.hour != sunTime[HEURE]) && (y < Nbitems)) {
+        hr = y-1;
+        switchmenu(52111);
+      }
+      else if ((t.hour == sunTime[HEURE]) && (y < Nbitems)) {
+        hr = y;
+        switchmenu(52111);
+      }
+      else{
+        switchmenu(5);
+      }
+      break;
+    //-------------------------------SelectMenu52111-----------------------------------------
     //SET MINUTES
-    case 5211 :
-      if (y < Nbitems) {
-        //P[1][MINUTE] = (y - 1);
-        switchmenu(52);
-        //EEPROM.write(8, P[1][MINUTE]);
-      }
-      else {
-        switchmenu(52);
-      }
-      break;
-    //-------------------------------SelectMenu522-----------------------------------------
-    //SET tempCible
-    case 522 :
-      if (y < Nbitems) {
-        //tempCibleE[1] = y-1;
-        switchmenu(52);
-        //EEPROM.write(9, tempCibleE[1]);
-      }
-      else {
-        switchmenu(52);
-      }
-      break;
-    //-------------------------------SelectMenu53-----------------------------------------
-    //"Heure", "Tempcible", "back"
-    case 53:
-      switch (y) {
-        case 1: switchmenu(531); break;
-        case 2: switchmenu(532); break;
-        case 3: switchmenu(5); break;
-      }
-      break;
-    //-------------------------------SelectMenu531-----------------------------------------
-    //SET MINUTES PAST/BEFORE SUNSET
-    case 531 :
-      if (y < Nbitems) {
-        //SSMOD[0] = y;
-        //EEPROM.write(10, SSMOD[0]);
-        switchmenu(53);
-      }
-      else {
-        switchmenu(53);
-      }
-      break;
-    //-------------------------------SelectMenu532-----------------------------------------
-    //SET tempCible
-    case 532 :
-      if (y < Nbitems) {
-        //tempCibleE[2] = y-1;
-        switchmenu(53);
-        //EEPROM.write(12, tempCibleE[2]);
-      }
-      else {
-        switchmenu(53);
-      }
-      break;
-    //-------------------------------SelectMenu54-----------------------------------------
-    //
-    case 54:
-      switch (y) {
-        case 1: switchmenu(541); break;
-        case 2: switchmenu(542); break;
-        case 3: switchmenu(543); break;
-        case 4: switchmenu(544); break;
-        case 5: switchmenu(5); break;
-      }
-      break;
-    //-------------------------------SelectMenu541-----------------------------------------
+    case 52111 :
+      if (y < Nbitems) {
+        mn = y - 1;
+        switchmenu(1311);
+      }
+      else {
+        switchmenu(5);
+      }
+      break;
+    //-------------------------------SelectMenu5212-----------------------------------------
     //SET MOD
-    case 541 :
-      if (y < Nbitems) {
-        //tempRollup = tempCible + y -11;
-        switchmenu(54);
-        EEPROM.write(15, y);
-      }
-      else {
-        switchmenu(54);
-      }
-      break;
-    //-------------------------------SelectMenu541-----------------------------------------
-    //SET MOD
-    case 542 :
-      if (y < Nbitems) {
-        switchmenu(54);
-        EEPROM.write(16, y);
-      }
-      else {
-        switchmenu(54);
-      }
-      break;
-    //-------------------------------SelectMenu541-----------------------------------------
-    //SET MOD
-    case 543 :
-      if (y < Nbitems) {
-        switchmenu(54);
-        EEPROM.write(17, y);
-      }
-      else {
-        switchmenu(54);
-      }
-      break;
-    //-------------------------------SelectMenu541-----------------------------------------
-    //SET MOD
-    case 544 :
-      if (y < Nbitems) {
-        switchmenu(54);
-        EEPROM.write(18, y);
-      }
-      else {
-        switchmenu(54);
-      }
-      break;//-------------------------------SelectMenu541-----------------------------------------
-    //SET ramping interval
-    case 55:/*
-    if (y < Nbitems) {
-        RAMPING = y-1;
-        EEPROM.read(RAMPING)*60*1000 = ((unsigned long)y-1)*60*1000;
-        EEPROM.write(19, RAMPING);
+    case 5212 :
+      if (y < Nbitems) {
+        mod = y-60;
+        switchmenu(52111);
+      }
+      else {
         switchmenu(5);
       }
+    break;
+    //-------------------------------SelectMenu521111-----------------------------------------
+    //SET TEMP CIBLE AND UPDATE EEPROM
+    case 521111 :
+      if (y < Nbitems) {
+        tt = y-1;
+        if (typ == CLOCK){
+          defineProgram(nr,typ,hr,mn,tt);
+        }
+        else{
+          defineProgram(nr,typ,0,mod,tt);
+        }
+      }
       else {
         switchmenu(5);
-      }*/
-      break;
-  }
-
-}
+      }
+      break;
+    }
+  }

  //Définition de la température cible
  setTempCible();
  //Définition de la température d'activation des sorties
  getTemperature();
}

void getDateAndTime(){

    unsigned long rampingCounter = millis();
    Serial.println(rampingCounter);
    Serial.println(rampingCounter - lastCount);
    if(rampingCounter - lastCount > rampingE()) {
      lastCount = rampingCounter;
      tempCible += 0.5;
    }
  }
  else if (newTempCible < tempCible){
    unsigned long rampingCounter = millis();
    if(rampingCounter - lastCount > rampingE()) {
      lastCount = rampingCounter;
      tempCible -= 0.5;
    }
