Emil 5. Geburtstag + Creeper
This commit is contained in:
parent
0d73d112b1
commit
6b4ed1658c
@ -134,6 +134,41 @@ bool SYMBOLS[SYMBOL_COUNT][DISPLAY_CHAR_WIDTH * DISPLAY_CHAR_HEIGHT] = {
|
||||
X, _, _,
|
||||
X, X, X,
|
||||
},
|
||||
{
|
||||
X, _, X,
|
||||
X, _, X,
|
||||
X, X, X,
|
||||
X, _, X,
|
||||
X, _, X,
|
||||
},
|
||||
{
|
||||
X, X, _,
|
||||
X, _, X,
|
||||
X, X, _,
|
||||
X, X, _,
|
||||
X, _, X,
|
||||
},
|
||||
{
|
||||
X, _, _,
|
||||
X, _, _,
|
||||
X, _, _,
|
||||
X, _, _,
|
||||
X, _, _,
|
||||
},
|
||||
{
|
||||
X, _, _,
|
||||
X, _, _,
|
||||
X, _, _,
|
||||
X, _, _,
|
||||
X, X, X,
|
||||
},
|
||||
{
|
||||
_, _, _,
|
||||
_, _, _,
|
||||
_, _, _,
|
||||
_, _, _,
|
||||
_, _, _,
|
||||
},
|
||||
// this must always be the last symbol (fallback)
|
||||
{
|
||||
X, X, X,
|
||||
|
||||
@ -5,15 +5,21 @@
|
||||
#include "Adafruit_NeoPixel.h"
|
||||
#include "Vector.h"
|
||||
|
||||
#define SYMBOL_COUNT 20
|
||||
#define SYMBOL_COUNT 26
|
||||
|
||||
#define SYMBOL_J 11
|
||||
#define SYMBOL_X 12
|
||||
#define SYMBOL_DASH 13
|
||||
#define SYMBOL_PERCENT 14
|
||||
|
||||
#define SYMBOL_T 15
|
||||
#define SYMBOL_A 16
|
||||
#define SYMBOL_G 17
|
||||
#define SYMBOL_E 18
|
||||
#define SYMBOL_H 19
|
||||
#define SYMBOL_R 20
|
||||
#define SYMBOL_I 21
|
||||
#define SYMBOL_L 22
|
||||
#define SYMBOL_SPACE 23
|
||||
|
||||
#define DISPLAY_CHAR_WIDTH 3
|
||||
#define DISPLAY_CHAR_HEIGHT 5
|
||||
@ -48,8 +54,7 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
Display(uint8_t width, uint8_t height) :
|
||||
width(width), height(height),
|
||||
Display(uint8_t width, uint8_t height) : width(width), height(height),
|
||||
pixelCount(width * height),
|
||||
pixelByteCount(pixelCount * sizeof(Color)),
|
||||
leds(pixelCount, GPIO_NUM_13) {
|
||||
@ -164,6 +169,57 @@ public:
|
||||
return DISPLAY_CHAR_WIDTH;
|
||||
}
|
||||
|
||||
// TODO REMOVE QUICK & DIRTY
|
||||
uint8_t printM(uint8_t xPos, uint8_t yPos, Color color) {
|
||||
bool sym[5][5] = {
|
||||
{X,_,_,_,X},
|
||||
{X,X,_,X,X},
|
||||
{X,_,X,_,X},
|
||||
{X,_,_,_,X},
|
||||
{X,_,_,_,X},
|
||||
};
|
||||
for (int y = 0; y < countof(sym); ++y) {
|
||||
for (int x = 0; x < countof(sym[0]); ++x) {
|
||||
if (sym[y][x]) {
|
||||
set(xPos + x, yPos + y, color);
|
||||
} else {
|
||||
set(xPos + x, yPos + y, BLACK);
|
||||
}
|
||||
}
|
||||
}
|
||||
return countof(sym[0]);
|
||||
}
|
||||
|
||||
// TODO REMOVE QUICK & DIRTY
|
||||
uint8_t printCreeper(uint8_t xPos, uint8_t yPos) {
|
||||
Color G = GREEN;
|
||||
Color I = {128, 255, 128};
|
||||
Color O = BLACK;
|
||||
Color sym[7][7] = {
|
||||
{G, G, G, G, G, G, G},
|
||||
{G, I, I, I, I, I, G},
|
||||
{G, I, O, I, O, I, G},
|
||||
{G, I, I, I, I, I, G},
|
||||
{G, I, O, O, O, I, G},
|
||||
{G, I, O, I, O, I, G},
|
||||
{G, G, G, G, G, G, G},
|
||||
};
|
||||
for (int y = 0; y < countof(sym); ++y) {
|
||||
for (int x = 0; x < countof(sym[0]); ++x) {
|
||||
set(xPos + x, yPos + y, sym[y][x]);
|
||||
}
|
||||
}
|
||||
return countof(sym[0]);
|
||||
}
|
||||
|
||||
// TODO REMOVE QUICK & DIRTY
|
||||
uint8_t printI(uint8_t xPos, uint8_t yPos, Color color) {
|
||||
for (int y = 0; y < 5; ++y) {
|
||||
set(xPos, yPos + y, color);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void set(Vector pos, Color color) {
|
||||
set((uint8_t) round(pos.x), (uint8_t) round(pos.y), color);
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#ifndef MODE_COUNT_DOWN_H
|
||||
#define MODE_COUNT_DOWN_H
|
||||
|
||||
#define MAX_FIREWORKS 5
|
||||
#define MAX_FIREWORKS 6
|
||||
|
||||
#include "mode/Mode.h"
|
||||
#include "CountDownFirework.h"
|
||||
@ -28,8 +28,7 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
CountDown(Display &display, bool bars, bool plus1DayForSleepingCount) :
|
||||
Mode(display), bars(bars), plus1DayForSleepingCount(plus1DayForSleepingCount) {
|
||||
CountDown(Display& display, bool bars, bool plus1DayForSleepingCount) : Mode(display), bars(bars), plus1DayForSleepingCount(plus1DayForSleepingCount) {
|
||||
for (auto& firework: fireworks) {
|
||||
firework.init(display);
|
||||
}
|
||||
@ -266,13 +265,32 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
static void drawYear(Display &display, int year) {
|
||||
// ReSharper disable CppDFAUnusedValue
|
||||
|
||||
void drawYear(Display& display, int year) const {
|
||||
if (plus1DayForSleepingCount) {
|
||||
uint8_t x = 0;
|
||||
x += display.print(x, 1,SYMBOL_E, WHITE, true);
|
||||
x += 1;
|
||||
x += display.printM(x, 1, WHITE);
|
||||
x += 1;
|
||||
x += display.printI(x, 1, WHITE);
|
||||
x += 1;
|
||||
x += display.print(x, 1,SYMBOL_L, WHITE, true);
|
||||
x += 4;
|
||||
x += display.print(x, 1, 5, WHITE, true);
|
||||
x += 2;
|
||||
display.printCreeper(x, 0);
|
||||
} else {
|
||||
uint8_t x = 8;
|
||||
x += display.print(x, 1, year / 1000 % 10, WHITE, true) + 1;
|
||||
x += display.print(x, 1, year / 100 % 10, WHITE, true) + 1;
|
||||
x += display.print(x, 1, year / 10 % 10, WHITE, true) + 1;
|
||||
display.print(x, 1, year / 1 % 10, WHITE, true);
|
||||
x += display.print(x, 1, year / 1 % 10, WHITE, true);
|
||||
}
|
||||
}
|
||||
|
||||
// ReSharper restore CppDFAUnusedValue
|
||||
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user