Factory firmware for the MultiTech Dotbox (MTDOT-BOX) and EVB (MTDOT-EVB) products.

Dependencies:   NCP5623B GpsParser ISL29011 libmDot-mbed5 MTS-Serial MMA845x DOGS102 MPL3115A2

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers LayoutConfig.cpp Source File

LayoutConfig.cpp

00001 /* Copyright (c) <2016> <MultiTech Systems>, MIT License
00002  *
00003  * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 
00004  * and associated documentation files (the "Software"), to deal in the Software without restriction, 
00005  * including without limitation the rights to use, copy, modify, merge, publish, distribute, 
00006  * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 
00007  * furnished to do so, subject to the following conditions:
00008  *
00009  * The above copyright notice and this permission notice shall be included in all copies or 
00010  * substantial portions of the Software.
00011  *
00012  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 
00013  * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
00014  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
00015  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
00016  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00017  */
00018 
00019 #include "LayoutConfig.h"
00020 
00021 LayoutConfig::LayoutConfig(DOGS102* lcd)
00022   : Layout(lcd),
00023     _lMode(0, 0, "Configuration"),
00024     _fHeader(0, 1, 17),
00025     _fMsg1(0, 3, 17),
00026     _fMsg2(0, 4, 17),
00027     _fMsg3(0, 5, 17)
00028 {
00029     _timer.start();
00030 }
00031 
00032 LayoutConfig::~LayoutConfig() {}
00033 
00034 void LayoutConfig::display() {
00035     clear();
00036     startUpdate();
00037     writeLabel(_lMode);
00038     endUpdate();
00039     update1of3();
00040 }
00041 
00042 void LayoutConfig::roll(){
00043     if(_timer.read_ms() < _duration){
00044         return;
00045     }
00046     if(_screen == 3){
00047         _screen = 1;
00048     }
00049     else
00050         _screen++;
00051     
00052     switch(_screen){
00053         case 1:
00054             update1of3();
00055             break;
00056         case 2:
00057             update2of3();
00058             break;
00059         case 3:
00060             update3of3();
00061             break;
00062     }
00063 }
00064 
00065 void LayoutConfig::update1of3() {
00066     _screen = 1;
00067     _timer.reset();
00068     _duration = 4000;
00069     writeField(_fHeader, string("1 of 3"), true);
00070     writeField(_fMsg1, string("Connect to MTMDK"), true);
00071     writeField(_fMsg2, string("using the 8 pin"), true);
00072     writeField(_fMsg3, string("ribbon cable."), true);
00073 }
00074 
00075 void LayoutConfig::update2of3() {
00076     _timer.reset();
00077     _duration = 3000;
00078     writeField(_fHeader, string("2 of 3"), true);
00079     writeField(_fMsg1, string("Plug MTMDK into a"), true);
00080     writeField(_fMsg2, string("PC."), true);
00081     writeField(_fMsg3, string(""), true);
00082 }
00083 
00084 void LayoutConfig::update3of3() {
00085     _timer.reset();
00086     _duration = 5000;
00087     writeField(_fHeader, string("3 of 3"), true);
00088     writeField(_fMsg1, string("Run com s/w on"), true);
00089     writeField(_fMsg2, string("new TTY/COM at"), true);
00090     writeField(_fMsg3, string("115200 bps."), true);
00091 }