CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Menus and submenus

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
tonkostz



Joined: 07 May 2011
Posts: 40
Location: Bulgaria

View user's profile Send private message

Menus and submenus
PostPosted: Tue Mar 13, 2012 6:13 am     Reply with quote

I have a menu with several submenus.
Example:

1.main menu
1.1. submenu
1.1.1.subsubmenu

From main menu i enter submenu1 with an enter button press.The problem is if i hold the button for a while, i enter directly the subsubmenu.
I want when i press the button briefly or hold it to enter only the submenu.When i release the button and make a second press to enter the subsubmenu.
I use a previous button too.
I think i should give to each submenu a unique address and call it when i need it but i don't now how.

Here is my button code for enter and previous buttons.
I use flag_enter_prev_main for the result of enter and previous button presses.

Code:

//these are enter(C3) and previous(C0) buttons
    if(!input(PIN_C3) && status_enter_prev_main==0) //enter button
    {
      flag_prev_main=0;
      flag_enter_main=1;
      status_enter_prev_main=1;
      delay_ms(100);
    }
    if(!input(PIN_C0) && status_enter_prev_main==0) //previous button
    {
      flag_enter_main=0;
      flag_prev_main=1;
      status_enter_prev_main=0;
      delay_ms(100);
    } 
     
    if(input(PIN_C3) && input(PIN_C0))
    {               
      status_enter_prev_main=0;
    }
    flag_enter_prev_main=!flag_prev_main && flag_enter_main;
    //end of enter and previous buttons     
dezso



Joined: 04 Mar 2010
Posts: 102

View user's profile Send private message

PostPosted: Tue Mar 13, 2012 9:31 am     Reply with quote

Code:
while(!input(PIN_C3)        // Loop here until button released.
{
      delay_ms(50);
}

Add this after your button check code
if(......
_________________
I'm could be wrong many time's, at least I know what I'm doing Smile
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group