Library which creates a serial test console, it supports pages and menu items. The items are added and the pages are added as necessary when the user sets it up. This is a great too for creating an easy to maintain menu system, whether for a test sytem, or anything else.
Dependencies: Terminal
Revision 9:b1fdd7ea6f72, committed 2015-07-24
- Comitter:
- glansberry
- Date:
- Fri Jul 24 22:18:19 2015 +0000
- Parent:
- 8:170f8c0bb5ee
- Commit message:
- Fixed bug is choosing the first page.
Changed in this revision
testconsole.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/testconsole.cpp Fri May 08 22:25:27 2015 +0000 +++ b/testconsole.cpp Fri Jul 24 22:18:19 2015 +0000 @@ -7,10 +7,10 @@ current_page(0) { term.baud(baud_rate); - active_page = page[current_page]; // term.printf("TestConsole::TestConsole('%')\r\n",name); term.HideCursor(); - for(int i = 0; i < MAX_PAGES; i++) page[i] = NULL; //init all pages to NULL + for(int i = 0; i < MAX_PAGES; i++) page[i] = NULL; //init all pages to NULL + active_page = page[current_page]; } @@ -93,12 +93,17 @@ //go through the list of pages, and see if any are set to become active for(int index=0; index < num_pages; index++){ - if(active_page->check_active()){ + if(page[index]->check_active()){ page_change(index); } } - - active_page->update(); + if(active_page != NULL) + { + active_page->update(); + } else + { + term.printf("invalid page %p", active_page); + } return 0; }