From 5fa2940592ec5499563196d083ea1aa9ad1d7b40 Mon Sep 17 00:00:00 2001 From: Felix Pankratz Date: Tue, 17 Dec 2024 15:12:09 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A4=20add=20overlay=20-=20it's=20a=20n?= =?UTF-8?q?ametag=20after=20all?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nametag/src/supercomputer.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nametag/src/supercomputer.cpp b/nametag/src/supercomputer.cpp index 5411475..9b8020b 100644 --- a/nametag/src/supercomputer.cpp +++ b/nametag/src/supercomputer.cpp @@ -3,6 +3,7 @@ #include "constants.h" #include "enums.h" #include "supercomputer.h" +#include "overlay.h" struct Cell { float state; @@ -31,18 +32,22 @@ void draw_supercomputer(MatrixPanel_I2S_DMA *matrix, Mode mode) { } for(int i = 0; i < PANEL_WIDTH * PANEL_HEIGHT; i++) { int x = i % PANEL_WIDTH; + int y = i / PANEL_WIDTH; cells[i].state += 0.3; if (mode == Stealth) { // red only - matrix->drawPixel(x, i / PANEL_WIDTH, matrix->color565((int)round(255.0 * cell_value(cells[i])), 0, 0)); + matrix->drawPixel(x, y, matrix->color565((int)round(255.0 * cell_value(cells[i])), 0, 0)); } else { // rainbow float progress = (255.0 / PANEL_WIDTH) * x; uint8_t hue = ((int)round(progress) + rainbow_offset); + if (overlay[i / 8] & (1 << (7 - (i % 8)))){ + hue -= 128; + } CHSV hsv_color(hue, 255, 255 * cell_value(cells[i])); CRGB rgb; hsv2rgb_rainbow(hsv_color, rgb); - matrix->drawPixel(x, i / PANEL_WIDTH, matrix->color565(rgb.r, rgb.g, rgb.b)); + matrix->drawPixel(x, y, matrix->color565(rgb.r, rgb.g, rgb.b)); } } if (mode == HighVis) {