Release 1.01
DisplayCodesMenu.cpp@3:8395f7ab6d3e, 2019-07-25 (annotated)
- Committer:
- foxbrianr
- Date:
- Thu Jul 25 00:42:49 2019 +0000
- Revision:
- 3:8395f7ab6d3e
- Child:
- 4:7226c43320b5
Baseline for testing
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
foxbrianr | 3:8395f7ab6d3e | 1 | #include "mbed.h" |
foxbrianr | 3:8395f7ab6d3e | 2 | #include "DisplayCodesMenu.h" |
foxbrianr | 3:8395f7ab6d3e | 3 | #include "TimeUtilities.h" |
foxbrianr | 3:8395f7ab6d3e | 4 | |
foxbrianr | 3:8395f7ab6d3e | 5 | |
foxbrianr | 3:8395f7ab6d3e | 6 | DisplayCodesMenu::DisplayCodesMenu(string id): Menu(id) |
foxbrianr | 3:8395f7ab6d3e | 7 | { |
foxbrianr | 3:8395f7ab6d3e | 8 | |
foxbrianr | 3:8395f7ab6d3e | 9 | active_selection = 0; |
foxbrianr | 3:8395f7ab6d3e | 10 | row=0; |
foxbrianr | 3:8395f7ab6d3e | 11 | column=0; |
foxbrianr | 3:8395f7ab6d3e | 12 | update_needed=1; |
foxbrianr | 3:8395f7ab6d3e | 13 | current_line=0; |
foxbrianr | 3:8395f7ab6d3e | 14 | |
foxbrianr | 3:8395f7ab6d3e | 15 | } |
foxbrianr | 3:8395f7ab6d3e | 16 | |
foxbrianr | 3:8395f7ab6d3e | 17 | void DisplayCodesMenu::display(LCD * lcd) |
foxbrianr | 3:8395f7ab6d3e | 18 | { |
foxbrianr | 3:8395f7ab6d3e | 19 | |
foxbrianr | 3:8395f7ab6d3e | 20 | char buf[40]; |
foxbrianr | 3:8395f7ab6d3e | 21 | |
foxbrianr | 3:8395f7ab6d3e | 22 | if (update_needed) |
foxbrianr | 3:8395f7ab6d3e | 23 | { |
foxbrianr | 3:8395f7ab6d3e | 24 | |
foxbrianr | 3:8395f7ab6d3e | 25 | lcd->cls(); |
foxbrianr | 3:8395f7ab6d3e | 26 | lcd->writeLine(0,"ID | ## | Time"); |
foxbrianr | 3:8395f7ab6d3e | 27 | #if 1 |
foxbrianr | 3:8395f7ab6d3e | 28 | for(int i=0;i<3;i++) |
foxbrianr | 3:8395f7ab6d3e | 29 | { |
foxbrianr | 3:8395f7ab6d3e | 30 | int index = (current_line+i); |
foxbrianr | 3:8395f7ab6d3e | 31 | int line = (1+i); |
foxbrianr | 3:8395f7ab6d3e | 32 | if (index < escmEventLog.size() ) |
foxbrianr | 3:8395f7ab6d3e | 33 | { |
foxbrianr | 3:8395f7ab6d3e | 34 | sprintf(buf,"%02d | %02d | %-16s", |
foxbrianr | 3:8395f7ab6d3e | 35 | index + 1, |
foxbrianr | 3:8395f7ab6d3e | 36 | escmEventLog.events[index].address, |
foxbrianr | 3:8395f7ab6d3e | 37 | escmEventLog.events[index].timeStr); |
foxbrianr | 3:8395f7ab6d3e | 38 | |
foxbrianr | 3:8395f7ab6d3e | 39 | } else { |
foxbrianr | 3:8395f7ab6d3e | 40 | sprintf(buf,"%s | %s | %-16s", |
foxbrianr | 3:8395f7ab6d3e | 41 | "--", |
foxbrianr | 3:8395f7ab6d3e | 42 | "--", |
foxbrianr | 3:8395f7ab6d3e | 43 | "- N/A -"); |
foxbrianr | 3:8395f7ab6d3e | 44 | } |
foxbrianr | 3:8395f7ab6d3e | 45 | |
foxbrianr | 3:8395f7ab6d3e | 46 | lcd->writeLine(line,buf); |
foxbrianr | 3:8395f7ab6d3e | 47 | |
foxbrianr | 3:8395f7ab6d3e | 48 | } |
foxbrianr | 3:8395f7ab6d3e | 49 | update_needed=0; |
foxbrianr | 3:8395f7ab6d3e | 50 | #endif |
foxbrianr | 3:8395f7ab6d3e | 51 | } |
foxbrianr | 3:8395f7ab6d3e | 52 | |
foxbrianr | 3:8395f7ab6d3e | 53 | } |
foxbrianr | 3:8395f7ab6d3e | 54 | |
foxbrianr | 3:8395f7ab6d3e | 55 | void DisplayCodesMenu::pressMode() |
foxbrianr | 3:8395f7ab6d3e | 56 | { |
foxbrianr | 3:8395f7ab6d3e | 57 | |
foxbrianr | 3:8395f7ab6d3e | 58 | } |
foxbrianr | 3:8395f7ab6d3e | 59 | |
foxbrianr | 3:8395f7ab6d3e | 60 | void DisplayCodesMenu::pressSet() |
foxbrianr | 3:8395f7ab6d3e | 61 | { |
foxbrianr | 3:8395f7ab6d3e | 62 | |
foxbrianr | 3:8395f7ab6d3e | 63 | } |
foxbrianr | 3:8395f7ab6d3e | 64 | |
foxbrianr | 3:8395f7ab6d3e | 65 | void DisplayCodesMenu::pressDown() |
foxbrianr | 3:8395f7ab6d3e | 66 | { |
foxbrianr | 3:8395f7ab6d3e | 67 | printf("scroll down\n"); |
foxbrianr | 3:8395f7ab6d3e | 68 | if (current_line < escmEventLog.size() ) |
foxbrianr | 3:8395f7ab6d3e | 69 | current_line++; |
foxbrianr | 3:8395f7ab6d3e | 70 | else |
foxbrianr | 3:8395f7ab6d3e | 71 | current_line = escmEventLog.size()-1; |
foxbrianr | 3:8395f7ab6d3e | 72 | |
foxbrianr | 3:8395f7ab6d3e | 73 | update_needed=1; |
foxbrianr | 3:8395f7ab6d3e | 74 | } |
foxbrianr | 3:8395f7ab6d3e | 75 | |
foxbrianr | 3:8395f7ab6d3e | 76 | void DisplayCodesMenu::pressUp() |
foxbrianr | 3:8395f7ab6d3e | 77 | { |
foxbrianr | 3:8395f7ab6d3e | 78 | printf("scroll up\n"); |
foxbrianr | 3:8395f7ab6d3e | 79 | if (current_line > 0) |
foxbrianr | 3:8395f7ab6d3e | 80 | current_line--; |
foxbrianr | 3:8395f7ab6d3e | 81 | else |
foxbrianr | 3:8395f7ab6d3e | 82 | current_line = 0; |
foxbrianr | 3:8395f7ab6d3e | 83 | |
foxbrianr | 3:8395f7ab6d3e | 84 | update_needed =1; |
foxbrianr | 3:8395f7ab6d3e | 85 | } |