From 88971bd6ab964a7b9d974852d3eb86c66dbc20a0 Mon Sep 17 00:00:00 2001 From: Felix Pankratz Date: Sat, 16 Nov 2024 23:55:46 +0100 Subject: [PATCH] =?UTF-8?q?add=20my=20name=20=F0=9F=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nametag/src/main.cpp | 21 +++++++++++++++++---- nametag/src/overlay.h | 19 +++++++++++++++++++ 2 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 nametag/src/overlay.h diff --git a/nametag/src/main.cpp b/nametag/src/main.cpp index 53d5310..b913ab4 100644 --- a/nametag/src/main.cpp +++ b/nametag/src/main.cpp @@ -5,6 +5,7 @@ #include "main.h" #include "caveatbrush9pt7b.h" +#include "overlay.h" #define R1 42 #define G1 40 @@ -56,8 +57,8 @@ void setup(){ pinMode(ONBOARD_LED, OUTPUT); for (int i = 0; ifillScreenRGB888(0, 0, 0); + //matrix ->drawBitmap(0, 0, overlay, 64, 32, matrix->color565(64, 0, 0)); for (int x = 0; x < PANEL_WIDTH; x++) { // step down a pixel line_pos[x]++; @@ -99,10 +101,21 @@ void loop() { //} int trail_y = line_pos[x] - trail_offset; if (trail_y >= 0) { - matrix->drawPixel(x, trail_y, matrix->color565(0, (255 / line_length[x]) * (line_length[x] - trail_offset), 0)); + //if (overlay[ (trail_y * PANEL_WIDTH) + x ]) { + int pixel_num = (trail_y * PANEL_WIDTH) + x; + if (overlay[ pixel_num / 8 ] & (1 << (7 - (pixel_num % 8)) )) { + matrix->drawPixel(x, trail_y, matrix->color565(128, 255, 128)); + } else { + matrix->drawPixel(x, trail_y, matrix->color565(0, (255 / line_length[x]) * (line_length[x] - trail_offset), 0)); + } } else { + int pixel_num = ((PANEL_HEIGHT + trail_y) * PANEL_WIDTH) + x; if (line_pos[x] >= 0) { - matrix->drawPixel(x, PANEL_HEIGHT + trail_y, matrix->color565(0, 255 - (trail_offset * 16) , 0)); + if (overlay[ pixel_num / 8 ] & (1 << (7 - (pixel_num % 8)) )) { + matrix->drawPixel(x, PANEL_HEIGHT + trail_y, matrix->color565(128, 255, 128)); + } else { + matrix->drawPixel(x, PANEL_HEIGHT + trail_y, matrix->color565(0,(255 / line_length[x]) * (line_length[x] - trail_offset), 0)); + } } else { break; } diff --git a/nametag/src/overlay.h b/nametag/src/overlay.h new file mode 100644 index 0000000..0ea85ea --- /dev/null +++ b/nametag/src/overlay.h @@ -0,0 +1,19 @@ +const unsigned char overlay [] PROGMEM = { + // 'bw, 64x32px + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x70, + 0x0f, 0xf0, 0x00, 0x00, 0x00, 0x60, 0x00, 0x20, 0x0f, 0xf8, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, + 0x0c, 0x1c, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x0c, 0x0e, 0x3f, 0x0e, 0xf8, 0x60, 0xc0, 0x70, + 0x0c, 0x06, 0x3f, 0x8f, 0xfc, 0x61, 0xc0, 0x70, 0x0c, 0x06, 0x01, 0xc3, 0x8c, 0x63, 0x80, 0x70, + 0x0c, 0x0e, 0x00, 0xc3, 0x0c, 0x67, 0x00, 0x70, 0x0f, 0xfc, 0x3f, 0xc3, 0x0c, 0x7e, 0x00, 0x70, + 0x0f, 0xf8, 0x7f, 0xc3, 0x0c, 0x7e, 0x00, 0x70, 0x0f, 0xf0, 0xff, 0xc3, 0x0c, 0x7e, 0x00, 0x70, + 0x0c, 0x00, 0xc0, 0xc3, 0x0c, 0x67, 0x00, 0x70, 0x0c, 0x00, 0xe0, 0xc3, 0x0c, 0x63, 0x80, 0x70, + 0x0c, 0x00, 0x7f, 0xe3, 0x0c, 0x61, 0xc0, 0x70, 0x0c, 0x00, 0x3f, 0xf3, 0x0c, 0x60, 0xc0, 0x70, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +};