Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
David Good
07/02/10 10:24
Read: 900 times
Irving, Tx
USA


 
#177064 - Uart user menu via switch/case state machine
I'm implementing a user menu in my project to show logs, change settings, etc... Currently the user menu is a frequently called task from main in a round robin style multitasking environment. The menu itself is a state machine that either prints or looks for input and then exits.

This user menu function is getting quite large, and the general wisdom is to break up functions larger than (your favorite arbitrary line count here). Each state is a page or less with non-state related actions broken out into functions (user input and validations routines for instance), but the collection of states is growing quickly as more menu items are needed.

I have two questions.

1> Is there any value in breaking up a state machine even though it spans multiple pages? It might be a little more "presentable" but adds more overhead in additional state variables and return value checks.

2> Is a state machine the a good way to code multi-level user menus? It was my first inclination, and does work, but if there is a more industry standard way to do such things, I'd like to know.

These questions are very implementation-specific I know, so I'm just looking for the best general discussion we can have on this while lacking details.

Thanks all!

--David

List of 29 messages in thread
TopicAuthorDate
Uart user menu via switch/case state machine      David Good      07/02/10 10:24      
   State machine can be small.      Per Westermark      07/02/10 10:37      
   My take....      Michael Karas      07/02/10 10:57      
   asked and answered      Erik Malund      07/02/10 10:57      
      Broken and Fixed      David Good      08/26/10 13:52      
         excellent      Erik Malund      08/26/10 14:14      
            My experience as well....      Michael Karas      08/26/10 15:28      
               My experience as well....      Erik Malund      08/26/10 15:37      
               But you're the writer...      Justin Fontes      08/26/10 15:52      
                  out of context      Erik Malund      08/26/10 17:55      
                     Yes, Chances are no one else will see your code      Justin Fontes      08/26/10 18:53      
                        male cow manure      Erik Malund      08/26/10 20:30      
                           Don't be too over confident      Justin Fontes      08/26/10 22:32      
                  Just Concepts      Michael Karas      08/26/10 22:41      
                     Don't think own code is the best      Per Westermark      08/27/10 07:36      
                     exactly      Erik Malund      08/27/10 07:49      
                        what I have done a lot of lately is      Erik Malund      08/27/10 07:54      
   Protothreads???      Murray R. Van Luyn      07/02/10 20:31      
   A case for a CASE tool?      Murray R. Van Luyn      07/03/10 19:57      
      Using a tool like that........      Michael Karas      07/04/10 00:24      
         Thanks Michael...      Murray R. Van Luyn      07/04/10 02:37      
            Pencil and paper      Andy Neil      07/05/10 08:26      
      Pros and Cons      Oliver Sedlacek      07/05/10 04:37      
         Analysis/Design      Andy Neil      07/05/10 06:19      
            Enterprise Architect      Michael Karas      07/05/10 11:58      
               RE: Enterprise Architect      Andy Neil      07/05/10 15:15      
                  Reverse State Tables      Michael Karas      07/05/10 20:07      
                     RE: "Reverse-engineering"      Andy Neil      07/06/10 04:59      
                        php and html when documenting      Per Westermark      07/06/10 08:49      

Back to Subject List