test fork
Dependencies: SPI_TFTx2 SPI_TFTx2_ILI9341 TFT_fonts TOUCH_TFTx2 mbed
Fork of CANary_9341 by
Diff: main.cpp
- Revision:
- 11:e9d155aad4e2
- Parent:
- 10:ebc6326d9bd6
- Child:
- 12:8e42d7ba8468
--- a/main.cpp Wed Feb 27 02:59:11 2013 +0000 +++ b/main.cpp Wed Feb 27 03:47:06 2013 +0000 @@ -25,9 +25,10 @@ InterruptIn touchpad(p17); CAN can1(p9, p10); // CAN2 uses pins 9 and 10 (rx, tx) and pin 27 (rs) -DigitalOut can2SleepMode(p8); // Use pin 8 to control the sleep mode of can2 +DigitalOut can1SleepMode(p8); // Use pin 8 to control the sleep mode of can2 CAN can2(p30, p29); // CAN1 uses pins 30 and 29 (rx, tx) and pin 28 (rs) -DigitalOut can1SleepMode(p28); // Use pin 28 to control the sleep mode of can1 +DigitalOut can2SleepMode(p28); // Use pin 28 to control the sleep mode of can1 + bool logEn = true,logOpen = false; FILE *rfile; FILE *file; @@ -404,14 +405,11 @@ unsigned avg; if(force){ tt.foreground(White); - tt.background(Maroon); + tt.background(Navy); tt.set_font((unsigned char*) Arial12x12_prop); // select the font max=0; min=9999; avg=0; - //battData[4]=2; - //battData[38]=8; - //battData[79]=3; for(i=0; i<96; i++){ bd=(battData[i*2+3]<<8)+battData[i*2+4]; avg+=bd; @@ -422,17 +420,20 @@ jv=avg-(max-avg)*2.5; tt.cls(); tt.locate(0,6); - //printf("cellpair temperatures: %dC %dC %dC %dC\ncellpair voltages (mV):\n\n",battData[224+5],battData[224+8],battData[224+11],battData[224+14]); - printf(" MAX MIN AVG CVLI T1 T2 T3 T4\n %04d %04d %04d %04d %dC %dC %dC %dC\n\n",max,min,avg,jv,battData[224+5],battData[224+8],battData[224+11],battData[224+14]); + 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++){ 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],(battData[i*12+7]<<8)+battData[i*12+8],(battData[i*12+9]<<8)+battData[i*12+10],(battData[i*12+11]<<8)+battData[i*12+12],(battData[i*12+13]<<8)+battData[i*12+14]); } + tt.rect(8+0*41,16,40+0*41,28,Green); + 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++){ 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); - if(bd==avg) tt.rect(58+(i%6)*41,34+(int)(i/6)*12,90+(i%6)*41,46+(int)(i/6)*12,White); + //if(bd==avg) tt.rect(58+(i%6)*41,34+(int)(i/6)*12,90+(i%6)*41,46+(int)(i/6)*12,White); if(bd==min) tt.rect(58+(i%6)*41,34+(int)(i/6)*12,90+(i%6)*41,46+(int)(i/6)*12,Yellow); if(bd<jv) tt.rect(58+(i%6)*41,34+(int)(i/6)*12,90+(i%6)*41,46+(int)(i/6)*12,Red); }