![](/media/cache/profiles/0df840aed5f513a02964d0c27bc4f277.jpg.50x50_q85.jpg)
Attempts to merge SPI_TFT2 & SPI_TFT_ILI9341
Dependencies: SPI_TFTx2 TFT_fonts TOUCH_TFTx2 mbed
Fork of CANary by
Diff: main.cpp
- Branch:
- Metric
- Revision:
- 98:9f8bab96edff
- Parent:
- 96:a6c6a6fd1d28
- Child:
- 99:c05abf8e1cdc
--- a/main.cpp Fri May 03 14:31:07 2013 +0000 +++ b/main.cpp Mon Jun 10 12:00:48 2013 +0000 @@ -51,7 +51,7 @@ // gg - revStr is used in 2 places // gg - and is easy to edit here // gg - added ZeroSecTick and revStr -char revStr[7] = "96"; +char revStr[7] = "97"; bool debugMode = false; bool logEn = false, logOpen = false; @@ -85,6 +85,7 @@ unsigned char dtMode = 6; char displayLog[20][40]; unsigned char displayLoc = 0; +unsigned int fwCount=1; unsigned char indexOffset = 1; bool showCP = false; //bool pollCP = false; @@ -126,6 +127,8 @@ unsigned short pointerSep; unsigned char reqMsgCnt = 99; unsigned char battTemp_x4 = 0; +bool metric = false; + int main() { char sTemp[40]; unsigned long secs; @@ -406,7 +409,7 @@ } else if (dMode[whichTouched] == indexScreen) { // gg - index dMode[whichTouched] = mainScreen ; // GoTo Main Screen sMode=0; - } else if (dMode[whichTouched]==config1Screen) { + } else if (dMode[whichTouched]==configScreen) { wait_ms(500); tt.background(Black); tt.calibrate(); @@ -437,7 +440,7 @@ } else if (dMode[whichTouched]==cpBarScreen) { // gg - cpbars reqMsgCnt=0; msgReq.attach(&sendReq,0.015); - } else if (dMode[whichTouched]==config1Screen) { + } else if (dMode[whichTouched]==configScreen) { mbed_reset(); } else if (dMode[whichTouched]==playbackScreen) { // pause/unpause playbackEn=!playbackEn; @@ -458,7 +461,7 @@ } else if (dMode[whichTouched] == indexScreen) { // gg - index dMode[whichTouched] = effScreen ; // GoTo EFF Screen sMode=0; - } else if (dMode[whichTouched]==config1Screen) { + } else if (dMode[whichTouched]==configScreen) { sprintf(sTemp,"Saving config file.\n"); printMsg(sTemp); // saving config saveConfig(); @@ -479,7 +482,7 @@ case 30: // right-most on top row - if (dMode[whichTouched]==config1Screen) { + if (dMode[whichTouched]==configScreen) { // step through skins if( skin < maxSkin ) skin += 1 ; else skin = 0 ; @@ -505,7 +508,7 @@ //---------------------------------- //---------------------------------- case 01: // left col middle row - if (dMode[whichTouched]==config1Screen) { + if (dMode[whichTouched]==configScreen) { logEn = !logEn; if (!logEn) { repeatPoll=false; // disable auto polling, too @@ -524,7 +527,7 @@ break; //------------------------------ case 11: - if (dMode[whichTouched]==config1Screen){ + if (dMode[whichTouched]==configScreen){ repeatPoll = !repeatPoll; if (repeatPoll) { autoPoll.attach(&autoPollISR,pollInt); @@ -577,7 +580,7 @@ break; //--------------------------------- case 21: // col 2 row 1 - if (dMode[whichTouched]==config1Screen) { // gg - Batt Log Enable Button + if (dMode[whichTouched]==configScreen) { // gg - Batt Log Enable Button yesBattLog = !yesBattLog; } else if (dMode[whichTouched] == indexScreen) { // gg - index dMode[whichTouched] = cpBarScreen ; // GoTo CP Bars Screen @@ -592,8 +595,10 @@ break; case 31: // col 3 row 1 - if (dMode[whichTouched]==config1Screen) { // gg - Batt Log Enable Button + if (dMode[whichTouched]==configScreen) { // gg - Batt Log Enable Button debugMode = !debugMode; + } else if (dMode[whichTouched] == indexScreen) { // gg - index + dMode[whichTouched] = configScreen ; // GoTo Config Screen } else { lastDMode[whichTouched]=99;//repaint to clear highlight } @@ -602,7 +607,9 @@ //----------------------------------- case 02: // left col, bottom row (not nav) if (dMode[whichTouched] == indexScreen) { // gg - index - dMode[whichTouched] = config1Screen ; // GoTo Config Screen + dMode[whichTouched] = playbackScreen ; // GoTo Playback Screen + } else if (dMode[whichTouched]==configScreen) { + metric = !metric; // toggle metric/imperial display } else { lastDMode[whichTouched]=99;//repaint to clear highlight } @@ -610,7 +617,7 @@ case 12: // left-middle col, bottom row (not nav) if (dMode[whichTouched] == indexScreen) { // gg - index - dMode[whichTouched] = playbackScreen ; // GoTo Playback Screen + dMode[whichTouched] = dateScreen ; // GoTo Set Date/Time Screen } else { lastDMode[whichTouched]=99;//repaint to clear highlight } @@ -618,19 +625,18 @@ case 22: // right-middle col, bottom row (not nav) if (dMode[whichTouched] == indexScreen) { // gg - index - dMode[whichTouched] = dateScreen ; // GoTo Set Date/Time Screen + dMode[whichTouched] = logScreen ; } else { lastDMode[whichTouched]=99;//repaint to clear highlight } break; - case 32: // right col, bottom row (not nav) - if (dMode[whichTouched] == indexScreen) { // gg - index - dMode[whichTouched] = logScreen ; // GoTo Log Screen - sMode=0; - } else { + case 32: // right col, bottom row (not nav) + if (dMode[whichTouched] == configScreen) { + updateFirmware(); + } else { lastDMode[whichTouched]=99;//repaint to clear highlight - } + } break; //-----------------------------------