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...
|
// it can get hotter...
|
||||||
if (callcounter < 8) {
|
if (callcounter < 8) {
|
||||||
speed += 4;
|
speed += 4;
|
||||||
} else if (callcounter < 16) {
|
|
||||||
speed += 3;
|
|
||||||
} else if (callcounter < 24) {
|
|
||||||
speed += 2;
|
|
||||||
} else {
|
} else {
|
||||||
speed += 1;
|
speed += 2;
|
||||||
}
|
}
|
||||||
setSpeed(speed);
|
setSpeed(speed);
|
||||||
|
} else if (speed < 255) {
|
||||||
|
speed = 255;
|
||||||
|
setSpeed(speed);
|
||||||
}
|
}
|
||||||
callcounter = 0;
|
callcounter = 0;
|
||||||
} else {
|
} else {
|
||||||
// no key pressed...
|
// no key pressed...
|
||||||
if (callcounter == 16) {
|
if (callcounter == 16) {
|
||||||
// ... for a long time, decrease speed value
|
// ... for a long time, decrease speed value
|
||||||
if (speed > 10) {
|
if (speed > 8) {
|
||||||
speed -= 10;
|
speed -= 8;
|
||||||
setSpeed(speed);
|
setSpeed(speed);
|
||||||
} else if (speed > 0) {
|
} else if (speed > 0) {
|
||||||
speed = 0;
|
speed = 0;
|
||||||
|
@ -117,8 +117,9 @@ void printMatrix(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setSpeed(uint8_t speed) {
|
void setSpeed(uint8_t speed) {
|
||||||
OCR1A = 0xffff - (speed * speed);
|
uint16_t value = (speed + 1) * (speed + 1) - 1;
|
||||||
OCR1B = (speed * speed);
|
OCR1A = 0xffff - value;
|
||||||
|
OCR1B = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setLeds(uint8_t LEDstate) {
|
void setLeds(uint8_t LEDstate) {
|
||||||
|
Loading…
Reference in New Issue
Block a user