Compare commits

..

No commits in common. "4f9fe2a24dd66c11422535d66bce104a32efe7a6" and "6b4ed1658c2086e51bf085b0a272e6bf2cd87bfb" have entirely different histories.

2 changed files with 14 additions and 37 deletions

View File

@ -190,46 +190,23 @@ public:
return countof(sym[0]); return countof(sym[0]);
} }
static bool doCreeperBlink() {
const auto now = millis();
static auto blink = false;
static auto last = now;
if (!blink) {
if (now - last >= 3000) {
last = now;
if (random(3) == 0) {
blink = true;
}
}
} else {
if (now - last >= 500) {
last = now;
blink = false;
}
}
return blink;
}
// TODO REMOVE QUICK & DIRTY // TODO REMOVE QUICK & DIRTY
uint8_t printCreeper(uint8_t xPos, uint8_t yPos) { uint8_t printCreeper(uint8_t xPos, uint8_t yPos) {
const auto creeperBlink = doCreeperBlink(); Color G = GREEN;
bool sym[8][8] = { Color I = {128, 255, 128};
{X, X, X, X, X, X, X, X}, Color O = BLACK;
{X, X, X, X, X, X, X, X}, Color sym[7][7] = {
{X, _, _, X, X, _, _, X}, {G, G, G, G, G, G, G},
{X, _, _, X, X, _, _, X}, {G, I, I, I, I, I, G},
{X, X, X, _, _, X, X, X}, {G, I, O, I, O, I, G},
{X, X, _, _, _, _, X, X}, {G, I, I, I, I, I, G},
{X, X, _, _, _, _, X, X}, {G, I, O, O, O, I, G},
{X, X, _, X, X, _, X, X}, {G, I, O, I, O, I, G},
{G, G, G, G, G, G, G},
}; };
for (int y = 0; y < countof(sym); ++y) { for (int y = 0; y < countof(sym); ++y) {
for (int x = 0; x < countof(sym[0]); ++x) { for (int x = 0; x < countof(sym[0]); ++x) {
if (creeperBlink && ((x == 1 || x == 2) && y == 2)) { set(xPos + x, yPos + y, sym[y][x]);
set(xPos + x, yPos + y, GREEN);
} else {
set(xPos + x, yPos + y, sym[y][x] ? GREEN : BLACK);
}
} }
} }
return countof(sym[0]); return countof(sym[0]);

View File

@ -277,9 +277,9 @@ private:
x += display.printI(x, 1, WHITE); x += display.printI(x, 1, WHITE);
x += 1; x += 1;
x += display.print(x, 1,SYMBOL_L, WHITE, true); x += display.print(x, 1,SYMBOL_L, WHITE, true);
x += 3; x += 4;
x += display.print(x, 1, 5, WHITE, true); x += display.print(x, 1, 5, WHITE, true);
x += 3; x += 2;
display.printCreeper(x, 0); display.printCreeper(x, 0);
} else { } else {
uint8_t x = 8; uint8_t x = 8;