Compare commits

..

No commits in common. "def486e7a7596ab4ddc0c8efbbe6a4960cca001a" and "a0f579adf079f8583e23dfeba41d18749090fbdd" have entirely different histories.

5 changed files with 5 additions and 112 deletions

View File

@ -11,8 +11,6 @@ enum DisplayStyle {
Congress,
Supercomputer,
Cyber,
Plasma,
Flame,
NumStyles
Plasma
};
#endif

View File

@ -1,85 +0,0 @@
#include "constants.h"
#include "flame.h"
#define FLAME_PALETTE_SIZE 36
uint16_t flame_palette[] = {
0x0020,
0x1820,
0x2860,
0x4060,
0x50A0,
0x60E0,
0x70E0,
0x8920,
0x9960,
0xA9E0,
0xBA20,
0xC220,
0xDA60,
0xDAA0,
0xDAA0,
0xD2E0,
0xD321,
0xCB61,
0xCBA1,
0xCBE1,
0xCC23,
0xC422,
0xC462,
0xC4A3,
0xBCE3,
0xBCE3,
0xBD24,
0xBD24,
0xBD65,
0xB565,
0xB5A5,
0xB5A6,
0xCE6D,
0xDEF3,
0xEF78,
0xFFFF
};
int framebuffer[PANEL_WIDTH * PANEL_HEIGHT];
bool flame_ready = false;
void spread_fire(int from) {
int rand = random(1, 4);
int to = from - PANEL_WIDTH - rand + 1;
if (to < 0) {
to = 0;
}
framebuffer[to] = framebuffer[from] - rand;
if (framebuffer[to] < 0)
framebuffer[to] = 0;
}
void do_fire() {
for(int x = 0 ; x < PANEL_WIDTH; x++) {
for (int y = 1; y < PANEL_HEIGHT ; y++) {
spread_fire(y * PANEL_WIDTH + x);
}
}
}
void setup_flame() {
memset(framebuffer, 0, sizeof framebuffer);
for (int i = 0; i < PANEL_WIDTH; i++) {
framebuffer[(PANEL_WIDTH * PANEL_HEIGHT - i - 1)] = FLAME_PALETTE_SIZE - 1;
}
}
void draw_flame(MatrixPanel_I2S_DMA *matrix, enum Mode mode) {
if(not flame_ready) {
setup_flame();
flame_ready = true;
}
do_fire();
for(int p = 0; p < PANEL_HEIGHT * PANEL_WIDTH; p++) {
matrix->drawPixel(p % PANEL_WIDTH, p / PANEL_WIDTH, flame_palette[framebuffer[p]]);
}
}

View File

@ -1,4 +0,0 @@
#include "xtensa/core-macros.h"
#include <ESP32-HUB75-MatrixPanel-I2S-DMA.h>
#include "enums.h"
void draw_flame(MatrixPanel_I2S_DMA *matrix, enum Mode mode);

View File

@ -8,18 +8,13 @@
#include "rain.h"
#include "supercomputer.h"
#include "cyber.h"
#include "flame.h"
#include "pillowlava8pt7b.h"
#define CYCLE_TIME_MS 20000
MatrixPanel_I2S_DMA *matrix = nullptr;
Mode mode = HighVis;
DisplayStyle style = Flame;
unsigned long last_switch;
DisplayStyle style = Supercomputer;
void setup(){
pinMode(ONBOARD_LED, OUTPUT);
@ -30,8 +25,6 @@ void setup(){
HUB75_I2S_CFG::i2s_pins _pins={R1, G1, BL1, R2, G2, BL2, CH_A, CH_B, CH_C, CH_D, CH_E, LAT, OE, CLK};
HUB75_I2S_CFG mxconfig(PANEL_WIDTH, PANEL_HEIGHT, PANELS_NUMBER, _pins);
last_switch = millis();
mxconfig.gpio.e = PIN_E;
mxconfig.driver = HUB75_I2S_CFG::FM6126A; // for panels using FM6126A chips
@ -54,12 +47,6 @@ void loop() {
matrix->clearScreen();
delay(25);
if (millis() - last_switch > CYCLE_TIME_MS) {
// next style
style = DisplayStyle((style + 1) % (NumStyles - 1));
last_switch = millis();
}
if(!digitalRead(BACK_BUTTON)) {
switch(mode) {
case Stealth:
@ -79,6 +66,7 @@ void loop() {
switch(style) {
case Rain:
style = Congress;
matrix->setFont(&Pilowlava_Regular8pt7b);
break;
case Congress:
style = Supercomputer;
@ -98,7 +86,6 @@ void loop() {
draw_rain(matrix, mode);
break;
case Congress:
matrix->setFont(&Pilowlava_Regular8pt7b);
draw_congress(matrix, mode);
break;
case Supercomputer:
@ -107,9 +94,6 @@ void loop() {
case Cyber:
draw_cyber(matrix, mode);
break;
case Flame:
draw_flame(matrix, mode);
break;
}
}

View File

@ -68,9 +68,9 @@ void draw_rain(MatrixPanel_I2S_DMA *matrix, Mode mode) {
raindrops.push_back({
false,
raindrops[r].x,
0 - random(4),
0 - random(8),
random(20, 28),
random(0, 55),
random(0, 76),
millis()
});
raindrops.erase(raindrops.begin() + r);