Dual CANbus monitor and instrumentation cluster

Dependencies:   SPI_TFTx2 TFT_fonts TOUCH_TFTx2 beep mbed

Fork of CANary by Tick Tock

Revision:
59:58894493fb29
Parent:
58:4d06288d75a2
--- a/main.cpp	Tue Apr 09 20:09:31 2013 +0000
+++ b/main.cpp	Wed Apr 10 04:06:23 2013 +0000
@@ -165,7 +165,7 @@
     //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 experiment commit and publish
     logMsg(sTemp);
 
     // Look for new binary on thumbdrive
@@ -354,7 +354,7 @@
         }
         //---------------
         // gg - 4x4 touch
-        unsigned char tScrn = 0 ; // screen 0
+        //unsigned char tScrn = 0 ; // screen 0
         unsigned char tCol ;                        
         unsigned char tRow ;
                         
@@ -374,14 +374,14 @@
                         //--------------
                         // 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
+                        highlightButton( tCol,tRow, whichTouched, 4,4) ; // g - highlight
                         // usually the screen is re-drawn after 
                         // for now, this gives us good feedback that we can use 
                         
@@ -401,6 +401,8 @@
                                         playback.detach();
                                         playback.attach(&playbackISR,playbackInt);
                                     }
+                                } else {
+                                    lastDMode[whichTouched]=99;//repaint to clear highlight
                                 }
                                 break;
                             //-----------------------------------------------
@@ -420,10 +422,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
@@ -442,7 +447,10 @@
                                             playback.attach(&playbackISR,playbackInt);
                                         }
                                     }
+                                }else{
+                                    lastDMode[whichTouched]=99;//repaint to clear highlight
                                 }
+
                                 break;
                             //----------------------------------
                             //----------------------------------
@@ -453,7 +461,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:
@@ -500,7 +511,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
@@ -510,7 +524,10 @@
                                 } else if (dMode[whichTouched]==dateScreen){
                                     upDate(dtMode,false);
                                     lastDMode[whichTouched]=99;
+                                } else {
+                                    lastDMode[whichTouched]=99;//repaint to clear highlight
                                 }
+
                                 break;
                                 
                             //-----------------------------------
@@ -539,6 +556,7 @@
                             //------------------------------------
                             //------------------------------------
                             default:
+                                lastDMode[whichTouched]=99;//repaint to clear highlight
                                 break;
                         }
                         break;