Skip to content

Commit a5b07bc

Browse files
committed
bugfix for 2D Polar Lights
on large setups (bigger than 32x32) the effect would only show a small horizontal line.
1 parent 0f677c3 commit a5b07bc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

wled00/FX.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5645,6 +5645,8 @@ uint16_t mode_2DPolarLights(void) { // By: Kostyantyn Matviyevskyy https
56455645

56465646
const uint16_t cols = SEGMENT.virtualWidth();
56475647
const uint16_t rows = SEGMENT.virtualHeight();
5648+
const float maxRows = (rows <= 32) ? 32.0f : (rows <= 64) ? 64.0f : 128.0f; // WLEDMM safe up to 128x128
5649+
const float minScale = (rows <= 32) ? 12.0f : (rows <= 64) ? 4.6f : 2.1f; // WLEDMM
56485650

56495651
const CRGBPalette16 auroraPalette = {0x000000, 0x003300, 0x006600, 0x009900, 0x00cc00, 0x00ff00, 0x33ff00, 0x66ff00, 0x99ff00, 0xccff00, 0xffff00, 0xffcc00, 0xff9900, 0xff6600, 0xff3300, 0xff0000};
56505652

@@ -5653,8 +5655,11 @@ uint16_t mode_2DPolarLights(void) { // By: Kostyantyn Matviyevskyy https
56535655
SEGMENT.fill(BLACK);
56545656
}
56555657

5656-
float adjustHeight = mapf(rows, 8, 32, 28, 12); // maybe use mapf() ??? // WLEDMM yes!
5658+
float adjustHeight = mapf(rows, 8, maxRows, 28, minScale); // maybe use mapf() ??? // WLEDMM yes!
56575659
uint16_t adjScale = map(cols, 8, 64, 310, 63);
5660+
5661+
adjustHeight = max(min(adjustHeight, 28.0f), minScale); // WLEDMM bugfix for larger fixtures
5662+
adjScale = max(min(adjScale, uint16_t(310)), uint16_t(63)); // WLEDMM
56585663
/*
56595664
if (SEGENV.aux1 != SEGMENT.custom1/12) { // Hacky palette rotation. We need that black.
56605665
SEGENV.aux1 = SEGMENT.custom1/12;

0 commit comments

Comments
 (0)