LCD Menu Structure

Hi All,

I am moving closer and closer to getting my project finished which is fantastic, I will be happy to get something complete and will post pictures and so on when I finish.

Anyway, I am now up to requesting user input through a LCD/Keypad shield. At the moment I have a top level menu like the below;

Select Program:
1.360 Pano
2. Gigapan Img

If I select 1, it runs through a function that requires no user input and works fine, however for section 2 that requires a bit more user input.

The questions I need to ask are,

  1. Start X,Y position (e.g. top left corner)
  2. Bottom X,Y position (e.g. Bottom Right Corner)
  3. Lens Focal Length

The way I have done it at the moment is to have MenuSelected = 0 if the menu is at the top level then when a button is pressed it checks the MenuSelected variable, and if variable is 1 then it fires the 360 pano function, but if it gets moved to 2 then it would go to the gigapan img function.

The thing is I need to ask more questions of the user, is it best to just add more levels of the MenuSelected variable, e.g. if it is 1 do the normal function, if it is 2 then do the gigapan function, once it gets to 3 start to ask the X,Y positions, if it is 4 ask the X,Y position, and if it is 5 ask the focal length or is there a better way to do this?

The actual gigapan function I have takes the inputs, so once I have the questions answered (e.g. in the loop) it can call the function no issues, I am just not 100% sure how to best ask the questions.

If i have done it wrong I am happy to go back to the drawing board, but essentially the flow is like this:

Welcome Screen
Select Menu
- 360 Pano - (if selected) ---> Start 360 Pano Function
- Gigapixel Image --|
                           |- Enter Start X,Y
                           |- Enter Finish X,Y
                           |- Enter Focal Length
                                                      |---> Start Gigapan Function

Please post your code in code tags with the </> button in the editor.