Display driver for the Vives city game
Display.cpp@7:f2050f77de0b, 2017-05-15 (annotated)
- Committer:
- atomicLogic
- Date:
- Mon May 15 18:29:40 2017 +0000
- Revision:
- 7:f2050f77de0b
- Parent:
- 6:658fac9f3ffd
bla
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
atomicLogic | 0:80ce68cdf568 | 1 | #include "Display.h" |
atomicLogic | 0:80ce68cdf568 | 2 | #include "TextLCD.h" |
atomicLogic | 0:80ce68cdf568 | 3 | #include "CostumCharacters.h" |
atomicLogic | 0:80ce68cdf568 | 4 | #include <string> |
atomicLogic | 5:06eccc902247 | 5 | #include <sstream> |
atomicLogic | 0:80ce68cdf568 | 6 | |
atomicLogic | 0:80ce68cdf568 | 7 | Display::Display() |
atomicLogic | 0:80ce68cdf568 | 8 | { |
atomicLogic | 4:f056a09af806 | 9 | topBarEnable = 0; |
atomicLogic | 4:f056a09af806 | 10 | |
atomicLogic | 5:06eccc902247 | 11 | hours = 0; |
atomicLogic | 5:06eccc902247 | 12 | minutes = 0; |
atomicLogic | 5:06eccc902247 | 13 | seconds = 0; |
atomicLogic | 5:06eccc902247 | 14 | distance = 0; |
atomicLogic | 5:06eccc902247 | 15 | radius = 0; |
atomicLogic | 5:06eccc902247 | 16 | position = 0; |
atomicLogic | 5:06eccc902247 | 17 | description = ""; |
atomicLogic | 5:06eccc902247 | 18 | |
atomicLogic | 5:06eccc902247 | 19 | status = 0; |
atomicLogic | 5:06eccc902247 | 20 | |
atomicLogic | 4:f056a09af806 | 21 | backlight = new PwmOut(PTB19); |
atomicLogic | 4:f056a09af806 | 22 | backlight->period(0.001f); //frequentie pwm |
atomicLogic | 4:f056a09af806 | 23 | backlight->write(0.75f); //duty cycle |
atomicLogic | 4:f056a09af806 | 24 | |
atomicLogic | 0:80ce68cdf568 | 25 | emptyRow = " "; |
atomicLogic | 4:f056a09af806 | 26 | |
atomicLogic | 0:80ce68cdf568 | 27 | lcd = new TextLCD( PTC5, PTC7, PTC0, PTC9, PTC8, PTC1, TextLCD::LCD20x4 ); |
atomicLogic | 0:80ce68cdf568 | 28 | costumCharacters = new CostumCharacters( lcd ); |
atomicLogic | 0:80ce68cdf568 | 29 | |
atomicLogic | 0:80ce68cdf568 | 30 | costumCharacters->setBatteryIcon( 0 ); |
atomicLogic | 5:06eccc902247 | 31 | costumCharacters->setGpsIcon( 0 ); |
atomicLogic | 5:06eccc902247 | 32 | costumCharacters->setLoraIcon( 1 ); |
atomicLogic | 0:80ce68cdf568 | 33 | costumCharacters->setLoraStatusIcon( 0 ); |
atomicLogic | 0:80ce68cdf568 | 34 | |
atomicLogic | 0:80ce68cdf568 | 35 | lcd->cls(); |
atomicLogic | 4:f056a09af806 | 36 | lcd->locate(0,0); |
atomicLogic | 0:80ce68cdf568 | 37 | } |
atomicLogic | 0:80ce68cdf568 | 38 | |
atomicLogic | 4:f056a09af806 | 39 | void Display::topBar(bool topBarEnable) |
atomicLogic | 4:f056a09af806 | 40 | { |
atomicLogic | 4:f056a09af806 | 41 | if(topBarEnable) |
atomicLogic | 4:f056a09af806 | 42 | { |
atomicLogic | 5:06eccc902247 | 43 | Display::topBarRedraw(); |
atomicLogic | 4:f056a09af806 | 44 | } |
atomicLogic | 5:06eccc902247 | 45 | |
atomicLogic | 5:06eccc902247 | 46 | if( this->topBarEnable == 1 && topBarEnable == 0 ) |
atomicLogic | 5:06eccc902247 | 47 | { |
atomicLogic | 5:06eccc902247 | 48 | lcd->locate(0,0); |
atomicLogic | 5:06eccc902247 | 49 | lcd->printf( emptyRow.c_str() ); |
atomicLogic | 5:06eccc902247 | 50 | } |
atomicLogic | 5:06eccc902247 | 51 | this->topBarEnable = topBarEnable; |
atomicLogic | 4:f056a09af806 | 52 | } |
atomicLogic | 4:f056a09af806 | 53 | |
atomicLogic | 0:80ce68cdf568 | 54 | void Display::setTime(int hours, int minutes, int seconds) |
atomicLogic | 4:f056a09af806 | 55 | { |
atomicLogic | 4:f056a09af806 | 56 | this->hours = hours; |
atomicLogic | 4:f056a09af806 | 57 | this->minutes = minutes; |
atomicLogic | 4:f056a09af806 | 58 | this->seconds = seconds; |
atomicLogic | 5:06eccc902247 | 59 | Display::topBarRedraw(); |
atomicLogic | 5:06eccc902247 | 60 | } |
atomicLogic | 4:f056a09af806 | 61 | |
atomicLogic | 5:06eccc902247 | 62 | void Display::topBarRedraw( void ) |
atomicLogic | 5:06eccc902247 | 63 | { |
atomicLogic | 6:658fac9f3ffd | 64 | if(topBarEnable) |
atomicLogic | 6:658fac9f3ffd | 65 | { |
atomicLogic | 6:658fac9f3ffd | 66 | |
atomicLogic | 0:80ce68cdf568 | 67 | char buffer[10]; |
atomicLogic | 0:80ce68cdf568 | 68 | std::string time = ""; |
atomicLogic | 0:80ce68cdf568 | 69 | |
atomicLogic | 5:06eccc902247 | 70 | if(this->hours <= 9) { time.append( "0" ); } |
atomicLogic | 4:f056a09af806 | 71 | std::sprintf(buffer, "%d", this->hours); |
atomicLogic | 0:80ce68cdf568 | 72 | time.append( std::string(buffer) ); |
atomicLogic | 0:80ce68cdf568 | 73 | |
atomicLogic | 0:80ce68cdf568 | 74 | time.append( ":" ); |
atomicLogic | 0:80ce68cdf568 | 75 | |
atomicLogic | 5:06eccc902247 | 76 | if(this->minutes <= 9) { time.append( "0" ); } |
atomicLogic | 4:f056a09af806 | 77 | std::sprintf(buffer, "%d", this->minutes); |
atomicLogic | 0:80ce68cdf568 | 78 | time.append( std::string(buffer) ); |
atomicLogic | 0:80ce68cdf568 | 79 | |
atomicLogic | 0:80ce68cdf568 | 80 | time.append( ":" ); |
atomicLogic | 0:80ce68cdf568 | 81 | |
atomicLogic | 5:06eccc902247 | 82 | if(this->seconds <= 9) { time.append( "0" ); } |
atomicLogic | 4:f056a09af806 | 83 | std::sprintf(buffer, "%d", this->seconds); |
atomicLogic | 0:80ce68cdf568 | 84 | time.append( std::string(buffer) ); |
atomicLogic | 0:80ce68cdf568 | 85 | |
atomicLogic | 4:f056a09af806 | 86 | lcd->locate(0,0); |
atomicLogic | 5:06eccc902247 | 87 | lcd->printf( emptyRow.c_str() ); |
atomicLogic | 5:06eccc902247 | 88 | lcd->locate(0,0); |
atomicLogic | 4:f056a09af806 | 89 | lcd->printf("\3\4"); |
atomicLogic | 5:06eccc902247 | 90 | lcd->locate(18,0); |
atomicLogic | 4:f056a09af806 | 91 | lcd->printf("\2\1"); |
atomicLogic | 0:80ce68cdf568 | 92 | lcd->locate(6,0); |
atomicLogic | 0:80ce68cdf568 | 93 | lcd->printf( time.c_str()); |
atomicLogic | 6:658fac9f3ffd | 94 | } |
atomicLogic | 0:80ce68cdf568 | 95 | } |
atomicLogic | 0:80ce68cdf568 | 96 | |
atomicLogic | 0:80ce68cdf568 | 97 | void Display::setStatusBattery( float batteryLvl ) |
atomicLogic | 0:80ce68cdf568 | 98 | { |
atomicLogic | 0:80ce68cdf568 | 99 | if ( 1 >= batteryLvl && batteryLvl >= 0 ) |
atomicLogic | 0:80ce68cdf568 | 100 | { |
atomicLogic | 0:80ce68cdf568 | 101 | int lvl; |
atomicLogic | 0:80ce68cdf568 | 102 | batteryLvl = batteryLvl * 5; //get size of replace 5 |
atomicLogic | 0:80ce68cdf568 | 103 | lvl = (int) batteryLvl; |
atomicLogic | 0:80ce68cdf568 | 104 | costumCharacters->setBatteryIcon( lvl ); |
atomicLogic | 0:80ce68cdf568 | 105 | } |
atomicLogic | 0:80ce68cdf568 | 106 | } |
atomicLogic | 0:80ce68cdf568 | 107 | |
atomicLogic | 5:06eccc902247 | 108 | void Display::setStatusLora( int lora, int loraStatus ) |
atomicLogic | 0:80ce68cdf568 | 109 | { |
atomicLogic | 0:80ce68cdf568 | 110 | costumCharacters->setLoraIcon( lora ); |
atomicLogic | 0:80ce68cdf568 | 111 | costumCharacters->setLoraStatusIcon( loraStatus ); |
atomicLogic | 0:80ce68cdf568 | 112 | } |
atomicLogic | 0:80ce68cdf568 | 113 | |
atomicLogic | 5:06eccc902247 | 114 | void Display::setStatusGps( int gpsFix ) |
atomicLogic | 0:80ce68cdf568 | 115 | { |
atomicLogic | 0:80ce68cdf568 | 116 | costumCharacters->setGpsIcon( gpsFix ); |
atomicLogic | 0:80ce68cdf568 | 117 | } |
atomicLogic | 0:80ce68cdf568 | 118 | |
atomicLogic | 4:f056a09af806 | 119 | void Display::setStartScreen( void ) |
atomicLogic | 0:80ce68cdf568 | 120 | { |
atomicLogic | 5:06eccc902247 | 121 | this->status = 0; |
atomicLogic | 5:06eccc902247 | 122 | |
atomicLogic | 4:f056a09af806 | 123 | Display::topBar( 0 ); |
atomicLogic | 5:06eccc902247 | 124 | Display::clearScreen(); |
atomicLogic | 5:06eccc902247 | 125 | |
atomicLogic | 4:f056a09af806 | 126 | for(int i = 13; i >= 0; i--) |
atomicLogic | 0:80ce68cdf568 | 127 | { |
atomicLogic | 4:f056a09af806 | 128 | lcd->locate( 0, 0 ); |
atomicLogic | 4:f056a09af806 | 129 | lcd->printf( " " ); |
atomicLogic | 4:f056a09af806 | 130 | lcd->locate( i, 0 ); |
atomicLogic | 0:80ce68cdf568 | 131 | lcd->printf( "Welcome" ); |
atomicLogic | 4:f056a09af806 | 132 | wait_ms( 20 ); |
atomicLogic | 4:f056a09af806 | 133 | } |
atomicLogic | 4:f056a09af806 | 134 | for(int i = 14; i >= 0; i--) |
atomicLogic | 4:f056a09af806 | 135 | { |
atomicLogic | 4:f056a09af806 | 136 | lcd->locate( 0, 1 ); |
atomicLogic | 4:f056a09af806 | 137 | lcd->printf( " " ); |
atomicLogic | 4:f056a09af806 | 138 | lcd->locate( i, 1 ); |
atomicLogic | 0:80ce68cdf568 | 139 | lcd->printf( "to the" ); |
atomicLogic | 4:f056a09af806 | 140 | wait_ms( 20 ); |
atomicLogic | 4:f056a09af806 | 141 | } |
atomicLogic | 4:f056a09af806 | 142 | for(int i = 15; i >= 0; i--) |
atomicLogic | 4:f056a09af806 | 143 | { |
atomicLogic | 4:f056a09af806 | 144 | lcd->locate( 0, 2 ); |
atomicLogic | 4:f056a09af806 | 145 | lcd->printf( " " ); |
atomicLogic | 4:f056a09af806 | 146 | lcd->locate( i, 2 ); |
atomicLogic | 4:f056a09af806 | 147 | lcd->printf( "Vives" ); |
atomicLogic | 4:f056a09af806 | 148 | wait_ms( 20 ); |
atomicLogic | 0:80ce68cdf568 | 149 | } |
atomicLogic | 4:f056a09af806 | 150 | for(int i = 11; i >= 0; i--) |
atomicLogic | 4:f056a09af806 | 151 | { |
atomicLogic | 4:f056a09af806 | 152 | lcd->locate( 0, 3 ); |
atomicLogic | 4:f056a09af806 | 153 | lcd->printf( " " ); |
atomicLogic | 4:f056a09af806 | 154 | lcd->locate( i, 3 ); |
atomicLogic | 4:f056a09af806 | 155 | lcd->printf( "City Game" ); |
atomicLogic | 4:f056a09af806 | 156 | wait_ms( 20 ); |
atomicLogic | 4:f056a09af806 | 157 | } |
atomicLogic | 4:f056a09af806 | 158 | lcd->locate( 19, 3 ); |
atomicLogic | 4:f056a09af806 | 159 | lcd->putc( (char) 126 ); |
atomicLogic | 0:80ce68cdf568 | 160 | } |
atomicLogic | 0:80ce68cdf568 | 161 | |
atomicLogic | 4:f056a09af806 | 162 | void Display::setMissionScreen( std::string description, int distance, int radius ) |
atomicLogic | 0:80ce68cdf568 | 163 | { |
atomicLogic | 5:06eccc902247 | 164 | this->description = description; |
atomicLogic | 5:06eccc902247 | 165 | this->distance = distance; |
atomicLogic | 5:06eccc902247 | 166 | this->radius = radius; |
atomicLogic | 5:06eccc902247 | 167 | |
atomicLogic | 5:06eccc902247 | 168 | if( this->status == 3 ) |
atomicLogic | 5:06eccc902247 | 169 | { |
atomicLogic | 5:06eccc902247 | 170 | |
atomicLogic | 7:f2050f77de0b | 171 | |
atomicLogic | 7:f2050f77de0b | 172 | Display::clearScreen(); |
atomicLogic | 5:06eccc902247 | 173 | Display::topBar( 1 ); |
atomicLogic | 5:06eccc902247 | 174 | |
atomicLogic | 0:80ce68cdf568 | 175 | lcd->locate( 0, 1 ); |
atomicLogic | 0:80ce68cdf568 | 176 | lcd->printf( description.c_str() ); |
atomicLogic | 0:80ce68cdf568 | 177 | |
atomicLogic | 0:80ce68cdf568 | 178 | char buffer[10]; |
atomicLogic | 0:80ce68cdf568 | 179 | std::string distanceString = ""; |
atomicLogic | 5:06eccc902247 | 180 | distanceString.append( "Dist:" ); |
atomicLogic | 7:f2050f77de0b | 181 | std::sprintf(buffer, "%d", distance); |
atomicLogic | 0:80ce68cdf568 | 182 | distanceString.append( std::string(buffer) ); |
atomicLogic | 0:80ce68cdf568 | 183 | distanceString.append( "m" ); |
atomicLogic | 0:80ce68cdf568 | 184 | |
atomicLogic | 0:80ce68cdf568 | 185 | lcd->locate( 0, 3 ); |
atomicLogic | 0:80ce68cdf568 | 186 | lcd->printf( distanceString.c_str() ); |
atomicLogic | 5:06eccc902247 | 187 | |
atomicLogic | 5:06eccc902247 | 188 | char buffer2[10]; |
atomicLogic | 5:06eccc902247 | 189 | std::string radString = ""; |
atomicLogic | 5:06eccc902247 | 190 | radString.append( "Rad:" ); |
atomicLogic | 7:f2050f77de0b | 191 | std::sprintf(buffer2, "%d", radius); |
atomicLogic | 5:06eccc902247 | 192 | radString.append( std::string(buffer2) ); |
atomicLogic | 5:06eccc902247 | 193 | radString.append( "m" ); |
atomicLogic | 5:06eccc902247 | 194 | |
atomicLogic | 5:06eccc902247 | 195 | lcd->locate( 12, 3 ); |
atomicLogic | 5:06eccc902247 | 196 | lcd->printf( radString.c_str() ); |
atomicLogic | 5:06eccc902247 | 197 | |
atomicLogic | 5:06eccc902247 | 198 | Display::topBarRedraw(); |
atomicLogic | 5:06eccc902247 | 199 | } |
atomicLogic | 0:80ce68cdf568 | 200 | } |
atomicLogic | 0:80ce68cdf568 | 201 | |
atomicLogic | 0:80ce68cdf568 | 202 | void Display::setEndScreen( void ) |
atomicLogic | 0:80ce68cdf568 | 203 | { |
atomicLogic | 5:06eccc902247 | 204 | Display::topBar( 0 ); |
atomicLogic | 0:80ce68cdf568 | 205 | Display::clearScreen(); |
atomicLogic | 0:80ce68cdf568 | 206 | |
atomicLogic | 2:dd81a3e3c360 | 207 | for(int i = 0; i < 7; i++) |
atomicLogic | 0:80ce68cdf568 | 208 | { |
atomicLogic | 4:f056a09af806 | 209 | lcd->locate( 2, 0 ); |
atomicLogic | 0:80ce68cdf568 | 210 | lcd->printf( "Congratulations!" ); |
atomicLogic | 0:80ce68cdf568 | 211 | wait_ms( 120 ); |
atomicLogic | 0:80ce68cdf568 | 212 | Display::clearScreen(); |
atomicLogic | 0:80ce68cdf568 | 213 | wait_ms( 100 ); |
atomicLogic | 0:80ce68cdf568 | 214 | } |
atomicLogic | 0:80ce68cdf568 | 215 | |
atomicLogic | 4:f056a09af806 | 216 | lcd->locate( 2, 0 ); |
atomicLogic | 0:80ce68cdf568 | 217 | lcd->printf( "Congratulations!" ); |
atomicLogic | 4:f056a09af806 | 218 | lcd->locate( 3, 1 ); |
atomicLogic | 4:f056a09af806 | 219 | lcd->printf( "You completed" ); |
atomicLogic | 4:f056a09af806 | 220 | lcd->locate( 6, 2 ); |
atomicLogic | 4:f056a09af806 | 221 | lcd->printf( "all the" ); |
atomicLogic | 4:f056a09af806 | 222 | lcd->locate( 5, 3 ); |
atomicLogic | 4:f056a09af806 | 223 | lcd->printf( "missions!" ); |
atomicLogic | 0:80ce68cdf568 | 224 | |
atomicLogic | 0:80ce68cdf568 | 225 | } |
atomicLogic | 0:80ce68cdf568 | 226 | |
atomicLogic | 0:80ce68cdf568 | 227 | void Display::clearScreen( void ) |
atomicLogic | 0:80ce68cdf568 | 228 | { |
atomicLogic | 4:f056a09af806 | 229 | if( topBarEnable ) |
atomicLogic | 4:f056a09af806 | 230 | { |
atomicLogic | 4:f056a09af806 | 231 | lcd->locate(0,1); |
atomicLogic | 4:f056a09af806 | 232 | lcd->printf( emptyRow.c_str() ); |
atomicLogic | 4:f056a09af806 | 233 | lcd->locate(0,2); |
atomicLogic | 4:f056a09af806 | 234 | lcd->printf( emptyRow.c_str() ); |
atomicLogic | 4:f056a09af806 | 235 | lcd->locate(0,3); |
atomicLogic | 4:f056a09af806 | 236 | lcd->printf( emptyRow.c_str()); |
atomicLogic | 4:f056a09af806 | 237 | } |
atomicLogic | 4:f056a09af806 | 238 | else |
atomicLogic | 4:f056a09af806 | 239 | { |
atomicLogic | 4:f056a09af806 | 240 | lcd->cls(); |
atomicLogic | 4:f056a09af806 | 241 | } |
atomicLogic | 0:80ce68cdf568 | 242 | } |
atomicLogic | 0:80ce68cdf568 | 243 | |
atomicLogic | 4:f056a09af806 | 244 | void Display::setMessageScreen( std::string message ) |
atomicLogic | 4:f056a09af806 | 245 | { |
atomicLogic | 5:06eccc902247 | 246 | if( this->status == 3 ) |
atomicLogic | 5:06eccc902247 | 247 | { |
atomicLogic | 4:f056a09af806 | 248 | Display::clearScreen(); |
atomicLogic | 5:06eccc902247 | 249 | |
atomicLogic | 5:06eccc902247 | 250 | if(topBarEnable) |
atomicLogic | 5:06eccc902247 | 251 | { |
atomicLogic | 5:06eccc902247 | 252 | lcd->locate(0,1); |
atomicLogic | 5:06eccc902247 | 253 | } |
atomicLogic | 5:06eccc902247 | 254 | else |
atomicLogic | 5:06eccc902247 | 255 | { |
atomicLogic | 5:06eccc902247 | 256 | lcd->locate(0,0); |
atomicLogic | 5:06eccc902247 | 257 | } |
atomicLogic | 4:f056a09af806 | 258 | lcd->printf( message.c_str() ); |
atomicLogic | 5:06eccc902247 | 259 | } |
atomicLogic | 4:f056a09af806 | 260 | } |
atomicLogic | 5:06eccc902247 | 261 | |
atomicLogic | 5:06eccc902247 | 262 | void Display::setMenuScreen( void ) |
atomicLogic | 5:06eccc902247 | 263 | { |
atomicLogic | 5:06eccc902247 | 264 | position = ! position; |
atomicLogic | 5:06eccc902247 | 265 | |
atomicLogic | 6:658fac9f3ffd | 266 | Display::clearScreen(); |
atomicLogic | 5:06eccc902247 | 267 | Display::topBar( 1 ); |
atomicLogic | 5:06eccc902247 | 268 | |
atomicLogic | 5:06eccc902247 | 269 | |
atomicLogic | 5:06eccc902247 | 270 | if( position ) |
atomicLogic | 5:06eccc902247 | 271 | { |
atomicLogic | 5:06eccc902247 | 272 | lcd->locate(0,2); |
atomicLogic | 5:06eccc902247 | 273 | } |
atomicLogic | 5:06eccc902247 | 274 | else |
atomicLogic | 5:06eccc902247 | 275 | { |
atomicLogic | 5:06eccc902247 | 276 | lcd->locate(0,3); |
atomicLogic | 5:06eccc902247 | 277 | } |
atomicLogic | 5:06eccc902247 | 278 | lcd->putc( (char) 126 ); |
atomicLogic | 5:06eccc902247 | 279 | |
atomicLogic | 5:06eccc902247 | 280 | lcd->locate(0,1); |
atomicLogic | 5:06eccc902247 | 281 | lcd->printf( "Menu:" ); |
atomicLogic | 5:06eccc902247 | 282 | lcd->locate(1,2); |
atomicLogic | 5:06eccc902247 | 283 | lcd->printf( "Start game" ); |
atomicLogic | 5:06eccc902247 | 284 | lcd->locate(1,3); |
atomicLogic | 5:06eccc902247 | 285 | lcd->printf( "Status screen" ); |
atomicLogic | 5:06eccc902247 | 286 | |
atomicLogic | 5:06eccc902247 | 287 | } |
atomicLogic | 5:06eccc902247 | 288 | |
atomicLogic | 5:06eccc902247 | 289 | void Display::eventHandler( char key ) |
atomicLogic | 5:06eccc902247 | 290 | { |
atomicLogic | 5:06eccc902247 | 291 | switch( status ) |
atomicLogic | 5:06eccc902247 | 292 | { |
atomicLogic | 5:06eccc902247 | 293 | case 0: //Welcome screen |
atomicLogic | 5:06eccc902247 | 294 | { |
atomicLogic | 5:06eccc902247 | 295 | Display::setMenuScreen(); |
atomicLogic | 5:06eccc902247 | 296 | this->status = 1; |
atomicLogic | 5:06eccc902247 | 297 | } |
atomicLogic | 5:06eccc902247 | 298 | break; |
atomicLogic | 5:06eccc902247 | 299 | case 1: //Menu screen |
atomicLogic | 5:06eccc902247 | 300 | { |
atomicLogic | 5:06eccc902247 | 301 | switch( key ) |
atomicLogic | 5:06eccc902247 | 302 | { |
atomicLogic | 6:658fac9f3ffd | 303 | case '2': |
atomicLogic | 5:06eccc902247 | 304 | { |
atomicLogic | 5:06eccc902247 | 305 | Display::setMenuScreen(); |
atomicLogic | 5:06eccc902247 | 306 | } |
atomicLogic | 5:06eccc902247 | 307 | break; |
atomicLogic | 6:658fac9f3ffd | 308 | case '5': |
atomicLogic | 5:06eccc902247 | 309 | { |
atomicLogic | 5:06eccc902247 | 310 | if( position ) |
atomicLogic | 5:06eccc902247 | 311 | { |
atomicLogic | 5:06eccc902247 | 312 | this->status = 3; |
atomicLogic | 5:06eccc902247 | 313 | Display::setMissionScreen( this->description, this->distance, this->radius ); |
atomicLogic | 5:06eccc902247 | 314 | } |
atomicLogic | 5:06eccc902247 | 315 | else |
atomicLogic | 5:06eccc902247 | 316 | { |
atomicLogic | 5:06eccc902247 | 317 | this->status = 2; |
atomicLogic | 5:06eccc902247 | 318 | Display::setStatusScreen(); |
atomicLogic | 5:06eccc902247 | 319 | } |
atomicLogic | 5:06eccc902247 | 320 | |
atomicLogic | 5:06eccc902247 | 321 | } |
atomicLogic | 5:06eccc902247 | 322 | break; |
atomicLogic | 6:658fac9f3ffd | 323 | case '8': |
atomicLogic | 5:06eccc902247 | 324 | { |
atomicLogic | 5:06eccc902247 | 325 | Display::setMenuScreen(); |
atomicLogic | 5:06eccc902247 | 326 | } |
atomicLogic | 5:06eccc902247 | 327 | break; |
atomicLogic | 5:06eccc902247 | 328 | } |
atomicLogic | 5:06eccc902247 | 329 | } |
atomicLogic | 5:06eccc902247 | 330 | break; |
atomicLogic | 5:06eccc902247 | 331 | case 2: |
atomicLogic | 5:06eccc902247 | 332 | { |
atomicLogic | 7:f2050f77de0b | 333 | this->status = 1; |
atomicLogic | 7:f2050f77de0b | 334 | Display::setMenuScreen(); |
atomicLogic | 5:06eccc902247 | 335 | } |
atomicLogic | 5:06eccc902247 | 336 | break; |
atomicLogic | 5:06eccc902247 | 337 | case 3: |
atomicLogic | 5:06eccc902247 | 338 | { |
atomicLogic | 5:06eccc902247 | 339 | |
atomicLogic | 5:06eccc902247 | 340 | } |
atomicLogic | 5:06eccc902247 | 341 | break; |
atomicLogic | 5:06eccc902247 | 342 | } |
atomicLogic | 5:06eccc902247 | 343 | } |
atomicLogic | 5:06eccc902247 | 344 | |
atomicLogic | 5:06eccc902247 | 345 | void Display::setStatusScreen( void ) |
atomicLogic | 5:06eccc902247 | 346 | { |
atomicLogic | 7:f2050f77de0b | 347 | Display::clearScreen(); |
atomicLogic | 5:06eccc902247 | 348 | Display::topBar( 1 ); |
atomicLogic | 5:06eccc902247 | 349 | |
atomicLogic | 5:06eccc902247 | 350 | lcd->locate(0,2); |
atomicLogic | 5:06eccc902247 | 351 | lcd->printf( "Battery" ); |
atomicLogic | 5:06eccc902247 | 352 | lcd->locate(0,3); |
atomicLogic | 5:06eccc902247 | 353 | lcd->printf( "Voltage: " ); |
atomicLogic | 5:06eccc902247 | 354 | } |