improved backlight dimming parameters
This commit is contained in:
parent
516089168d
commit
68abf87a9c
@ -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;
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user