Dual CANbus monitor and instrumentation cluster supporting ILI9341 display controller

Dependencies:   SPI_TFTx2_ILI9341 TOUCH_TFTx2_ILI9341 TFT_fonts mbed

Fork of CANary by Tick Tock

Revision:
62:ffd15edb5431
Parent:
61:3ab6a40a1086
Child:
63:aa3bf6a33635
--- a/main.cpp	Wed Apr 10 04:20:44 2013 +0000
+++ b/main.cpp	Wed Apr 10 12:55:22 2013 +0000
@@ -156,18 +156,8 @@
     strftime(sTemp, 32, "%a %m/%d/%Y %X\n", &t);
     logMsg(sTemp);
     
-    // revisions
-    // sprintf(sTemp,"CANary firmware rev51-gg1\n"); // gg - shows 4x4 buttons, 
-            // but the touch areas are still 3x3 
-    //sprintf(sTemp,"CANary firmware rev51-gg2\n"); // gg - decodes 4x4 button touches, 
-    //sprintf(sTemp,"CANary firmware rev51-gg3\n"); // gg - cleaned 4x4 button and touches, 
-    //sprintf(sTemp,"CANary firmware rev52\n"); 
-    //sprintf(sTemp,"CANary firmware rev54\n"); // merged 53 (51-gg3) and 52
-    //sprintf(sTemp,"CANary firmware rev57\n");
-    //sprintf(sTemp,"CANary firmware rev57-gg1\n"); // gg - highlight experiment
-    //sprintf(sTemp,"CANary firmware rev58\n"); // gg - highlight experiment commit and publish
-    //sprintf(sTemp,"CANary firmware rev59\n"); // gg - highlight buttons with set_display
-    sprintf(sTemp,"CANary firmware rev61\n"); // gg - merge with v60
+    // revision
+    sprintf(sTemp,"CANary firmware rev59\n");
     logMsg(sTemp);
 
     // Look for new binary on thumbdrive
@@ -356,7 +346,7 @@
         }
         //---------------
         // gg - 4x4 touch
-        unsigned char tScrn = 0 ; // screen 0
+        //unsigned char tScrn = 0 ; // screen 0
         unsigned char tCol ;                        
         unsigned char tRow ;
                         
@@ -376,16 +366,12 @@
                         //--------------
                         // gg - 4x4 touch
                         tCol = buttonX(lastTouch.x,4) ;
-                        if( tCol >= 4 ){ tCol -= 4; tScrn = 1 ; } // touch is on screen 1
-                        //if( tCol >= 4 ){ tCol -= 4; } // touch is on screen 1
+                        //if( tCol >= 4 ){ tCol -= 4; tScrn = 1 ; } // touch is on screen 1
+                        if( tCol >= 4 ){ tCol -= 4; } // touch is on screen 1
                         
                         tRow = buttonY(lastTouch.y,4) ;
                         
-                        // highlight the button (what screen?)
-                        // different highlight for tScrn, whichTouched combinations, for debugging
-                        highlightButton( tCol,tRow, tScrn, whichTouched, 4,4) ; // g - highlight
-                        // usually the screen is re-drawn after 
-                        // for now, this gives us good feedback that we can use 
+                        highlightButton( tCol,tRow, whichTouched, 4,4) ; // g - highlight
                         
                         if( tRow == tNavRow ) tRow = 7 ; //                    
                         switch ( (tCol*10) + tRow ) {
@@ -403,6 +389,8 @@
                                         playback.detach();
                                         playback.attach(&playbackISR,playbackInt);
                                     }
+                                } else {
+                                    lastDMode[whichTouched]=99;//repaint to clear highlight
                                 }
                                 break;
                             //-----------------------------------------------
@@ -422,10 +410,13 @@
                                     playbackEn=!playbackEn;
                                     if(playbackEn){
                                         playback.attach(&playbackISR,playbackInt);
-                                    }else{
+                                    } else {
                                         playback.detach();
                                     }
+                                } else {
+                                    lastDMode[whichTouched]=99;//repaint to clear highlight
                                 }
+
                                 break;
                             //--------------------------------------
                             case 20: // col 2 and row 0 on either screen 0 or 1
@@ -444,7 +435,10 @@
                                             playback.attach(&playbackISR,playbackInt);
                                         }
                                     }
+                                }else{
+                                    lastDMode[whichTouched]=99;//repaint to clear highlight
                                 }
+
                                 break;
                             //----------------------------------
                             //----------------------------------
@@ -455,7 +449,10 @@
                                 } else if (dMode[whichTouched]==dateScreen){
                                     dtMode=(dtMode<6)?dtMode+1:0;
                                     lastDMode[whichTouched]=99;
+                                } else {
+                                    lastDMode[whichTouched]=99;//repaint to clear highlight
                                 }
+
                                 break;
                             //------------------------------
                             case 11:
@@ -502,7 +499,10 @@
                                 } else if (dMode[whichTouched]==dateScreen){
                                     upDate(dtMode,true);
                                     lastDMode[whichTouched]=99;
+                                } else {
+                                    lastDMode[whichTouched]=99;//repaint to clear highlight
                                 }
+
                                 break;
                             //---------------------------------
                             case 21: // col 2 row 1
@@ -512,7 +512,10 @@
                                 } else if (dMode[whichTouched]==dateScreen){
                                     upDate(dtMode,false);
                                     lastDMode[whichTouched]=99;
+                                } else {
+                                    lastDMode[whichTouched]=99;//repaint to clear highlight
                                 }
+
                                 break;
                                 
                             //-----------------------------------
@@ -541,6 +544,7 @@
                             //------------------------------------
                             //------------------------------------
                             default:
+                                lastDMode[whichTouched]=99;//repaint to clear highlight
                                 break;
                         }
                         break;