FIX: double-buffer needs to take 'brightness' into account
This commit is contained in:
parent
4c8068d2cf
commit
a039947e13
@ -35,6 +35,8 @@ private:
|
||||
|
||||
Color *buffer = nullptr;
|
||||
|
||||
uint8_t brightness = 10;
|
||||
|
||||
public:
|
||||
|
||||
Display(uint8_t width, uint8_t height) :
|
||||
@ -60,7 +62,6 @@ public:
|
||||
|
||||
void setup() {
|
||||
leds.begin();
|
||||
leds.setBrightness(8);
|
||||
clear();
|
||||
flush();
|
||||
}
|
||||
@ -73,12 +74,12 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void setBrightness(uint8_t brightness) {
|
||||
leds.setBrightness(brightness);
|
||||
void setBrightness(uint8_t value) {
|
||||
brightness = value;
|
||||
}
|
||||
|
||||
uint8_t getBrightness() {
|
||||
return leds.getBrightness();
|
||||
uint8_t getBrightness() const {
|
||||
return brightness;
|
||||
}
|
||||
|
||||
void clear() {
|
||||
@ -124,7 +125,11 @@ public:
|
||||
if (buffer == nullptr) {
|
||||
return;
|
||||
}
|
||||
buffer[index] = color;
|
||||
buffer[index] = {
|
||||
(uint8_t) (color.r * brightness >> 8),
|
||||
(uint8_t) (color.g * brightness >> 8),
|
||||
(uint8_t) (color.b * brightness >> 8)
|
||||
};
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@ -86,7 +86,7 @@ void web_brighter() {
|
||||
}
|
||||
|
||||
void web_darker() {
|
||||
setBrightness(max(1, display.getBrightness() - 10));
|
||||
setBrightness(display.getBrightness() - 10);
|
||||
redirect();
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user