chipKIT® Development Platform

Inspired by Arduino™

Menu Entering problem

Created Wed, 26 Feb 2014 13:57:48 +0000 by ajitnayak


ajitnayak

Wed, 26 Feb 2014 13:57:48 +0000

Dear all,

Display section working fine , but could not able to enter the Set perameter menu from Begining. Every time i need to enter the display parameter and then enter into set parameter function .

void lcd_call()
{
  int button = 0; 
  menuOption = 1;
  lcdClear();
  lcd.print("MENU DISPLAY:");

  while (menuOption <= menuOptions)
  {

    button = read_LCD_buttons();
    if (button == btnRIGHT)
    {
      //timedBeep(shortBeep,1);   
      menuOption++;
      if (menuOption == 2)
      {
        lcdClear();
        lcd.print("DISPLAY:");  
        button = read_LCD_buttons();


        while((button = read_LCD_buttons()) != btnLEFT)
        {
          Serial.println(button);
          DS_Counter=Display_selection();
          switch(DS_Counter)
          {
          case 1:  
            lcd.setCursor(0,0); 
            digitalClockDisplay();
            timedBeep(shortBeep,1);  
            break;
          case 2: 
            lcd.setCursor(0,0);
            Display_angle();
            timedBeep(shortBeep,1); 
            break;
          case 3: 
            lcd.setCursor(0,0);
            Display_coordinate();
            timedBeep(shortBeep,1);
            break;
          case 4:
            lcd.setCursor(0,0);
            Display_Wind();
            timedBeep(shortBeep,1);
            break;
          case 5: 
            break;   
          }
          Serial.println(button);                          
        }

        menuOption++;


      }
      if (menuOption == 3)
      {
        int button1;
        lcdClear();
        lcd.print("SET PARAMETER");
        button1 = read_LCD_buttons();
        while(Set_Counter<5)
        {
          Serial.println(button1);
          Set_Counter=Select_section();

          switch(Set_Counter)
          {
          case 1:           
            if(button1 ==btnRIGHT)
            {
              Set_Counter++; 
              //Set_flag=1; 
            }
            else
            {
              lcd.setCursor(0,0); 
              setDateTime();
              timedBeep(shortBeep,1);
              button1 = read_LCD_buttons();
            }
            break;
          case 2: 
            lcd.setCursor(0,0);
            set_latitude();
            timedBeep(shortBeep,1); 




          case 3: 
            lcd.setCursor(0,0);
            set_longitude() ;
            timedBeep(shortBeep,1);
            Set_Counter+1; 
            break;
          case 4:
            lcd.setCursor(0,0);
            set_trackertime();
            timedBeep(shortBeep,1);
            Set_Counter+1; 
            break;
          case 5: 
            break;   
          }
          Serial.println(button1); 
          Set_Counter=Select_section();  
          //Set_flag=0;        
        }
        // menuOption++;
      }
      if(menuOption == 4)
      {
        lcdClear();
        lcd.print("EXIT WINDOW");
      }   
    }
  }



}

Jacob Christ

Fri, 28 Feb 2014 07:59:20 +0000

Comment out second occurance of menuOption++ in this code. It occures twice and which causes it to nnever be equal to 3.

Jacob