void enter1Script(){
            
  if(setAlert == true){
    
    setAlert = false;
    statusMessage(enter1Pos);
  
  }else{
          
    oldenter1Pos = enter1Pos;
    if(enter1Pos == 3) enter1Pos = 1; // run after standby
    enter1Pos = enter1Pos + 1;
    if (enter1Pos > enterMax-1) enter1Pos = 0;
          
    changeMode(oldenter1Pos, enter1Pos);
    if(enter1Pos == 0){                         //STOP
      enter1Pos0();
    }
    if(enter1Pos == 1){                         //HEAT
      enter1Pos1();
    }
    if(enter1Pos == 2){                         //RUN
      enter1Pos2();
    }
    //if(enter1Pos == 3){                         //STANDBY
    //  enter1Pos3();
    //}
  }
}

void enter1Pos0(){               //STOP
  statusMessage(enter1Pos);
  digitalWrite(vacuum, false);
  pins_up_with_delay= 1;
  Setpoint = 0;
  process_start = false;
  oldtimeCounter0 = timeCounter0;
  timeCounter0 = 0;
  placeValue(0, POSX[1][3]+1, 3, 0, oldtimeCounter0, timeCounter0);                 //place actual procestime on screen
}

void enter1Pos1(){               //HEAT
  PutEeprom();
  statusMessage(enter1Pos);
  pins_up_with_delay= 1;
  //digitalWrite(pins, true);
  digitalWrite(vacuum, false);
  Setpoint = RECIPES[recipeNr0][0];
}

void enter1Pos2(){               //RUN
  statusMessage(enter1Pos);
  digitalWrite(vacuum, true);
  digitalWrite(pins, false);
  oldenter1Pos = enter1Pos;
  Setpoint = RECIPES[recipeNr0][0];
  process_start = true;
}

void enter1Pos3(){               //STANDBY
  statusMessage(enter1Pos);
  process_start = false;
}

void right1Script(){ //configure recipes
  
  changePos(curpos,false);
  curpos = curpos + 1;
  if (curpos > POSX[scrNr][0]-1) curpos = POSX[scrNr][0]-1;
  changePos(curpos,true);
  if (curpos>0) {repeatUpdownKeyblk = true;} else {repeatUpdownKeyblk = false;}
}

void left1Script(){ 
  
  changePos(curpos,false);
  curpos = curpos - 1;
  if (curpos < 0 ){
    curpos = 0;
    if (enter1Pos == 0) mainScreen();
  }
  changePos(curpos,true);
  if (curpos>0) {repeatUpdownKeyblk = true;} else {repeatUpdownKeyblk = false;}
}

void up1Script(){ //configure recipes
  
        if(enter1Pos == 1){                  //HEAT to STOP
          process_start = false;
          oldenter1Pos = enter1Pos;
          enter1Pos = 0;
          changeMode(oldenter1Pos, enter1Pos);
          statusMessage(enter1Pos);
        } else if(enter1Pos == 2){           //RUN to STANDBY
          process_start = false;
          oldenter1Pos = enter1Pos;
          enter1Pos = 3;
          changeMode(oldenter1Pos, enter1Pos);
          statusMessage(enter1Pos);
        //} else if(enter1Pos == 3){           //STNDBY
          //process_start = false;
          //oldenter1Pos = enter1Pos;
          //enter1Pos = 0;
          //changeMode(oldenter1Pos, enter1Pos);
          //statusMessage(enter1Pos);
        } else if(enter1Pos == 3 || enter1Pos == 0){
          if (curpos == 0){
            oldrecipeNr0 = recipeNr0;
            recipeNr0 = recipeNr0 + 1;
            if (recipeNr0 > recipeMax0) recipeNr0 = 0;
            placeValue(2, POSX[1][1]+1, 2, 0, oldrecipeNr0, recipeNr0);           //place set recipe number on screen
            oldtempValue0 = tempValue0; tempValue0 = RECIPES[recipeNr0][0]; placeValue(2, POSX[1][2]+1,  3, 0, oldtempValue0, tempValue0);
            oldtimeValue0 = timeValue0; timeValue0 = RECIPES[recipeNr0][1]; placeValue(2, POSX[1][3]+1, 3, 0, oldtimeValue0, timeValue0);
          }
          if (curpos == 1){
            oldtempValue0 = tempValue0;
            tempValue0 = tempValue0 + 1;
            if (tempValue0 > tempMax0) tempValue0 = 0;
            RECIPES[recipeNr0][0] = tempValue0;
            placeValue(2, POSX[1][2]+1,  3, 0, oldtempValue0, tempValue0);                  //place set temperature on screen
          }
          if (curpos == 2){
            oldtimeValue0 = timeValue0;
            timeValue0 = timeValue0 + 1;
            if (timeValue0 > timeMax0) timeValue0 = 0;
            RECIPES[recipeNr0][1] = timeValue0;
            placeValue(2, POSX[1][3]+1, 3, 0, oldtimeValue0, timeValue0);                 //place actual procestime on screen
          } 
        }
}

void down1Script(){ //configure recipes
  
        if(enter1Pos == 1){                  //HEAT to STOP
          process_start = false;
          oldenter1Pos = enter1Pos;
          enter1Pos = 0;
          changeMode(oldenter1Pos, enter1Pos);
          statusMessage(enter1Pos);
        } else if(enter1Pos == 2){           //RUN to STANDBY
          process_start = false;
          oldenter1Pos = enter1Pos;
          enter1Pos = 3;
          changeMode(oldenter1Pos, enter1Pos);
          statusMessage(enter1Pos);
        //} else if(enter1Pos == 3){           //STANDBY
          //process_start = false;
          //oldenter1Pos = enter1Pos;
          //enter1Pos = 1;
          //changeMode(oldenter1Pos, enter1Pos);
          //statusMessage(enter1Pos);
        } else if(enter1Pos == 3 || enter1Pos == 0){
          if (curpos == 0){
            oldrecipeNr0 = recipeNr0;
            recipeNr0 = recipeNr0 - 1;
            if (recipeNr0 < 0) recipeNr0 = recipeMax0;
            placeValue(2, POSX[1][1]+1,  2, 0, oldrecipeNr0, recipeNr0);                    //place set recipe number on screen
            oldtempValue0 = tempValue0; tempValue0 = RECIPES[recipeNr0][0]; placeValue(2, POSX[1][2]+1,  3, 0, oldtempValue0, tempValue0);
            oldtimeValue0 = timeValue0; timeValue0 = RECIPES[recipeNr0][1]; placeValue(2, POSX[1][3]+1, 3, 0, oldtimeValue0, timeValue0);
          }
          if (curpos == 1){
            oldtempValue0 = tempValue0;
            tempValue0 = tempValue0 - 1;
            if (tempValue0 < 0) tempValue0 = tempMax0;
            RECIPES[recipeNr0][0] = tempValue0;
            placeValue(2, POSX[1][2]+1,  3, 0, oldtempValue0, tempValue0);                  //place set temperature on screen
          }
          if (curpos == 2){
            oldtimeValue0 = timeValue0;
            timeValue0 = timeValue0 - 1;
            if (timeValue0 < 0) timeValue0 = timeMax0;
            RECIPES[recipeNr0][1] = timeValue0;
            placeValue(2, POSX[1][3]+1, 3, 0, oldtimeValue0, timeValue0);                 //place actual procestime on screen
          }
        }
}
