Kinda fixed big_clock effect, but it doesn't look nearly as cool as I'd hoped... So this commit includes the fix and the next commit will be a revert to the older, non-subsampled code, which just looked better.
This commit is contained in:
parent
937850c90a
commit
1c1c3a8054
@ -8,17 +8,17 @@ void BigClockEffect::loop() {
|
|||||||
uint8_t h = ntpClient.getHours();
|
uint8_t h = ntpClient.getHours();
|
||||||
window->drawChar(&font_numbers3x5_blocky, 6<<8, 2<<8, '0' + (h / 10), &_color_font);
|
window->drawChar(&font_numbers3x5_blocky, 6<<8, 2<<8, '0' + (h / 10), &_color_font);
|
||||||
window->drawChar(&font_numbers3x5_blocky, 11<<8, 2<<8, '0' + (h % 10), &_color_font);
|
window->drawChar(&font_numbers3x5_blocky, 11<<8, 2<<8, '0' + (h % 10), &_color_font);
|
||||||
|
|
||||||
uint8_t m = ntpClient.getMinutes();
|
uint8_t m = ntpClient.getMinutes();
|
||||||
window->drawChar(&font_numbers3x5_blocky, 6<<8, 9<<8, '0' + (m / 10), &_color_font);
|
window->drawChar(&font_numbers3x5_blocky, 6<<8, 9<<8, '0' + (m / 10), &_color_font);
|
||||||
window->drawChar(&font_numbers3x5_blocky, 11<<8, 9<<8, '0' + (m % 10), &_color_font);
|
window->drawChar(&font_numbers3x5_blocky, 11<<8, 9<<8, '0' + (m % 10), &_color_font);
|
||||||
|
|
||||||
uint8_t s = ntpClient.getSeconds();
|
uint8_t s = ntpClient.getSeconds();
|
||||||
if (s & 1) {
|
if (s & 1) {
|
||||||
window->setPixel(3, 10, &_color_font);
|
window->setPixel(3, 10, &_color_font);
|
||||||
window->setPixel(3, 12, &_color_font);
|
window->setPixel(3, 12, &_color_font);
|
||||||
}
|
}
|
||||||
|
|
||||||
_draw_seconds();
|
_draw_seconds();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,8 +29,10 @@ void BigClockEffect::_draw_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;
|
//uint16_t position = ((60 - (60 - seconds) * millis) << 8) / 1000;
|
||||||
//uint8_t position = 60 - ((60 - seconds) * millis / 1000);
|
//uint8_t position = 60 - ((60 - seconds) * millis / 1000);
|
||||||
|
//percent = seconds00 - (59-seconds)ff
|
||||||
|
uint16_t position = ((seconds<<8) + (((60 - seconds)<<8) * millis / 1000));
|
||||||
_draw_border_pixel(position>>8, position&0xFF, &_color_seconds);
|
_draw_border_pixel(position>>8, position&0xFF, &_color_seconds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -42,9 +44,9 @@ void BigClockEffect::_draw_border_pixel(uint8_t i, uint8_t part, CRGB* color) {
|
|||||||
y = 0;
|
y = 0;
|
||||||
} else if (i<=23) {
|
} else if (i<=23) {
|
||||||
x = 15 << 8;
|
x = 15 << 8;
|
||||||
y = (i - 8) << 8 | (255 - part);
|
y = (i - 10) << 8 | (255 - part);
|
||||||
} else if (i<= 38) {
|
} else if (i<= 38) {
|
||||||
x = (15 - i + 23) << 8 | (255 - part);
|
x = (15 - 1 - i + 23) << 8 | (255 - part);
|
||||||
y = 15 << 8;
|
y = 15 << 8;
|
||||||
} else if (i <= 53) {
|
} else if (i <= 53) {
|
||||||
x = 0;
|
x = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user