Skip to content

Commit d2b7e47

Browse files
committed
add legacy defines for compatibility, reverted test changes in rotozoomer
1 parent 494b72c commit d2b7e47

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

wled00/FX.cpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6221,12 +6221,22 @@ uint16_t mode_2Dplasmarotozoom() {
62216221
const int cols = SEG_W;
62226222
const int rows = SEG_H;
62236223

6224-
unsigned dataSize = sizeof(float);
6224+
unsigned dataSize = SEGMENT.length() + sizeof(float);
62256225
if (!SEGENV.allocateData(dataSize)) return mode_static(); //allocation failed
62266226
float *a = reinterpret_cast<float*>(SEGENV.data);
6227+
byte *plasma = reinterpret_cast<byte*>(SEGENV.data+sizeof(float));
62276228

62286229
unsigned ms = strip.now/15;
62296230

6231+
// plasma
6232+
for (int j = 0; j < rows; j++) {
6233+
int index = j*cols;
6234+
for (int i = 0; i < cols; i++) {
6235+
if (SEGMENT.check1) plasma[index+i] = (i * 4 ^ j * 4) + ms / 6;
6236+
else plasma[index+i] = inoise8(i * 40, j * 40, ms);
6237+
}
6238+
}
6239+
62306240
// rotozoom
62316241
float f = (sin_t(*a/2)+((128-SEGMENT.intensity)/128.0f)+1.1f)/1.5f; // scale factor
62326242
float kosinus = cos_t(*a) * f;
@@ -6235,14 +6245,9 @@ uint16_t mode_2Dplasmarotozoom() {
62356245
float u1 = i * kosinus;
62366246
float v1 = i * sinus;
62376247
for (int j = 0; j < rows; j++) {
6238-
unsigned u = abs8(u1 - j * sinus) % cols;
6239-
unsigned v = abs8(v1 + j * kosinus) % rows;
6240-
byte plasma;
6241-
if (SEGMENT.check1) plasma = (u * 4 ^ v * 4) + ms / 6;
6242-
else plasma = perlin8(u * 40, v * 40, ms);
6243-
//else plasma = inoise8(u * SEGMENT.intensity, v * SEGMENT.intensity, ms);
6244-
//SEGMENT.setPixelColorXY(i, j, SEGMENT.color_from_palette(plasma[v*cols+u], false, PALETTE_SOLID_WRAP, 255));
6245-
SEGMENT.setPixelColorXY(i, j, SEGMENT.color_from_palette(plasma, false, PALETTE_SOLID_WRAP, 255));
6248+
byte u = abs8(u1 - j * sinus) % cols;
6249+
byte v = abs8(v1 + j * kosinus) % rows;
6250+
SEGMENT.setPixelColorXY(i, j, SEGMENT.color_from_palette(plasma[v*cols+u], false, PALETTE_SOLID_WRAP, 255));
62466251
}
62476252
}
62486253
*a -= 0.03f + float(SEGENV.speed-128)*0.0002f; // rotation speed

wled00/fcn_declare.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,8 @@ void userLoop();
486486
#include "soc/wdev_reg.h"
487487
#define HW_RND_REGISTER REG_READ(WDEV_RND_REG)
488488
#endif
489+
#define inoise8 perlin8 // fastled legacy alias
490+
#define inoise16 perlin16 // fastled legacy alias
489491
#define hex2int(a) (((a)>='0' && (a)<='9') ? (a)-'0' : ((a)>='A' && (a)<='F') ? (a)-'A'+10 : ((a)>='a' && (a)<='f') ? (a)-'a'+10 : 0)
490492
[[gnu::pure]] int getNumVal(const String* req, uint16_t pos);
491493
void parseNumber(const char* str, byte* val, byte minv=0, byte maxv=255);

0 commit comments

Comments
 (0)