Release 1.01
Diff: DisplayCodesMenu.cpp
- Revision:
- 5:9f4d4f8ffc00
- Parent:
- 4:7226c43320b5
- Child:
- 6:af3769d17a35
diff -r 7226c43320b5 -r 9f4d4f8ffc00 DisplayCodesMenu.cpp --- a/DisplayCodesMenu.cpp Thu Sep 12 11:27:50 2019 +0000 +++ b/DisplayCodesMenu.cpp Tue Sep 17 13:48:22 2019 +0000 @@ -1,9 +1,32 @@ +/************************************************************************** + * @file DisplayCodeMenu.cpp + * @brief Base class for implementing the Display Code Menu display + * @version: V1.0 + * @date: 9/17/2019 + + * + * @note + * Copyright (C) 2019 E3 Design. All rights reserved. + * + * @par + * E3 Designers LLC is supplying this software for use with Cortex-M3 LPC1768 + * processor based microcontroller for the ESCM 2000 Monitor and Display. + * * + * @par + * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED + * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR + * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. + * + ******************************************************************************/ #include "mbed.h" #include "DisplayCodesMenu.h" #include "TimeUtilities.h" #include "ESCMControlApp.h" +/******************************************************************************/ DisplayCodesMenu::DisplayCodesMenu(char* id): Menu(id) { @@ -19,6 +42,7 @@ +/******************************************************************************/ void DisplayCodesMenu::init() { active_selection = 0; @@ -31,6 +55,7 @@ } +/******************************************************************************/ void DisplayCodesMenu::display(LCD * lcd) { static int lastPos = 0; @@ -79,15 +104,15 @@ lock(); switch (active_selection ) { - case 1: + case 2: lcd->cls(); lcd->locate(1,0); lcd->printf("Are you sure you want to erase"); lcd->locate(2,0); - lcd->printf("all events (Press Mode)?"); + lcd->printf("all events (Press Set)?"); update_needed = 0; break; - case 2: + case 3: lcd->cls(); lcd->locate(1,0); lcd->printf("Deleting Events..."); @@ -99,16 +124,13 @@ current_index = 0; break; - default: - + case 1: + // DISPLAY EXPANDED INFO lcd->cls(); lcd->locate(0,0); -#if 1 lcd->printf(" ID | Port | Unit | Time"); -#else - lcd->locate(0,0); - lcd->printf("size= %d, index=%d, %d, %d %d", escmEventLog.size(), current_index, current_line, top, bottom); -#endif + lcd->locate(0,33); + lcd->printf("Addr=%02d",escmController.cur_address); // update display for(int i=0; i<3; i++) { @@ -122,6 +144,7 @@ ESCM_Event *event = escmEventLog.index (index) ; if (event != NULL && index < escmEventLog.size() ) { + sprintf(buf,"%02d | %02d | %02d | %02d:%02d:%02d %02d/%02d/%04d", index + 1, event->port, @@ -134,6 +157,7 @@ event->year ); + } else { sprintf(buf,"%-s | %-s | %-s | %-s", "--", @@ -157,6 +181,88 @@ update_page = 0; update_needed=0; break; + break; + default: + + lcd->cls(); + lcd->locate(0,0); +#if 0 + lcd->printf(" ID | Port | Unit | Time"); +#else + lcd->printf(" ID | Description | Time"); +#endif + + lcd->locate(0,33); + lcd->printf("Addr=%02d",escmController.cur_address); + // update display + for(int i=0; i<3; i++) { + + int index = top + i; + int line = (1+i); + + int selected = current_index == index; + + + ESCM_Event *event = escmEventLog.index (index) ; + + if (event != NULL && index < escmEventLog.size() ) { +#if 0 + sprintf(buf,"%02d | %02d | %02d | %02d:%02d:%02d %02d/%02d/%04d", + index + 1, + event->port, + event->address, + event->hours, + event->mins, + event->secs, + event->month, + event->day, + event->year + ); +#else + char * ev_desc = addressMap.getDescription(event->address); + sprintf(buf,"%02d | %-12s | %02d:%02d:%02d %02d/%02d/%04d", + + event->address, + ev_desc, + event->hours, + event->mins, + event->secs, + event->month, + event->day, + event->year + ); +#endif + + } else { +#if 0 + sprintf(buf,"%-s | %-s | %-s | %-s", + "--", + "--", + "--", + "- N/A -"); +#else + sprintf(buf,"%-s | %-s | %-s", + "--", + "Empty", + "- N/A -"); +#endif + } + + if(selected) { + lcd->locate(line,0); + lcd->printf(">%-39s",buf); + } else { + lcd->locate(line,0); + lcd->printf(" %-39s",buf); + } + + //lcd->locate(line,2); + //lcd->printf(buf); + + } + update_page = 0; + update_needed=0; + break; } unlock(); @@ -164,32 +270,36 @@ } +/******************************************************************************/ void DisplayCodesMenu::pressSet() { switch(active_selection) { - case 0: { // normal - /* + case 0: + case 1: + { // normal + ESCM_Event *event = escmEventLog.index(current_index); if (event!=NULL) { - ESCMControlApp::say( "%s is open", - addressMap.getDescription(event->address)); + escmController.say(event->address ); + escmController.relayMessage(event->address ); } - */ update_needed = 0; break; } - case 1: // press yes - active_selection = 2; + case 2: // press yes + active_selection = 3; update_needed = 1; break; + case 3: // press yes default: active_selection = 0; break; } } +/******************************************************************************/ void DisplayCodesMenu::pressMode() { @@ -198,6 +308,12 @@ active_selection = 1; update_needed = 1; break; + case 1: // normal + active_selection = 2; + update_needed = 1; + break; + case 2: // normal + case 3: // normal default: active_selection = 0; update_needed = 1; @@ -205,6 +321,7 @@ } } +/******************************************************************************/ void DisplayCodesMenu::pressDown() { @@ -221,6 +338,7 @@ update_needed=1; } +/******************************************************************************/ void DisplayCodesMenu::pressUp() { current_line--; @@ -233,3 +351,4 @@ update_needed =1; } +/******************************************************************************/