From f00a164f74f033f2f222bc3a51f851187a372595 Mon Sep 17 00:00:00 2001 From: Felix Pankratz Date: Tue, 17 Dec 2024 14:56:57 +0100 Subject: [PATCH] =?UTF-8?q?=E2=97=80=20Make=20the=20rainbow=20move?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nametag/src/supercomputer.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nametag/src/supercomputer.cpp b/nametag/src/supercomputer.cpp index a17fead..5411475 100644 --- a/nametag/src/supercomputer.cpp +++ b/nametag/src/supercomputer.cpp @@ -15,6 +15,7 @@ float cell_value(Cell c) { Cell cells[PANEL_WIDTH * PANEL_HEIGHT]; bool cells_setup = false; +uint8_t rainbow_offset = 0; void setup_cells() { for(int i = 0; i < PANEL_WIDTH * PANEL_HEIGHT; i++) { @@ -37,10 +38,14 @@ void draw_supercomputer(MatrixPanel_I2S_DMA *matrix, Mode mode) { } else { // rainbow float progress = (255.0 / PANEL_WIDTH) * x; - CHSV hsv_color((int)round(progress), 255, 255 * cell_value(cells[i])); + uint8_t hue = ((int)round(progress) + rainbow_offset); + 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)); } } + if (mode == HighVis) { + rainbow_offset++; + } }