Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: displayModes.cpp
- Revision:
- 83:52b1f330a62d
- Parent:
- 73:62ee8eae3a84
- Child:
- 84:fd21e5d32dab
--- a/displayModes.cpp Tue Apr 16 21:55:41 2013 +0000
+++ b/displayModes.cpp Wed Apr 17 11:48:10 2013 +0000
@@ -768,6 +768,7 @@
void dteDisplay(bool force, bool showButtons, bool showMiles){
unsigned short i,x,y,lx,ly,gids,radius,color,r,t;
+ unsigned char toVal;
static unsigned short lgids=0;
static unsigned char leff[39]={0};
CANMessage msg;
@@ -778,26 +779,14 @@
msg = lastMsg[indexLastMsg[0x5bc]]; //Get gids
gids = (msg.data[0]<<2)+(msg.data[1]>>6);
if(gids==0){
- gids=281;
+ gids=281; // Display new, fully charged capacity until real data obtained
}
tt.background(Navy);
tt.foreground(Yellow);
if(force){
tt.cls();
- }
- if(force||lgids!=gids){
- tt.set_font((unsigned char*) Arial12x12);
- for(i=0;i<10;i++){
- y=200-i*20;
- tt.locate(10,y-8);
- if (showMiles){
- printf("%3.0f\n",i*((float)(gids-5)*.075));
- }else{
- printf("%d.0\n",i);
- }
- tt.line(40,y,254,y,DarkGrey);
- }
+ toVal=33;
x=50+0*6;
tt.locate(x-10,226);
@@ -810,7 +799,7 @@
x=50+18*6;
tt.locate(x-10,226);
printf("hour\n");
- tt.line(x,10,x,220,DarkGrey);
+ tt.line(x,10,x,220,DarkGrey);
x=50+25*6;
tt.locate(x-10,226);
printf("day\n");
@@ -823,16 +812,27 @@
//tt.locate(x-10,226);
//printf("year\n");
//tt.line(x,10,x,220,DarkGrey);
- lgids=gids;
+ } else {
+ toVal=18;// no need to constantly update the long tc values
}
- if(force||updateDTE){
+ if(force||lgids!=gids){ // update Y axis when kWh changes
+ tt.set_font((unsigned char*) Arial12x12);
for(i=0;i<10;i++){
y=200-i*20;
- if (y>60){
- tt.line(40,y,250,y,DarkGrey);
- } else {
- tt.line(40,y,150,y,DarkGrey);
+ tt.locate(10,y-8);
+ if (showMiles){
+ printf("%3.0f\n",i*((float)(gids-5)*.075));
+ }else{
+ printf("%d.0\n",i);
}
+ tt.line(40,y,toVal*6+56,y,DarkGrey);
+ }
+ lgids=gids;
+ }
+ if(updateDTE){
+ for(i=0;i<10;i++){
+ y=200-i*20;
+ tt.line(40,y,158,y,DarkGrey);
}
x=50+0*6;
@@ -841,10 +841,10 @@
tt.line(x,10,x,220,DarkGrey);
x=50+18*6;
tt.line(x,10,x,220,DarkGrey);
- x=50+25*6;
- tt.line(x,60,x,220,DarkGrey);
- x=50+32*6;
- tt.line(x,60,x,220,DarkGrey);
+ //x=50+25*6;
+ //tt.line(x,60,x,220,DarkGrey);
+ //x=50+32*6;
+ //tt.line(x,60,x,220,DarkGrey);
//x=50+38*6;
//tt.line(x,60,x,220,DarkGrey);
tt.set_font((unsigned char*) SCProSB31x55);
@@ -865,7 +865,7 @@
}
if(dtePeriod==0){
radius=6;
- color=Magenta;
+ color=Yellow;
}else{
radius=2;
color=Green;
@@ -873,7 +873,7 @@
tt.fillcircle(lx,leff[0],radius,Navy);
tt.fillcircle(lx,ly,radius,color);
- for(i=1;i<33;i++){
+ for(i=1;i<toVal;i++){
x=50+i*6;
y=mpkWh[i]*20;
if(y<200) {
@@ -882,8 +882,8 @@
y=0;
}
if(i==dtePeriod){
- radius=4;
- color=Magenta;
+ radius=6;
+ color=Yellow;
}else{
radius=2;
color=Green;
