Attempts to merge SPI_TFT2 & SPI_TFT_ILI9341

Dependencies:   SPI_TFTx2 TFT_fonts TOUCH_TFTx2 mbed

Fork of CANary by Tick Tock

Revision:
153:e94cfe3c339c
Parent:
152:a4d66901785d
Child:
154:90ea16ca7475
--- a/displayModes.cpp	Sun Oct 06 14:49:09 2013 +0000
+++ b/displayModes.cpp	Sat Oct 12 03:48:30 2013 +0000
@@ -1017,16 +1017,26 @@
         tt.set_font((unsigned char*) Arial12x12);
         if(accOn){
             seconds = time(NULL);
-            t = *localtime(&seconds);        
-            msg = lastMsg[indexLastMsg[0x5fa]];
-            t.tm_mon = (msg.data[5]>>4)-1;
-            t.tm_mday = msg.data[2]>>3;
-            msg = lastMsg[indexLastMsg[0x5fb]];
-            //t.tm_year = msg.data[1];
-            msg = lastMsg[indexLastMsg[0x5fc]];
-            t.tm_hour = msg.data[0]>>3;
-            t.tm_min = (msg.data[1]<<4&0x30)+(msg.data[2]>>4);
-            t.tm_sec = msg.data[1]>>2;
+            t = *localtime(&seconds);
+            
+            if(modelYear<2013){
+                msg = lastMsg[indexLastMsg[0x5fa]];
+                t.tm_mon = (msg.data[5]>>4)-1;
+                t.tm_mday = msg.data[2]>>3;
+                // Have not figured out where the year is on MY2011
+                msg = lastMsg[indexLastMsg[0x5fc]];
+                t.tm_hour = msg.data[0]>>3;
+                t.tm_min = (msg.data[1]<<4&0x30)+(msg.data[2]>>4);
+                t.tm_sec = msg.data[1]>>2;
+            }else{
+                // Have not figured out where Year, Month, or Day is for MY2013
+                msg = lastMsg[indexLastMsg[0x5f9]];
+                t.tm_hour = msg.data[5]>>3;
+                t.tm_min = msg.data[4];
+                msg = lastMsg[indexLastMsg[0x509]];
+                t.tm_sec = msg.data[2]>>2;
+            }
+
             strftime(sTemp1, 32, "%a %m/%d/%Y %X  \n", &t);
             //printf("Leaf: %02d:%02d:%02d %02d/%02d/%03d\n",hour,minute,second,month,day,year);
             printf("Leaf: %s",sTemp1);