Dual CANbus monitor and instrumentation cluster

Dependencies:   SPI_TFTx2 TFT_fonts TOUCH_TFTx2 beep mbed

Fork of CANary by Tick Tock

Revision:
92:935adef49ea4
Parent:
89:2263d349b484
Child:
93:c2402e8cd0e2
--- a/displayModes.cpp	Mon Apr 22 02:22:04 2013 +0000
+++ b/displayModes.cpp	Mon Apr 22 02:27:37 2013 +0000
@@ -11,7 +11,7 @@
     tt.background(Yellow);
     if(force) tt.cls(); // Just clear screen if forced - always update display
     tt.set_font((unsigned char*) Arial12x12_prop);  // select the font
-    for(int i=0; i<19; ++i){
+    for(int i=0; i<19; i++){
         msg = lastMsg[i+indexOffset];
         printf("%03x : %02x %02x %02x %02x %02x %02x %02x %02x    \n",msg.id,msg.data[0],msg.data[1],msg.data[2],msg.data[3],msg.data[4],msg.data[5],msg.data[6],msg.data[7]);
     }
@@ -40,7 +40,7 @@
         if(msgChanged[j]>0){
             msg = lastMsg[j];
             printf("%03x : %02x %02x %02x %02x %02x %02x %02x %02x    \n",msg.id,msg.data[0],msg.data[1],msg.data[2],msg.data[3],msg.data[4],msg.data[5],msg.data[6],msg.data[7]);
-            ++i;
+            i++;
         }// if changed
     }while(i<19&&j<99);
     if((sMode==1)&&showButtons){
@@ -62,7 +62,7 @@
         tt.cls();
         tt.locate(0,6);
         tt.set_font((unsigned char*) Arial12x12);
-        for(int i=0; i<19; ++i){
+        for(int i=0; i<19; i++){
             printf("%s",displayLog[displayLoc]);
             displayLoc=displayLoc>17?0:displayLoc+1;
         }
@@ -252,7 +252,7 @@
     }
 
     // plot bar graph for each wheel pressure
-    for (i=0; i<4; ++i){
+    for (i=0; i<4; i++){
         if (msg.data[i]<239) {
             if (msg.data[i]>lastPressure[i]){
                 tt.fillrect(10+40*i,239-msg.data[i],40+40*i,239,Red);
@@ -322,7 +322,7 @@
         max=0;
         min=9999;
         avg=0;
-        for(i=0; i<96; ++i){
+        for(i=0; i<96; i++){
            bd=(battData[i*2+3]<<8)+battData[i*2+4];
            avg+=bd;
             if(bd>max) max=bd;
@@ -340,7 +340,7 @@
         printf(" MAX  MIN  AVG CVLI T1  T2  T3  T4\n %04d %04d %04d %04d %02dC %02dC %02dC %02dC\n\n",
                     max,min,avg,jv, battData[224+5],battData[224+8],battData[224+11],battData[224+14]);
         tt.locate(0,36);
-        for(i=0; i<16; ++i){
+        for(i=0; i<16; i++){
             printf("%02d-%02d : %04d %04d %04d %04d %04d %04d\n",
                 i*6+1,i*6+6,
                 (battData[i*12+3]<<8)+battData[i*12+4],(battData[i*12+5]<<8)+battData[i*12+6],
@@ -351,7 +351,7 @@
         tt.rect(8+1*41,16,40+1*41,28,Yellow);
         //tt.rect(8+2*41,16,40+2*41,28,White);
         tt.rect(8+3*41,16,40+3*41,28,Red);
-        for(i=0; i<96; ++i){
+        for(i=0; i<96; i++){
             bd=(battData[i*2+3]<<8)+battData[i*2+4];
             if(bd>0){
                 if(bd==max) tt.rect(58+(i%6)*41,34+(int)(i/6)*12,90+(i%6)*41,46+(int)(i/6)*12,Green);
@@ -431,7 +431,7 @@
         avg=0;
        
         // calc each cell-pair voltage, find max and min
-        for(i=0; i<96; ++i){
+        for(i=0; i<96; i++){
            bd=(battData[i*2+3]<<8)+battData[i*2+4];
            nBar[i] = bd; // init to bar height
            avg+=bd;
@@ -470,7 +470,7 @@
             max = min + 95/4 ; // for small values
             avg = ( max + min ) / 2;
             iBarValMax = max - min ; // zero to N
-            for(int i=0; i<96; ++i) {
+            for(int i=0; i<96; i++) {
               //nBar[i] = i*2 + min ; // test tall values
               nBar[i] = i/4 + min ; // test small values
             }
@@ -480,7 +480,7 @@
         if( nBarScale < 0.1 ) nBarScale = 0.1 ;
     
         // do the Bar-height scaling
-        for(int i=0; i<96; ++i){
+        for(int i=0; i<96; i++){
           nBar[i] -= min ; // now, 0 to N = iBinValMax
           nBar[i] *= nBarScale ; // scale, as needed
         }
@@ -503,7 +503,7 @@
         
         int xPos = xWinMin + 2 ; // start one from the left
          
-        for( int i=0; i<96; ++i) {
+        for( int i=0; i<96; i++) {
             height = nBar[i] ;
             if( height > 100 ) height = 100 ; // clip tops
             
@@ -551,7 +551,7 @@
         max=0;
         min=9999;
         avg=0;
-        for(i=0; i<96; ++i){
+        for(i=0; i<96; i++){
            bd=(battData[i*2+3]<<8)+battData[i*2+4];
            avg+=bd;
             if(bd>max) max=bd;
@@ -584,15 +584,15 @@
         if( iBinValMax > iBinIndxMax ) iBinValMax = iBinIndxMax ;
     
         // clean the bins
-        for(int i=0; i<=iBinIndxMax; ++i) {
+        for(int i=0; i<=iBinIndxMax; i++) {
           nBin[i] = 0;
         }
         
         // do the bin counting
-        for(int i=0; i<96; ++i){
+        for(int i=0; i<96; i++){
           bd=(battData[i*2+3]<<8)+battData[i*2+4] - min ;
           if( bd > iBinValMax ) bd = iBinValMax ;
-          ++nBin[bd] ;
+          nBin[bd] ++ ;
         }
         
         //----------------
@@ -602,7 +602,7 @@
             max = 50 ;
             avg = ( max + min ) / 2;
             iBinValMax = max - min ;
-            for(int i=0; i<=(iBinValMax/2); ++i) {
+            for(int i=0; i<=(iBinValMax/2); i++) {
               nBin[i] = i ;
               nBin[iBinValMax-i] = i ;
             }
@@ -622,7 +622,7 @@
         int xPos = (xWinMin + xWinMax) / 2 ; 
         xPos -= (avg-min) * (nBarWidth + nBarSpace) ;
         
-        for( int i=0; i<=iBinValMax; ++i) {
+        for( int i=0; i<=iBinValMax; i++) {
             height = 4 * nBin[i] ;
             if( height > 100 ) height = 100 ; // clip tops
             
@@ -832,7 +832,7 @@
     }
     if(force||lgids!=gids){ // update Y axis when kWh changes
         tt.set_font((unsigned char*) Arial12x12);
-        for(i=0;i<10;++i){
+        for(i=0;i<10;i++){
             y=200-i*20;
             tt.locate(10,y-8);
             if (showMiles){
@@ -845,7 +845,7 @@
         lgids=gids;    
     }
     if(updateDTE||force){
-        for(i=0;i<10;++i){
+        for(i=0;i<10;i++){
             y=200-i*20;
             tt.line(40,y,158,y,DarkGrey);
         }
@@ -888,7 +888,7 @@
         tt.fillcircle(lx,leff[0],radius,Navy);
         tt.fillcircle(lx,ly,radius,color);
 
-        for(i=1;i<toVal;++i){
+        for(i=1;i<toVal;i++){
             x=50+i*6;
             y=mpkWh[i]*20;
             if(y<200) {
@@ -1197,7 +1197,7 @@
         lastPressure[3] = 200;
     }
     // plot bar graph for each wheel pressure
-    for (i=0; i<4; ++i){
+    for (i=0; i<4; i++){
         if (msg.data[i]<239) {
             if (msg.data[i]>lastPressure[i]){
                 tt.fillrect(10+40*i,239-msg.data[i],40+40*i,239,Red);