test fork
Dependencies: SPI_TFTx2 SPI_TFTx2_ILI9341 TFT_fonts TOUCH_TFTx2 mbed
Fork of CANary_9341 by
Diff: displayModes.cpp
- Revision:
- 158:059abeb44ba1
- Parent:
- 157:1a100a5ed06f
- Child:
- 159:577e9d015693
diff -r 1a100a5ed06f -r 059abeb44ba1 displayModes.cpp --- a/displayModes.cpp Wed Oct 30 03:16:51 2013 +0000 +++ b/displayModes.cpp Thu Oct 31 14:41:24 2013 +0000 @@ -897,20 +897,9 @@ tt.cls(); } //-------- top row -------- - //showButton(0,0,"Calibrate"," Touch",4,4); // gg - 4x4 showButton(1,0," Reset","",4,4); showButton(2,0," Save"," Config",4,4); - - // a button to step to the next skin - //unsigned int nextSkin = skin + 1 ; - //if( nextSkin > maxSkin ) nextSkin = 0 ; - - //if( nextSkin == ttSkin ) sprintf(sTemp1,"Skin TT"); - //else if( nextSkin == ggSkin ) sprintf(sTemp1,"Skin GG"); - //else sprintf(sTemp1,"Skin %d",nextSkin); - - //showButton(3,0," Use",sTemp1,4,4); - + //------- second row ----- if (logEn&&usbEn) { sprintf(sTemp1,"Disable"); @@ -933,15 +922,8 @@ sprintf(sTemp1,"Enable"); } showButton(2,1,sTemp1,"Batt Log",4,4); - - // add Enable/Disable Debug - debugMode - //if (debugMode) { - // sprintf(sTemp1," Disable"); - //} else { - // sprintf(sTemp1," Enable"); - //} - //showButton(3,1,sTemp1," Debug",4,4); + //------- third row ----- if(brakeMon) showButton(0,2,"Disable","BrkMon",4,4); else @@ -951,16 +933,6 @@ showButton(1,2,"Disable","RegMon",4,4); else showButton(1,2," Enable"," RegMon",4,4); - - //showButton(1,2," Set"," Time",4,4); - //if (showHealth) { - // sprintf(sTemp1," Hide"); - //} else { - // sprintf(sTemp1," Show"); - //} - //showButton(2,2,sTemp1," Health",4,4); - //showButton(3,2,"Update","Firmware",4,4); - } void config2(bool force, bool showButtons){ @@ -970,8 +942,6 @@ } //-------- top row -------- showButton(0,0,"Calibrate"," Touch",4,4); // gg - 4x4 - showButton(1,0," Reset"," DTE",4,4); - //showButton(2,0," Save"," Config",4,4); // a button to step to the next skin unsigned int nextSkin = skin + 1 ; @@ -984,28 +954,6 @@ showButton(3,0," Use",sTemp1,4,4); //------- second row ----- - //if (logEn&&usbEn) { - // sprintf(sTemp1,"Disable"); - //} else { - // sprintf(sTemp1,"Enable"); - //} - //showButton(0,1,sTemp1,"Logging",4,4); - - //if (repeatPoll) { - // sprintf(sTemp1,"Disable"); - //} else { - // sprintf(sTemp1,"Enable"); - //} - //showButton(1,1,sTemp1,"Auto CP",4,4); - - // add Enable/Disable Batt Log gg - yesBattLog - //if (yesBattLog) { - // sprintf(sTemp1,"Disable"); - //} else { - // sprintf(sTemp1,"Enable"); - //} - //showButton(2,1,sTemp1,"Batt Log",4,4); - // add Enable/Disable Debug - debugMode if (debugMode) { sprintf(sTemp1," Disable"); @@ -1014,11 +962,13 @@ } showButton(3,1,sTemp1," Debug",4,4); - //if(brakeMon) - // showButton(0,2,"Disable","BrkMon",4,4); - //else - // showButton(0,2," Enable"," BrkMon",4,4); - + //------- third row ----- + if (autoSync) { + sprintf(sTemp1," Disable"); + } else { + sprintf(sTemp1," Enable"); + } + showButton(0,2,sTemp1," tSync",4,4); showButton(1,2," Set"," Time",4,4); if (showHealth) { sprintf(sTemp1," Hide"); @@ -1027,7 +977,6 @@ } showButton(2,2,sTemp1," Health",4,4); showButton(3,2,"Update","Firmware",4,4); - } void pbScreen(bool force, bool showButtons){ @@ -1341,8 +1290,8 @@ } void testDisplay (bool force, bool showButtons){ - static unsigned short maxPS=0; - unsigned char i, uData[8], year, month, day, hour, minute, second; + static unsigned short maxPS=0, oldData[8]={0}; + unsigned char i, uData[8];//, year, month, day, hour, minute, second; CANMessage msg; tt.set_font((unsigned char*) Arial24x23); @@ -1351,10 +1300,12 @@ if(force){ tt.cls(); } - if(pointerSep>maxPS){maxPS=pointerSep;} - tt.locate(10,10); - printf("%3d sep %3d max\n",pointerSep,maxPS); - msg = lastMsg[indexLastMsg[0x5fa]]; + if(logEn){ + if(pointerSep>maxPS){maxPS=pointerSep;} + tt.locate(10,10); + printf("%3d sep %3d max\n",pointerSep,maxPS); + } + /*msg = lastMsg[indexLastMsg[0x5fa]]; month = msg.data[5]>>4; day = msg.data[2]>>3; msg = lastMsg[indexLastMsg[0x5fb]]; @@ -1364,16 +1315,58 @@ minute = (msg.data[1]<<4&0x30)+(msg.data[2]>>4); second = msg.data[1]>>2; tt.locate(0,40); - printf("%02d%02d%02d %02d%02d%03d\n",hour,minute,second,month,day,year); + printf("%02d%02d%02d %02d%02d%03d\n",hour,minute,second,month,day,year);*/ //printf("%4.2fV %4.2fV \n",accV,accV2); + + /*for (i=0; i<4; i++){ + msg = lastMsg[indexLastMsg[(uMsgId[i]>>4)]]; + uData[i] = msg.data[(uMsgId[i]&0x000f)]; + msg = lastMsg[indexLastMsg[(uMsgId[i+4]>>4)]]; + uData[i+4] = msg.data[(uMsgId[i+4]&0x000f)]; + tt.locate(10,90+i*30); + if(clearTest){ + oldData[i]=uData[i]; + oldData[i+4]=uData[i+4]; + tt.foreground(Yellow); + tt.background(Navy); + printf("%4x:%2x %4x:%2x\n",uMsgId[i],uData[i],uMsgId[i+4],uData[i+4]); + }else if((uData[i]!=oldData[i])||(uData[i+4]!=oldData[i+4])){ + tt.foreground(Yellow); + tt.background(Navy); + tt.foreground(Navy); + tt.background(Yellow); + printf("%4x:%2x %4x:%2x\n",uMsgId[i],uData[i],uMsgId[i+4],uData[i+4]); + }else if(force){ + tt.foreground(Yellow); + tt.background(Navy); + printf("%4x:%2x %4x:%2x\n",uMsgId[i],uData[i],uMsgId[i+4],uData[i+4]); + } + }*/ for (i=0; i<8; i++){ msg = lastMsg[indexLastMsg[(uMsgId[i]>>4)]]; uData[i] = msg.data[(uMsgId[i]&0x000f)]; + if(i%2==0){ + tt.locate(10,90+(i/2)*30); + }else{ + tt.locate(170,90+(i/2)*30); + } + if(clearTest){ + oldData[i]=uData[i]; + tt.foreground(Yellow); + tt.background(Navy); + printf("%4x:%2x\n",uMsgId[i],uData[i]); + }else if(uData[i]!=oldData[i]){ + tt.foreground(Navy); + tt.background(Yellow); + printf("%4x:%2x\n",uMsgId[i],uData[i]); + }else if(force){ + tt.foreground(Yellow); + tt.background(Navy); + printf("%4x:%2x\n",uMsgId[i],uData[i]); + } } - for (i=0; i<4; i++){ - tt.locate(10,90+i*30); - printf("%4x:%2x %4x:%2x\n",uMsgId[i],uData[i],uMsgId[i+4],uData[i+4]); - } + clearTest=false; + showButton(3,0,"Reset","flags",4,4); } void updateDisplay(char display){ @@ -1526,7 +1519,6 @@ sprintf(sTemp2,"Health"); break; case testScreen: - showButton(3,0,sTemp1,"",4,4); sprintf(sTemp2," Test"); break; case indexScreen: // gg - index