View Single Post
Old 09-27-2013, 12:40 PM   #92 (permalink)
t vago
MPGuino Supporter
 
t vago's Avatar
 
Join Date: Oct 2010
Location: Hungary
Posts: 1,807

iNXS - '10 Opel Zafira 111 Anniversary

Suzi - '02 Suzuki Swift GL
Thanks: 830
Thanked 708 Times in 456 Posts
Quote:
Originally Posted by Ardent View Post
Here are some backlight code changes I like: (items need to be placed in their proper locations)

Code:
//Backlight range changes
const uint8_t brightness[] PROGMEM = { 0, 85, 170, 255 }; //middle button cycles through these brightness settings

const char brightString[] PROGMEM = {
   "HIGH\0"
   " MED\0"
   " LOW\0"
   " OFF\0"
};

//Changed 0 to 3 for OFF while sleeping
LCD::setBright(3); // set backlight brightness to zero
//Initial brightness
uint8_t brightnessIdx = 2;  //brightness at startup. 2 = LOW
//Descriptive brightness labels
void doNextBright(void) {
	brightnessIdx++;
	if (brightnessIdx >= brightnessLength) brightnessIdx = 0;
	LCD::setBright(brightnessIdx);
	printFlash(PSTR("Backlight = "));

   printStr(brightString, brightnessIdx);
   clrEOL();
   gotoXY(0, 1);
   clrEOL();

	holdDisplay = holdDelay;
}
Done. I've added the above code in (made a few changes - hope you don't mind). I've made it selectable at compile-time via a "#define".
  Reply With Quote