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