View Single Post
Old 11-05-2009, 09:56 AM   #1 (permalink)
meelis11
EcoModding Apprentice
 
meelis11's Avatar
 
Join Date: Feb 2009
Location: Estonia
Posts: 199

Green frog - '97 Audi A4 Avant 1.9TDI 81kW
Diesel
90 day: 43.1 mpg (US)
Thanks: 19
Thanked 40 Times in 28 Posts
MPGuino custom characters? Some optimisation suggestions

Hey,
has anybody made custom characters which are more descriptive than "LK" example?
I somewhere saw pictures, where somebody had made custom characters for example "L/100km" - it was made with 2 chars - first char was showing "L\n/1" and second "km\n00" - "\n" means newline - so imagine it as
"L/ km"
" 100"
Would be nice to know how to make them or link where I can get info.

One good hack/optimisation for code also:
I put clear screen commands before every screen change - now that half second when it shows screen name, it is only name - second line is clear. Now you can delete all trailing spaces in screen names and other strings. As a result you should save some bytes (did not count but it was less than before and screen names are clear to read)

inside setup()
Code:
  
  LCD::LcdCommandWrite(B00000001);  // clear display, set cursor position to zero         
  LCD::LcdCommandWrite(B10000);  // set dram to zero

  //LCD::gotoXY(0,0); //no need for it, clear display already made gotoxy(0,0)
  //LCD::print(getStr(PSTR("OpenGauge       ")));
  LCD::print(getStr(PSTR("OpenGauge")));  

  //LCD::gotoXY(0,1);      
  //LCD::print(getStr(PSTR("  MPGuino  v0.75"))); 
  LCD::gotoXY(2,1);      
  LCD::print(getStr(PSTR("MPGuino  v0.75")));
inside loop()
Code:
   //LCD::gotoXY(0,0); //no need for it, clear display sets it gotoxy(0,0)
   //is any of three buttons is pressed, clear display
   if( !(buttonState&lbuttonBit)  || !(buttonState&mbuttonBit) || !(buttonState&rbuttonBit) ){
      LCD::LcdCommandWrite(B00000001);  // clear display, set cursor position to zero
   }

   //see if any buttons were pressed, display a brief message if so      
   if(!(buttonState&lbuttonBit) && !(buttonState&rbuttonBit)){
      LCD::print(getStr(PSTR("Setup"))); //remove trailing spaces "Setup " -> "Setup"
      initGuino();
   }
   //....code continues
Meelis

  Reply With Quote