PixelClockEffect is now being displayed correctly.

This commit is contained in:
Fabian Schlenz 2019-06-16 12:43:34 +02:00
parent e8f3ea3281
commit f0509de411

View File

@ -2,7 +2,7 @@
#include "ntp.h" #include "ntp.h"
PixelClockEffect::PixelClockEffect() { PixelClockEffect::PixelClockEffect() {
window = new Window(0, 0, LED_WIDTH, LED_HEIGHT-7); window = new Window(0, 0, LED_WIDTH, LED_HEIGHT-6);
} }
void PixelClockEffect::start() { void PixelClockEffect::start() {
@ -23,14 +23,14 @@ void PixelClockEffect::loop() {
for (uint8_t s=0; s<60; s++) { for (uint8_t s=0; s<60; s++) {
x = window->width - 1 - s/10; x = window->width - 1 - s/10;
y = window->height - 1 - (s % 10); y = window->height - 1 - (s % 10);
if (s<=seconds) window->setPixel(x, y, _color_seconds); if (s<seconds) window->setPixel(x, y, _color_seconds);
} }
uint8_t minutes = ntpClient.getMinutes(); uint8_t minutes = ntpClient.getMinutes();
for (uint8_t m=0; m<60; m++) { for (uint8_t m=0; m<60; m++) {
x = 6 - m/10; x = 6 - m/10;
y = window->height - 1 - (m % 10); y = window->height - 1 - (m % 10);
if (m<=minutes) window->setPixel(x, y, _color_seconds); if (m<minutes) window->setPixel(x, y, _color_minutes);
} }
} }