night_clock now has bigger digits.
This commit is contained in:
parent
1d66f9c541
commit
b9cfc6568b
@ -19,11 +19,3 @@ public:
|
|||||||
virtual void loop(uint16_t ms);
|
virtual void loop(uint16_t ms);
|
||||||
String get_name() override { return "big_clock"; }
|
String get_name() override { return "big_clock"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class NightClockEffect : public BigClockEffect {
|
|
||||||
private:
|
|
||||||
CRGB _color_font = CRGB(0x440000);
|
|
||||||
CRGB _color_colon = CRGB(0x000000);
|
|
||||||
void _draw_border_pixel(accum88 pos, CRGB* color) { };
|
|
||||||
CRGB _get_color_font() { return CRGB(0x440000); }
|
|
||||||
};
|
|
||||||
|
8
include/effects/night_clock.h
Normal file
8
include/effects/night_clock.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "Effect.h"
|
||||||
|
|
||||||
|
class NightClockEffect : public Effect {
|
||||||
|
public:
|
||||||
|
virtual void loop(uint16_t ms);
|
||||||
|
String get_name() override { return "night_clock"; }
|
||||||
|
};
|
@ -26,6 +26,7 @@
|
|||||||
#include "effect_diamond.h"
|
#include "effect_diamond.h"
|
||||||
#include "effect_tpm2_net.h"
|
#include "effect_tpm2_net.h"
|
||||||
#include "SimpleEffect.h"
|
#include "SimpleEffect.h"
|
||||||
|
#include "effects/night_clock.h"
|
||||||
|
|
||||||
Effect* current_effect;
|
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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user