night_clock now has bigger digits.
This commit is contained in:
@ -26,6 +26,7 @@
|
||||
#include "effect_diamond.h"
|
||||
#include "effect_tpm2_net.h"
|
||||
#include "SimpleEffect.h"
|
||||
#include "effects/night_clock.h"
|
||||
|
||||
Effect* current_effect;
|
||||
|
||||
|
26
src/effects/night_clock.cpp
Normal file
26
src/effects/night_clock.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include "Effect.h"
|
||||
#include "effects/night_clock.h"
|
||||
#include "fonts.h"
|
||||
#include <time.h>
|
||||
|
||||
void NightClockEffect::loop(uint16_t ms) {
|
||||
window->clear();
|
||||
time_t now;
|
||||
tm timeinfo;
|
||||
time(&now);
|
||||
localtime_r(&now, &timeinfo);
|
||||
uint8_t h = timeinfo.tm_hour;
|
||||
CRGB color = CRGB(0x440000);
|
||||
window->drawChar(&font5x7, 4<<8, 0<<8, '0' + (h / 10), &color);
|
||||
window->drawChar(&font5x7, 10<<8, 0<<8, '0' + (h % 10), &color);
|
||||
|
||||
uint8_t m = timeinfo.tm_min;
|
||||
window->drawChar(&font5x7, 4<<8, 9<<8, '0' + (m / 10), &color);
|
||||
window->drawChar(&font5x7, 10<<8, 9<<8, '0' + (m % 10), &color);
|
||||
|
||||
uint8_t s = timeinfo.tm_sec;
|
||||
if(s & 1) {
|
||||
window->setPixel(2, 11, &color);
|
||||
window->setPixel(2, 13, &color);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user