🔤 add overlay - it's a nametag after all

This commit is contained in:
Felix Pankratz 2024-12-17 15:12:09 +01:00
parent f00a164f74
commit 5fa2940592

View File

@ -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) {