As noticed, this reverts big_clock to the pre-subsampling state.
This commit is contained in:
parent
2395e51e88
commit
c1024b3423
@ -8,10 +8,9 @@ private:
|
|||||||
CRGB _color_seconds = CRGB(0xFF0000);
|
CRGB _color_seconds = CRGB(0xFF0000);
|
||||||
|
|
||||||
void _draw_seconds();
|
void _draw_seconds();
|
||||||
void _draw_border_pixel(uint8_t second, uint8_t part, CRGB* color);
|
void _draw_border_pixel(uint8_t second, CRGB* color);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void loop();
|
void loop();
|
||||||
String get_name() override { return "big_clock"; }
|
String get_name() override { return "big_clock"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -25,35 +25,32 @@ void BigClockEffect::loop() {
|
|||||||
void BigClockEffect::_draw_seconds() {
|
void BigClockEffect::_draw_seconds() {
|
||||||
uint8_t seconds = ntpClient.getSeconds();
|
uint8_t seconds = ntpClient.getSeconds();
|
||||||
for (int i=1; i<=seconds; i++) {
|
for (int i=1; i<=seconds; i++) {
|
||||||
_draw_border_pixel(i, 0, &_color_seconds);
|
_draw_border_pixel(i, &_color_seconds);
|
||||||
}
|
}
|
||||||
uint16_t millis = ntpClient.getEpochMillis() % 1000;
|
uint16_t millis = ntpClient.getEpochMillis() % 1000;
|
||||||
if (millis > 0) {
|
if (millis > 0) {
|
||||||
//uint16_t position = ((60 - (60 - seconds) * millis) << 8) / 1000;
|
uint8_t part = 60 - ((60 - seconds) * millis / 1000);
|
||||||
//uint8_t position = 60 - ((60 - seconds) * millis / 1000);
|
_draw_border_pixel(part, &_color_seconds);
|
||||||
//percent = seconds00 - (59-seconds)ff
|
|
||||||
uint16_t position = ((seconds<<8) + (((60 - seconds)<<8) * millis / 1000));
|
|
||||||
_draw_border_pixel(position>>8, position&0xFF, &_color_seconds);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BigClockEffect::_draw_border_pixel(uint8_t i, uint8_t part, CRGB* color) {
|
void BigClockEffect::_draw_border_pixel(uint8_t i, CRGB* color) {
|
||||||
accum88 x, y;
|
uint8_t x, y;
|
||||||
if (i<=8) {
|
if (i<=8) {
|
||||||
x = (7 + i)<<8 | part;
|
x = 7 + i;
|
||||||
y = 0;
|
y = 0;
|
||||||
} else if (i<=23) {
|
} else if (i<=23) {
|
||||||
x = 15 << 8;
|
x = 15;
|
||||||
y = (i - 10) << 8 | (255 - part);
|
y = i - 8;
|
||||||
} else if (i<= 38) {
|
} else if (i<= 38) {
|
||||||
x = (15 - 1 - i + 23) << 8 | (255 - part);
|
x = 15 - i + 23;
|
||||||
y = 15 << 8;
|
y = 15;
|
||||||
} else if (i <= 53) {
|
} else if (i <= 53) {
|
||||||
x = 0;
|
x = 0;
|
||||||
y = (15 - i + 38) << 8 | part;
|
y = 15 - i + 38;
|
||||||
} else {
|
} else {
|
||||||
x = (i - 53) << 8 | part;
|
x = i - 53;
|
||||||
y = 0;
|
y = 0;
|
||||||
}
|
}
|
||||||
window->setSubPixel(x, y, color);
|
window->setPixel(x, y, color);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user