E3 Designers / Menu

Dependents:   mbed_escm2000

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers FactoryResetMenu.cpp Source File

FactoryResetMenu.cpp

00001 /**************************************************************************
00002  * @file     FactorResetMenu.cpp
00003  * @brief    Base class for implementing the Factor Reset Menu display
00004  * @version: V1.0
00005  * @date:    9/17/2019
00006 
00007  *
00008  * @note
00009  * Copyright (C) 2019 E3 Design. All rights reserved.
00010  *
00011  * @par
00012  * E3 Designers LLC is supplying this software for use with Cortex-M3 LPC1768
00013  * processor based microcontroller for the ESCM 2000 Monitor and Display.  
00014  *  *
00015  * @par
00016  * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
00017  * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
00018  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
00019  * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
00020  * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
00021  *
00022  ******************************************************************************/
00023 #include "mbed.h"
00024 #include "FactoryResetMenu.h"
00025 #include "TimeUtilities.h"
00026 #include "ESCMControlApp.h"
00027 
00028 #define DEFAULT_DISPLAY 0
00029 
00030 /******************************************************************************/
00031 FactoryResetMenu::FactoryResetMenu(char* id): Menu(id)
00032 {
00033     active_selection=0;
00034 }
00035 
00036 
00037 
00038 /******************************************************************************/
00039 void FactoryResetMenu::init()
00040 {
00041     update_needed    = 1;
00042     active_selection=0;
00043 }
00044 
00045 /******************************************************************************/
00046 void FactoryResetMenu::display(LCD * lcd) 
00047 {
00048     static int counter = 5;
00049     
00050     if (update_needed) {
00051         switch(active_selection) {
00052             
00053             case 1:
00054                 lcd->cls();
00055                 lcd->locate(1,0);
00056                 lcd->printf("Resetting to Factory Default");
00057                 lcd->locate(1,0);
00058                 counter = 5;
00059                 active_selection=2;
00060                 update_needed=1;
00061                 break;
00062                 
00063             case 2:
00064                 lcd->locate(2,0);
00065                 lcd->printf("Please wait %d...", counter--);
00066                 if (counter == 0) active_selection=0;
00067                 update_needed=1;
00068                 break;
00069             
00070             default:
00071                 lcd->cls();
00072                 lcd->locate(0,0);
00073                 lcd->printf("Press <Set> to Reset");
00074                 update_needed=0;
00075                 break;
00076         };
00077     }
00078     
00079     displayCurrentTime(lcd);
00080     displayVersion(lcd);
00081 }
00082 
00083 /******************************************************************************/
00084 void FactoryResetMenu::pressMode()
00085 {
00086     // toggle active menu 
00087     switch(active_selection) {
00088         
00089         case 0:
00090             back();
00091             break;
00092         case 1:
00093             back();
00094             break;
00095             
00096         default:
00097             active_selection = 0;
00098             break;
00099     };
00100 
00101     update_needed = 1;
00102 }
00103 
00104 /******************************************************************************/
00105 void FactoryResetMenu::pressSet()
00106 {
00107     // set button advances to next character position OR
00108     // goes back to normal
00109     switch(active_selection) {
00110         
00111         case 0:
00112             active_selection = 1;
00113             addressMap.reset();
00114             escmEventLog.reset();
00115             break;
00116             
00117         case 1: // press yes
00118             active_selection = 2;
00119             break;
00120             
00121         case 2: // complete
00122             //back();
00123             active_selection = 0;
00124             break;
00125             
00126         default:
00127             active_selection = 0;
00128             break;
00129             
00130     };
00131     update_needed = 1;
00132 }
00133 
00134 /******************************************************************************/
00135 
00136