![](/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
- Revision:
- 88:45185a5f1c9b
- Parent:
- 87:46ac3f2519d6
- Child:
- 89:2263d349b484
--- a/main.cpp Fri Apr 19 02:06:59 2013 +0000 +++ b/main.cpp Sat Apr 20 17:08:40 2013 +0000 @@ -160,11 +160,11 @@ } t = *localtime(&seconds) ; strftime(sTemp, 32, "%a %m/%d/%Y %X\n", &t); - logMsg(sTemp); // record RTC + printMsg(sTemp); // record RTC // revision sprintf(sTemp,"CANary firmware rev%s\n", revStr); // gg - for Logging the revision - logMsg(sTemp); // revision + printMsg(sTemp); // revision // Look for new binary on thumbdrive // Can't make this work right now since USB doesn't attach the right timestamp (so new binary isn't loaded) @@ -172,11 +172,11 @@ lastDMode[whichTouched]=99;//force refresh if (cfile!=NULL){ //found a new binary on the thumbdrive so copy it over sprintf(sTemp,"New binary found.\n"); - logMsg(sTemp); // new binary + printMsg(sTemp); // new binary file = fopen("/local/CANary.bin", "wb"); if (file==NULL){ //failed to open destination sprintf(sTemp,"Unable to open destination file.\n"); - logMsg(sTemp); // cannot open CANary.bin + printMsg(sTemp); // cannot open CANary.bin } else { tt.set_display(2); tt.foreground(White); @@ -214,10 +214,10 @@ } fclose(cfile); sprintf(sTemp,"History Loaded.\n"); - logMsg(sTemp); // History loaded + printMsg(sTemp); // History loaded } else { // create initial file sprintf(sTemp,"History not found. Created.\n"); - logMsg(sTemp); // history not found, created + printMsg(sTemp); // history not found, created for(i=0;i<39;i++){ // Pre-load with 4 mpkWh @ 40 mph mph[i]=40*timeConstant[i]; @@ -251,24 +251,24 @@ t = *localtime(&seconds) ; strftime(fileName, 32, "/usb/%m%d%H%M.alc", &t); //mmddhhmm.alc //sprintf(sTemp,"Using file %s\n",fileName); - //logMsg(sTemp); // using alc file ... + //printMsg(sTemp); // using alc file ... file = fopen(fileName, "ab"); lastDMode[whichTouched]=99;//force refresh if(file==NULL){ sprintf(sTemp,"\nUnable to open %s\n\n\n\n",fileName); - logMsg(sTemp); // cannot open alc file + printMsg(sTemp); // cannot open alc file logEn=false; spkr.beep(1000,0.25); } else { logOpen = true; readPointer=writePointer; sprintf(sTemp,"Starting Can Log %s\n",fileName); - logMsg(sTemp); // starting alc log file + printMsg(sTemp); // starting alc log file logTS(); // Date Time at start - logErrMsg("Starting"); // Log startup msg for testing + logEventMsg("Starting"); // Log startup msg for testing sprintf(sTemp,"Cr%s",revStr); - logErrMsg(sTemp); // gg - log firmware version + logEventMsg(sTemp); // gg - log firmware version spkr.beep(2000,0.25); } @@ -280,7 +280,7 @@ if (file == NULL) { logOpen = false; sprintf(sTemp,"Failed to append log file.\n"); - logMsg(sTemp); // failed to append + printMsg(sTemp); // failed to append spkr.beep(1000,0.25); logEn=false; } else { @@ -297,7 +297,7 @@ } // if > 1/16 full, canbus has stopped, or logging stopped if (!logEn) { sprintf(sTemp,"Stopping Can Log %s\n",fileName); - logMsg(sTemp); // stopping alc log file + printMsg(sTemp); // stopping alc log file fclose(file); logOpen=false; pointerSep=0; @@ -310,7 +310,7 @@ seconds = time(NULL); t = *localtime(&seconds) ; strftime(sTemp, 40, "Sleeping: %a %m/%d/%Y %X\n", &t); - logMsg(sTemp); // sleeping date time + printMsg(sTemp); // sleeping date time updateDisplay(0); //Added for turbo3 who has a display override and wants to see the sleep message before going to sleep updateDisplay(1); //LPC_RTC->CIIR=0x00; // block RTC interrupts @@ -333,13 +333,13 @@ seconds = time(NULL); t = *localtime(&seconds) ; strftime(sTemp, 40, "Waking: %a %m/%d/%Y %X\n", &t); - logMsg(sTemp); // wakeup date time + printMsg(sTemp); // wakeup date time if (time(NULL)>(secs+1800)) { logOpen = false; // Start new file if asleep for more than 30 minutes if (secsNoTouch>100) secsNoTouch = 100; // also mostly reset user Idle counter } else if (logOpen){ // insert timestamp on each wake if logging enabled (disabled for now) file = fopen(fileName, "ab"); - logErrMsg("WakingUp"); // gg - use messeges + logEventMsg("WakingUp"); // gg - use messeges logTS(); // Date-Time at wakeup } } // if idle @@ -366,7 +366,7 @@ sMode = 1; } //sprintf(sTemp,"%d,%d ",lastTouch.x,lastTouch.y); - //logMsg(sTemp); // touch x,y - for debug + //printMsg(sTemp); // touch x,y - for debug touched = false; // clear interrupt flag } //--------------- @@ -380,7 +380,7 @@ secsNoTouch +=2; // increment to prevent double touch sMode = 1; //sprintf(sTemp,"button %d %d,%d %d\n",i,buttonX(lastTouch.x,3),buttonY(lastTouch.y,3),lastTouch.x); - //logMsg(sTemp); // button parms - for debug + //printMsg(sTemp); // button parms - for debug switch (sMode) { case 0: // no select break; @@ -457,7 +457,7 @@ sMode=0; } else if (dMode[whichTouched]==config1Screen) { sprintf(sTemp,"Saving config file.\n"); - logMsg(sTemp); // saving config + printMsg(sTemp); // saving config saveConfig(); spkr.beep(2000,0.25); } else if (dMode[whichTouched]==playbackScreen) { // faster @@ -487,7 +487,7 @@ lastDMode[whichTouched ^ 1]=99; // repaint other screen (^ = XOR) //sprintf(sTemp,"Changed Skin to %d.\n"); - //logMsg(sTemp); /// changed skin - for debug + //printMsg(sTemp); /// changed skin - for debug //saveConfig(); //spkr.beep(2000,0.25); @@ -539,21 +539,21 @@ lastDMode[whichTouched]=99;//force refresh if(file==NULL){ sprintf(sTemp,"Unable to open /usb/playback.alc\n"); - logMsg(sTemp); // no playback.alc + printMsg(sTemp); // no playback.alc spkr.beep(1000,0.25); } else { playbackOpen = true; playbackEn=true; playback.attach(&playbackISR,playbackInt); sprintf(sTemp,"Starting playback\n"); - logMsg(sTemp); // start playback + printMsg(sTemp); // start playback spkr.beep(2000,0.25); can1.attach(&doNothing);// Stop recieving CAN data can2.attach(&doNothing); } } else { sprintf(sTemp,"Must stop logging first\n"); - logMsg(sTemp); // Must stop logging first + printMsg(sTemp); // Must stop logging first } } else { playback.detach(); @@ -691,7 +691,7 @@ laccOn=accOn; if(!accOn&&!logEn&&userIdle&&!playbackEn){ //sprintf(sTemp,"Display Off %4.2f\n",accV); - //logMsg(sTemp); // display off - for debug + //printMsg(sTemp); // display off - for debug dled = 0; // turn off display if car off and logging disabled and no user activity }else if(!headlights){