![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Guides the user to their classes
Dependencies: 4DGL-uLCD-SE Course SDFileSystem mbed PinDetect LSM9DS1_Library_cal MBed_Adafruit-GPS-Library
Diff: main.cpp
- Revision:
- 16:4b4e6cf66e7c
- Parent:
- 15:75a121b14e5d
- Child:
- 17:1de531cd3d4a
--- a/main.cpp Thu Dec 08 23:40:59 2016 +0000 +++ b/main.cpp Fri Dec 09 00:24:58 2016 +0000 @@ -16,6 +16,7 @@ uLCD_4DGL uLCD(p13,p14,p15); // serial tx, serial rx, reset pin; PinDetect left(p20); PinDetect right(p18); +PinDetect center(p19); Serial * gps_Serial; int update; @@ -38,6 +39,9 @@ float displacement(float diffLat,float diffLong); float calc_eta(float displacement, float speed); bool late(float eta); +timer t2; + +bool snooze = 0; void left_callback(void) { @@ -149,12 +153,21 @@ float dis = displacement(diffLat,diffLong); float speed = 3.1; //mph. Source:https://lmgtfy.com/?q=average+human+walking+speed float eta = calc_eta(dis,speed)*60;//(miles, mph)*60 - if(late(eta)==1) { + if((late(eta)==1)&&(snooze==0)) { uLCD.background_color(RED); - uLCD.text_mode(TRANSPARENT); - } else { + uLCD.textbackground_color(RED); + } elseif((late(eta)==1)&&(snooze==1)){ + t2.start(); + if(t2.read>120)//2 minute snooze + { + uLCD.background_color(BLACK); + uLCD.textbackground_color(BLACK); + } + t2.stop(); + } + else { uLCD.background_color(BLACK); - uLCD.text_mode(TRANSPARENT); + uLCD.textbackground_color(BLACK); } switch(current_screen) { @@ -213,7 +226,7 @@ break; case 2: //uLCD.cls(); - uLCD.text_mode(TRANSPARENT); + //uLCD.text_mode(TRANSPARENT); uLCD.locate(0,2); uLCD.printf(" "); uLCD.locate(0,3); @@ -294,7 +307,7 @@ void displayCourseVec() { - uLCD.text_mode(TRANSPARENT); + //uLCD.text_mode(TRANSPARENT); if (courseVec.size() == 0) { uLCD.cls(); uLCD.locate(0,0); @@ -454,3 +467,6 @@ return 0; } } +bool snooze() +{ +}