Skip to content

Commit 9046ec4

Browse files
committed
Octopus minor optimization
replacing "map" with direct computation
1 parent 1670330 commit 9046ec4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

wled00/FX.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8646,7 +8646,8 @@ uint16_t mode_2Doctopus() {
86468646
intensity = sin8(radialStep + sin8(radialStep - radius) + angle * (SEGMENT.custom3/4+1)); // RadialWave
86478647
else
86488648
intensity = sin8(sin8((angle * 4 - radius) / 4 + octopusStep) + radius - SEGENV.step + angle * (SEGMENT.custom3/4+1)); // Octopus
8649-
intensity = map(intensity*intensity, 0, 65535, 0, 255); // add a bit of non-linearity for cleaner display
8649+
//intensity = map(intensity*intensity, 0, 65535, 0, 255); // add a bit of non-linearity for cleaner display
8650+
intensity = (intensity * intensity) / 255; // WLEDMM same as above, but faster and a bit more accurate
86508651
CRGB c = ColorFromPalette(SEGPALETTE, SEGENV.step / 2 - radius, intensity);
86518652
SEGMENT.setPixelColorXY(x, y, c);
86528653
}

0 commit comments

Comments
 (0)