🔤 add overlay - it's a nametag after all
This commit is contained in:
parent
f00a164f74
commit
5fa2940592
@ -3,6 +3,7 @@
|
|||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
#include "enums.h"
|
#include "enums.h"
|
||||||
#include "supercomputer.h"
|
#include "supercomputer.h"
|
||||||
|
#include "overlay.h"
|
||||||
|
|
||||||
struct Cell {
|
struct Cell {
|
||||||
float state;
|
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++) {
|
for(int i = 0; i < PANEL_WIDTH * PANEL_HEIGHT; i++) {
|
||||||
int x = i % PANEL_WIDTH;
|
int x = i % PANEL_WIDTH;
|
||||||
|
int y = i / PANEL_WIDTH;
|
||||||
cells[i].state += 0.3;
|
cells[i].state += 0.3;
|
||||||
if (mode == Stealth) {
|
if (mode == Stealth) {
|
||||||
// red only
|
// 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 {
|
} else {
|
||||||
// rainbow
|
// rainbow
|
||||||
float progress = (255.0 / PANEL_WIDTH) * x;
|
float progress = (255.0 / PANEL_WIDTH) * x;
|
||||||
uint8_t hue = ((int)round(progress) + rainbow_offset);
|
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]));
|
CHSV hsv_color(hue, 255, 255 * cell_value(cells[i]));
|
||||||
CRGB rgb;
|
CRGB rgb;
|
||||||
hsv2rgb_rainbow(hsv_color, 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) {
|
if (mode == HighVis) {
|
||||||
|
Loading…
Reference in New Issue
Block a user