Small fixes to Clock effect.
This commit is contained in:
parent
002313f9b3
commit
659181b25c
16
effects.h
16
effects.h
@ -88,7 +88,7 @@ class BigClock : public Effect {
|
|||||||
|
|
||||||
class Clock : public Effect {
|
class Clock : public Effect {
|
||||||
private:
|
private:
|
||||||
Window window = {0, LED_HEIGHT - 5, LED_WIDTH, 5};
|
Window window = {0, LED_HEIGHT - 6, LED_WIDTH, 6};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Clock() {}
|
Clock() {}
|
||||||
@ -98,7 +98,7 @@ class Clock : public Effect {
|
|||||||
clear(window, bg_color);
|
clear(window, bg_color);
|
||||||
} else {
|
} else {
|
||||||
// Manually clear the needed parts
|
// Manually clear the needed parts
|
||||||
for(int i=0; i<window.w; i++) setPixel(i, window.y-1, bg_color);
|
for(int i=0; i<window.w; i++) setPixel(window, i, 0, bg_color);
|
||||||
for(int i=0; i<5; i++) {
|
for(int i=0; i<5; i++) {
|
||||||
setPixel(window, 3, i, bg_color);
|
setPixel(window, 3, i, bg_color);
|
||||||
setPixel(window, 7, i, bg_color);
|
setPixel(window, 7, i, bg_color);
|
||||||
@ -107,14 +107,14 @@ class Clock : public Effect {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
int h = ntpClient.getHours();
|
int h = ntpClient.getHours();
|
||||||
drawDigit(window, numbers3x5, 3, 5, 0, 0, h / 10, invert ? bg_color : fg_color, invert);
|
drawDigit(window, numbers3x5, 3, 5, 0, 1, h / 10, invert ? bg_color : fg_color, invert);
|
||||||
drawDigit(window, numbers3x5, 3, 5, 4, 0, h % 10, invert ? bg_color : fg_color, invert);
|
drawDigit(window, numbers3x5, 3, 5, 4, 1, h % 10, invert ? bg_color : fg_color, invert);
|
||||||
int m = ntpClient.getMinutes();
|
int m = ntpClient.getMinutes();
|
||||||
drawDigit(window, numbers3x5, 3, 5, 9, 0, m / 10, invert ? bg_color : fg_color, invert);
|
drawDigit(window, numbers3x5, 3, 5, 9, 1, m / 10, invert ? bg_color : fg_color, invert);
|
||||||
drawDigit(window, numbers3x5, 3, 5, 13, 0, m % 10, invert ? bg_color : fg_color, invert);
|
drawDigit(window, numbers3x5, 3, 5, 13, 1, m % 10, invert ? bg_color : fg_color, invert);
|
||||||
if (ntpClient.getSeconds() & 1) {
|
if (ntpClient.getSeconds() & 1) {
|
||||||
setPixel(window, 7, 1, invert ? bg_color : fg_color);
|
setPixel(window, 7, 2, invert ? bg_color : fg_color);
|
||||||
setPixel(window, 7, 3, invert ? bg_color : fg_color);
|
setPixel(window, 7, 4, invert ? bg_color : fg_color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user