improved backlight dimming parameters

This commit is contained in:
Ronald Schaten 2008-11-16 00:38:12 +00:00
parent 516089168d
commit 68abf87a9c
2 changed files with 9 additions and 9 deletions

View File

@ -540,22 +540,21 @@ void calculateSpeed(uint8_t updates) {
// it can get hotter...
if (callcounter < 8) {
speed += 4;
} else if (callcounter < 16) {
speed += 3;
} else if (callcounter < 24) {
speed += 2;
} else {
speed += 1;
speed += 2;
}
setSpeed(speed);
} else if (speed < 255) {
speed = 255;
setSpeed(speed);
}
callcounter = 0;
} else {
// no key pressed...
if (callcounter == 16) {
// ... for a long time, decrease speed value
if (speed > 10) {
speed -= 10;
if (speed > 8) {
speed -= 8;
setSpeed(speed);
} else if (speed > 0) {
speed = 0;

View File

@ -117,8 +117,9 @@ void printMatrix(void) {
}
void setSpeed(uint8_t speed) {
OCR1A = 0xffff - (speed * speed);
OCR1B = (speed * speed);
uint16_t value = (speed + 1) * (speed + 1) - 1;
OCR1A = 0xffff - value;
OCR1B = value;
}
void setLeds(uint8_t LEDstate) {