Translate

Wednesday, 14 May 2014

Room Management System – The Menu – part 6


Since we have again plenty of free RAM, today we add the rest of the sub menus. The submenu for room 4 has only one timer. Apart from the updates as explained in the last post, we need to add the info text “NOT USED” to 4 of the available menu points. To make the addition, we go right down to the end of the select menu function and add again below the last mark “submenu end”.

 if(menuOption == 10){ //and menu option is 9 (room 4)

subButton = 0; //resetting the button var

submenu = 1; //submenu counter

lcd.clear(); //clear screen

//retrieving and printing first sub menu point

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[0]))));

lcd.write(pgm_read_byte(&char_table[8])); //printing assigned room number 4

while(submenu < submenus){ //loop through the sub menu points

subButton = read_act_buttons(); //checking for pressed buttons

if(subButton == btnMenu){ //if button Menu was pressed

submenu++; //add 1 - move to the next sub menu point

if(submenu == 2){ //if we are at sub menu 2

lcd.clear();

//retrieve and print second sub menu point

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[1]))));

lcd.write(pgm_read_byte(&char_table[8])); //printing assigned room number 4

lcd.setCursor(0, 1); //set cursor second row, first column

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(msg_table[0])))); //print NOT USED

}

if(submenu == 3){ //if we are at sub menu 3

lcd.clear();

//retrieve and print second sub menu point

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[2]))));

lcd.write(pgm_read_byte(&char_table[8])); //printing assigned room number 4

lcd.setCursor(0, 1); //set cursor second row, first column

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(msg_table[0])))); //print NOT USED

}

if(submenu == 4){ //if we are at sub menu 4

lcd.clear();

//retrieve and print second sub menu point

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[3]))));

lcd.write(pgm_read_byte(&char_table[8])); //printing assigned room number 4

}

if(submenu == 5){ //if we are at sub menu 5

lcd.clear();

//retrieve and print second sub menu point

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[4]))));

lcd.write(pgm_read_byte(&char_table[8])); //printing assigned room number 4

}

if(submenu == 6){ //if we are at sub menu 6

lcd.clear();

//retrieve and print second sub menu point

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[5]))));

lcd.write(pgm_read_byte(&char_table[8])); //printing assigned room number 4

lcd.setCursor(0, 1); //set cursor second row, first column

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(msg_table[0])))); //print NOT USED

}

if(submenu == 7){ //if we are at sub menu 7

lcd.clear();

//retrieve and print second sub menu point

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[6]))));

lcd.write(pgm_read_byte(&char_table[8])); //printing assigned room number 4

lcd.setCursor(0, 1); //set cursor second row, first column

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(msg_table[0])))); //print NOT USED

}

}

if(subButton == btnSelect){ //if we pressed btnSelect

if(submenu == 1){ //and submenu is 1

//call the function get_delay() to change the setting

delayTime[0] = get_delay(9, 4, dLiving);

return;

}

if(submenu == 2) return;

if(submenu == 3) return;

if(submenu == 4){ //and submenu is 4

//call the function get_offon() to change the setting

room401Active = get_offon(11, 4, room401Active);

return;

}

if(submenu == 5){ //and submenu is 5

//call the function get_setTime() to change timer 2

get_setTime(room4On[0], room4On[1],

room4Off[0], room4Off[1], 32);

return;

}

if(submenu == 6) return;

if(submenu == 7) return;

}

}

} //submenu end

Now we go to the end of the get_setTime() function and add:

if(room == 23){ room3On2[0] = onTimeH; room3On2[1] = onTimeM; room3Off2[0] = offTimeH; room3Off2[1] = offTimeM; } //>>>>>>>>>>>>>Addition starts here<<<<<<<<<<<<< if(room == 32){ room4On[0] = onTimeH; room4On[1] = onTimeM; room4Off[0] = offTimeH; room4Off[1] = offTimeM; } //>>>>>>>>>>>>>Addition ends here<<<<<<<<<<<<< return 0; } } } } } } }

We carry on with the sub menu for room 5, which goes again right below the }//submenu end” mark of the last sub menu in the function selectMenu().

if(menuOption == 11){ //and menu option is 11 (room 5)

subButton = 0; //resetting the button var

submenu = 1; //submenu counter

lcd.clear(); //clear screen

//retrieving and printing first sub menu point

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[0]))));

lcd.write(pgm_read_byte(&char_table[9])); //printing assigned room number 2

while(submenu < submenus){ //loop through the sub menu points

subButton = read_act_buttons(); //checking for pressed buttons

if(subButton == btnMenu){ //if button Menu was pressed

submenu++; //add 1 - move to the next sub menu point

if(submenu == 2){ //if we are at sub menu 2

lcd.clear();

//retrieve and print second sub menu point

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[1]))));

lcd.write(pgm_read_byte(&char_table[9])); //printing assigned room number 2

}

if(submenu == 3){ //if we are at sub menu 3

lcd.clear();

//retrieve and print second sub menu point

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[2]))));

lcd.write(pgm_read_byte(&char_table[9])); //printing assigned room number 2

}

if(submenu == 4){ //if we are at sub menu 4

lcd.clear();

//retrieve and print second sub menu point

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[3]))));

lcd.write(pgm_read_byte(&char_table[9])); //printing assigned room number 2

}

if(submenu == 5){ //if we are at sub menu 5

lcd.clear();

//retrieve and print second sub menu point

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[4]))));

lcd.write(pgm_read_byte(&char_table[9])); //printing assigned room number 2

}

if(submenu == 6){ //if we are at sub menu 6

lcd.clear();

//retrieve and print second sub menu point

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[5]))));

lcd.write(pgm_read_byte(&char_table[9])); //printing assigned room number 2

lcd.setCursor(0, 1);

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(msg_table[0]))));

}

if(submenu == 7){ //if we are at sub menu 7

lcd.clear();

//retrieve and print second sub menu point

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[6]))));

lcd.write(pgm_read_byte(&char_table[9])); //printing assigned room number 2

lcd.setCursor(0, 1);

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(msg_table[0]))));

}

}

if(subButton == btnSelect){ //if we pressed btnSelect

if(submenu == 1){ //and submenu is 1

//call the function get_delay() to change the setting

delayTime[0] = get_delay(9, 5, dBath1);

return;

}

if(submenu == 2){ //and sub menu is 2

//call the function get_offon to change the setting

room5MActive = get_offon(10, 5, room5MActive);

return;

}

if(submenu == 3){ //and submenu is 3

//call the function get_setTime() to change timer 1

get_setTime(room5OnM[0], room5OnM[1],

room5OffM[0], room5OffM[1], 41);

return;

}

if(submenu == 4){ //and submenu is 4

//call the function get_offon() to change the setting

room501Active = get_offon(11, 5, room501Active);

return;

}

if(submenu == 5){ //and submenu is 5

//call the function get_setTime() to change timer 2

get_setTime(room5On[0], room5On[1],

room5Off[0], room5Off[1], 42);

return;

}

if(submenu == 6)return;

if(submenu == 7)return;

}

}

} //submenu end

And again, we jump back into the end of the function get_setTime() where we add the little statement to pass the updated variables back.

if(room == 32){

room4On[0] = onTimeH;

room4On[1] = onTimeM;

room4Off[0] = offTimeH;

room4Off[1] = offTimeM;

}

//>>>>>>>>>>>>>Addition starts here<<<<<<<<<<<<<

if(room == 41){

room5OnM[0] = onTimeH;

room5OnM[1] = onTimeM;

room5OffM[0] = offTimeH;

room5OffM[1] = offTimeM;

}

if(room == 42){

room5On[0] = onTimeH;

room5On[1] = onTimeM;

room5Off[0] = offTimeH;

room5Off[1] = offTimeM;

}

//>>>>>>>>>>>>>Addition ends here<<<<<<<<<<<<<<

return 0;

}

}

}

}

}

}

}

Moving on to room 6 and add again the submenu right under the mark “}//submenu end” of room 5 submenu.

     if(menuOption == 11){ //and menu option is 11 (room 5)
        subButton = 0;        //resetting the button var
        submenu = 1;       //submenu counter
        lcd.clear();       //clear screen
        //retrieving and printing first sub menu point
        lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[0]))));
        lcd.write(pgm_read_byte(&char_table[10]));    //printing assigned room number 6
        while(submenu < submenus){ //loop through the sub menu points
          subButton = read_act_buttons();  //checking for pressed buttons
          if(subButton == btnMenu){   //if button Menu was pressed
            submenu++;               //add 1 - move to the next sub menu point
            if(submenu == 2){      //if we are at sub menu 2
              lcd.clear(); 
              //retrieve and print second sub menu point
              lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[1]))));
              lcd.write(pgm_read_byte(&char_table[10]));    //printing assigned room number 6
            }
            if(submenu == 3){      //if we are at sub menu 3
              lcd.clear(); 
              //retrieve and print second sub menu point
              lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[2]))));
              lcd.write(pgm_read_byte(&char_table[10]));    //printing assigned room number 6
            }
            if(submenu == 4){      //if we are at sub menu 4
              lcd.clear(); 
              //retrieve and print second sub menu point
              lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[3]))));
              lcd.write(pgm_read_byte(&char_table[10]));    //printing assigned room number 6
            }
            if(submenu == 5){      //if we are at sub menu 5
              lcd.clear(); 
              //retrieve and print second sub menu point
              lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[4]))));
              lcd.write(pgm_read_byte(&char_table[10]));    //printing assigned room number 6
            }
            if(submenu == 6){      //if we are at sub menu 6
              lcd.clear(); 
              //retrieve and print second sub menu point
              lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[5]))));
              lcd.write(pgm_read_byte(&char_table[10]));    //printing assigned room number 6
              lcd.setCursor(0, 1);
              lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(msg_table[0]))));
            }
            if(submenu == 7){      //if we are at sub menu 7
              lcd.clear(); 
              //retrieve and print second sub menu point
              lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[6]))));
              lcd.write(pgm_read_byte(&char_table[10]));    //printing assigned room number 6
              lcd.setCursor(0, 1);
              lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(msg_table[0]))));
            }
          }
          if(subButton == btnSelect){   //if we pressed btnSelect
            if(submenu == 1){           //and submenu is 1
              //call the function get_delay() to change the setting
              delayTime[5] = get_delay(9, 6, dBath2);
              return;
            }
            if(submenu == 2){           //and sub menu is 2
              //call the function get_offon to change the setting
              room6MActive = get_offon(10, 6, room6MActive);
              return;
            }
            if(submenu == 3){           //and submenu is 3
              //call the function get_setTime() to change timer 1
              get_setTime(room6OnM[0], room6OnM[1],
                           room6OffM[0], room6OffM[1], 51);
              return;
            }
            if(submenu == 4){           //and submenu is 4
              //call the function get_offon() to change the setting
              room601Active = get_offon(11, 6, room601Active);
              return;
            }
            if(submenu == 5){           //and submenu is 5
              //call the function get_setTime() to change timer 2
              get_setTime(room6On[0], room6On[1],
                           room6Off[0], room6Off[1], 62);
              return;
            }
            if(submenu == 6)return;
            if(submenu == 7)return;
          }
        }
      } //submenu end

and as usual, we go back to the end of the get_setTime() function to add the statements passing back the updated variables.

if(room == 42){

room5On[0] = onTimeH;

room5On[1] = onTimeM;

room5Off[0] = offTimeH;

room5Off[1] = offTimeM;

}

//>>>>>>>>>>>>>Addition starts here<<<<<<<<<<<<<

if(room == 51){

room6OnM[0] = onTimeH;

room6OnM[1] = onTimeM;

room6OffM[0] = offTimeH;

room6OffM[1] = offTimeM;

}

if(room == 52){

room6On[0] = onTimeH;

room6On[1] = onTimeM;

room6Off[0] = offTimeH;

room6Off[1] = offTimeM;

}

//>>>>>>>>>>>>>Addition ends here<<<<<<<<<<<<<

return 0;

}

}

}

}

}

}

}

The same thing goes for room 7. Back at the end of the selectMenu() function:

if(menuOption == 13){ //and menu option is 13 (room 7)

subButton = 0; //resetting the button var

submenu = 1; //submenu counter

lcd.clear(); //clear screen

//retrieving and printing first sub menu point

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[0]))));

lcd.write(pgm_read_byte(&char_table[11])); //printing assigned room number 7

while(submenu < submenus){ //loop through the sub menu points

subButton = read_act_buttons(); //checking for pressed buttons

if(subButton == btnMenu){ //if button Menu was pressed

submenu++; //add 1 - move to the next sub menu point

if(submenu == 2){ //if we are at sub menu 2

lcd.clear();

//retrieve and print second sub menu point

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[1]))));

lcd.write(pgm_read_byte(&char_table[11])); //printing assigned room number 7

}

if(submenu == 3){ //if we are at sub menu 3

lcd.clear();

//retrieve and print second sub menu point

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[2]))));

lcd.write(pgm_read_byte(&char_table[11])); //printing assigned room number 7

}

if(submenu == 4){ //if we are at sub menu 4

lcd.clear();

//retrieve and print second sub menu point

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[3]))));

lcd.write(pgm_read_byte(&char_table[11])); //printing assigned room number 7

}

if(submenu == 5){ //if we are at sub menu 5

lcd.clear();

//retrieve and print second sub menu point

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[4]))));

lcd.write(pgm_read_byte(&char_table[11])); //printing assigned room number 7

}

if(submenu == 6){ //if we are at sub menu 6

lcd.clear();

//retrieve and print second sub menu point

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[5]))));

lcd.write(pgm_read_byte(&char_table[11])); //printing assigned room number 7

lcd.setCursor(0, 1);

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(msg_table[0]))));

}

if(submenu == 7){ //if we are at sub menu 7

lcd.clear();

//retrieve and print second sub menu point

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[6]))));

lcd.write(pgm_read_byte(&char_table[11])); //printing assigned room number 7

lcd.setCursor(0, 1);

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(msg_table[0]))));

}

}

if(subButton == btnSelect){ //if we pressed btnSelect

if(submenu == 1){ //and submenu is 1

//call the function get_delay() to change the setting

delayTime[6] = get_delay(9, 7, dBath3);

return;

}

if(submenu == 2){ //and sub menu is 2

//call the function get_offon to change the setting

room7MActive = get_offon(10, 7, room7MActive);

return;

}

if(submenu == 3){ //and submenu is 3

//call the function get_setTime() to change timer 1

get_setTime(room7OnM[0], room7OnM[1],

room7OffM[0], room7OffM[1], 61);

return;

}

if(submenu == 4){ //and submenu is 4

//call the function get_offon() to change the setting

room701Active = get_offon(11, 7, room701Active);

return;

}

if(submenu == 5){ //and submenu is 5

//call the function get_setTime() to change timer 2

get_setTime(room7On[0], room7On[1],

room7Off[0], room7Off[1], 62);

return;

}

if(submenu == 6)return;

if(submenu == 7)return;

}

}

} //submenu end

and the addition again in the get_setTime() function:


if(room == 52){

room6On[0] = onTimeH;

room6On[1] = onTimeM;

room6Off[0] = offTimeH;

room6Off[1] = offTimeM;

}

//>>>>>>>>>>>>>Addition starts here<<<<<<<<<<<<<

if(room == 61){

room7OnM[0] = onTimeH;

room7OnM[1] = onTimeM;

room7OffM[0] = offTimeH;

room7OffM[1] = offTimeM;

}

if(room == 62){

room7On[0] = onTimeH;

room7On[1] = onTimeM;

room7Off[0] = offTimeH;

room7Off[1] = offTimeM;

}

//>>>>>>>>>>>>>Addition ends here<<<<<<<<<<<<<

return 0;

}

}

}

}

}

}

}

Here we go for room 8

if(menuOption == 14){ //and menu option is 13 (room 8)

subButton = 0; //resetting the button var

submenu = 1; //submenu counter

lcd.clear(); //clear screen

//retrieving and printing first sub menu point

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[0]))));

lcd.write(pgm_read_byte(&char_table[12])); //printing assigned room number 7

while(submenu < submenus){ //loop through the sub menu points

subButton = read_act_buttons(); //checking for pressed buttons

if(subButton == btnMenu){ //if button Menu was pressed

submenu++; //add 1 - move to the next sub menu point

if(submenu == 2){ //if we are at sub menu 2

lcd.clear();

//retrieve and print second sub menu point

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[1]))));

lcd.write(pgm_read_byte(&char_table[12])); //printing assigned room number 7

}

if(submenu == 3){ //if we are at sub menu 3

lcd.clear();

//retrieve and print second sub menu point

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[2]))));

lcd.write(pgm_read_byte(&char_table[12])); //printing assigned room number 7

}

if(submenu == 4){ //if we are at sub menu 4

lcd.clear();

//retrieve and print second sub menu point

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[3]))));

lcd.write(pgm_read_byte(&char_table[12])); //printing assigned room number 7

}

if(submenu == 5){ //if we are at sub menu 5

lcd.clear();

//retrieve and print second sub menu point

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[4]))));

lcd.write(pgm_read_byte(&char_table[12])); //printing assigned room number 7

}

if(submenu == 6){ //if we are at sub menu 6

lcd.clear();

//retrieve and print second sub menu point

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[5]))));

lcd.write(pgm_read_byte(&char_table[12])); //printing assigned room number 7

lcd.setCursor(0, 1);

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(msg_table[0]))));

}

if(submenu == 7){ //if we are at sub menu 7

lcd.clear();

//retrieve and print second sub menu point

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[6]))));

lcd.write(pgm_read_byte(&char_table[12])); //printing assigned room number 7

lcd.setCursor(0, 1);

lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(msg_table[0]))));

}

}

if(subButton == btnSelect){ //if we pressed btnSelect

if(submenu == 1){ //and submenu is 1

//call the function get_delay() to change the setting

delayTime[7] = get_delay(9, 8, dBath4);

return;

}

if(submenu == 2){ //and sub menu is 2

//call the function get_offon to change the setting

room8MActive = get_offon(10, 8, room8MActive);

return;

}

if(submenu == 3){ //and submenu is 3

//call the function get_setTime() to change timer 1

get_setTime(room8OnM[0], room8OnM[1],

room8OffM[0], room8OffM[1], 71);

return;

}

if(submenu == 4){ //and submenu is 4

//call the function get_offon() to change the setting

room801Active = get_offon(11, 8, room801Active);

return;

}

if(submenu == 5){ //and submenu is 5

//call the function get_setTime() to change timer 2

get_setTime(room8On[0], room8On[1],

room8Off[0], room8Off[1], 72);

return;

}

if(submenu == 6)return;

if(submenu == 7)return;

}

}

} //submenu end

and again the addition in the get_setTime() function

if(room == 62){

room7On[0] = onTimeH;

room7On[1] = onTimeM;

room7Off[0] = offTimeH;

room7Off[1] = offTimeM;

}

//>>>>>>>>>>>>>Addition starts here<<<<<<<<<<<<<

if(room == 72){

room8On[0] = onTimeH;

room8On[1] = onTimeM;

room8Off[0] = offTimeH;

room8Off[1] = offTimeM;

}

//>>>>>>>>>>>>>Addition ends here<<<<<<<<<<<<<

return 0;

}

}

}

}

}

}

}

back to the end of selectMenu() for room 9


      if(menuOption == 15){ //and menu option is 15 (room 9)
        subButton = 0;        //resetting the button var
        submenu = 1;       //submenu counter
        lcd.clear();       //clear screen
        //retrieving and printing first sub menu point
        lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[0]))));
        lcd.write(pgm_read_byte(&char_table[13]));    //printing assigned room number 7
        while(submenu < submenus){ //loop through the sub menu points
          subButton = read_act_buttons();  //checking for pressed buttons
          if(subButton == btnMenu){   //if button Menu was pressed
            submenu++;               //add 1 - move to the next sub menu point
            if(submenu == 2){      //if we are at sub menu 2
              lcd.clear(); 
              //retrieve and print second sub menu point
              lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[1]))));
              lcd.write(pgm_read_byte(&char_table[13]));    //printing assigned room number 7
            }
            if(submenu == 3){      //if we are at sub menu 3
              lcd.clear(); 
              //retrieve and print second sub menu point
              lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[2]))));
              lcd.write(pgm_read_byte(&char_table[13]));    //printing assigned room number 7
            }
            if(submenu == 4){      //if we are at sub menu 4
              lcd.clear(); 
              //retrieve and print second sub menu point
              lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[3]))));
              lcd.write(pgm_read_byte(&char_table[13]));    //printing assigned room number 7
            }
            if(submenu == 5){      //if we are at sub menu 5
              lcd.clear(); 
              //retrieve and print second sub menu point
              lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[4]))));
              lcd.write(pgm_read_byte(&char_table[13]));    //printing assigned room number 7
            }
            if(submenu == 6){      //if we are at sub menu 6
              lcd.clear(); 
              //retrieve and print second sub menu point
              lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[5]))));
              lcd.write(pgm_read_byte(&char_table[13]));    //printing assigned room number 7
              lcd.setCursor(0, 1);
              lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(msg_table[0]))));
            }
            if(submenu == 7){      //if we are at sub menu 7
              lcd.clear(); 
              //retrieve and print second sub menu point
              lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(submenu_table[6]))));
              lcd.write(pgm_read_byte(&char_table[13]));    //printing assigned room number 7
              lcd.setCursor(0, 1);
              lcd.print(strcpy_P(buffer, (char*)pgm_read_word(&(msg_table[0]))));
            }
          }
          if(subButton == btnSelect){   //if we pressed btnSelect
            if(submenu == 1){           //and submenu is 1
              //call the function get_delay() to change the setting
              delayTime[8] = get_delay(9, 9, dKitchen);
              return;
            }
            if(submenu == 2){           //and sub menu is 2
              //call the function get_offon to change the setting
              room9MActive = get_offon(10, 9, room9MActive);
              return;
            }
            if(submenu == 3){           //and submenu is 3
              //call the function get_setTime() to change timer 1
              get_setTime(room9OnM[0], room9OnM[1],
                           room9OffM[0], room9OffM[1], 91);
              return;
            }
            if(submenu == 4){           //and submenu is 4
              //call the function get_offon() to change the setting
              room901Active = get_offon(11, 9, room901Active);
              return;
            }
            if(submenu == 5){           //and submenu is 5
              //call the function get_setTime() to change timer 2
              get_setTime(room9On[0], room9On[1],
                           room9Off[0], room9Off[1], 92);
              return;
            }
            if(submenu == 6)return;
            if(submenu == 7)return;
          }
        }
      } //submenu end

and the addition in the get_setTime() function.


if(room == 72){

room8On[0] = onTimeH;

room8On[1] = onTimeM;

room8Off[0] = offTimeH;

room8Off[1] = offTimeM;

}

//>>>>>>>>>>>>>Addition starts here<<<<<<<<<<<<<

if(room == 81){

room9OnM[0] = onTimeH;

room9OnM[1] = onTimeM;

room9OffM[0] = offTimeH;

room9OffM[1] = offTimeM;

}

if(room == 82){

room9On[0] = onTimeH;

room9On[1] = onTimeM;

room9Off[0] = offTimeH;

room9Off[1] = offTimeM;

}

//>>>>>>>>>>>>>>Addition ends here<<<<<<<<<<<<<

return 0;

}

}

}

}

}

}

}

Got it so far. We have nearly a complete menu. Now I just realised, that I forgot to add room no 10 to the menu. I know, usually corridors are dark little rooms connecting the rest of the house without windows and there is now real need for setting up timers etc. but we still would like to be able to adjust the delay timer to our personal needs.
Since this post is already pretty long again, we add the corridor in the next post. Since we are pretty good with the lights now, I also would like to add a little more control to the AC's. Than again, there is a little cleaning up to do and I am still working on using the EEPROM memory to store the variables also being changed in the menu.

No comments:

Post a Comment