👈 visibility modes for supercomputer
This commit is contained in:
parent
224f2beb23
commit
da0dd90562
@ -83,7 +83,7 @@ void loop() {
|
||||
draw_congress(matrix, mode);
|
||||
break;
|
||||
case Supercomputer:
|
||||
draw_supercomputer(matrix);
|
||||
draw_supercomputer(matrix, mode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <Arduino.h>
|
||||
#include <FastLED.h>
|
||||
#include "constants.h"
|
||||
#include "enums.h"
|
||||
#include "supercomputer.h"
|
||||
|
||||
struct Cell {
|
||||
@ -22,19 +23,24 @@ void setup_cells() {
|
||||
}
|
||||
}
|
||||
|
||||
void draw_supercomputer(MatrixPanel_I2S_DMA *matrix) {
|
||||
void draw_supercomputer(MatrixPanel_I2S_DMA *matrix, Mode mode) {
|
||||
if (!cells_setup) {
|
||||
setup_cells();
|
||||
cells_setup = true;
|
||||
}
|
||||
for(int i = 0; i < PANEL_WIDTH * PANEL_HEIGHT; i++) {
|
||||
cells[i].state += 0.3;
|
||||
//matrix->drawPixel(i % PANEL_WIDTH, i / PANEL_WIDTH, matrix->color565((int)round(255.0 * cell_value(cells[i])), 0, 0));
|
||||
int x = 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));
|
||||
} else {
|
||||
// rainbow
|
||||
float progress = (255.0 / PANEL_WIDTH) * x;
|
||||
CHSV hsv_color((int)round(progress), 255, 255 * cell_value(cells[i]));
|
||||
CRGB rgb;
|
||||
hsv2rgb_rainbow(hsv_color, rgb);
|
||||
matrix->drawPixel(i % PANEL_WIDTH, i / PANEL_WIDTH, matrix->color565(rgb.r, rgb.g, rgb.b));
|
||||
matrix->drawPixel(x, i / PANEL_WIDTH, matrix->color565(rgb.r, rgb.g, rgb.b));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,2 +1,3 @@
|
||||
#include <ESP32-HUB75-MatrixPanel-I2S-DMA.h>
|
||||
void draw_supercomputer(MatrixPanel_I2S_DMA *matrix);
|
||||
#include "enums.h"
|
||||
void draw_supercomputer(MatrixPanel_I2S_DMA *matrix, Mode mode);
|
||||
|
Loading…
Reference in New Issue
Block a user