Merge branch '0_15' into 0_15__speed_improvements
This commit is contained in:
@@ -2,24 +2,10 @@
|
||||
WS2812FX.cpp contains all effect methods
|
||||
Harm Aldick - 2016
|
||||
www.aldick.org
|
||||
LICENSE
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Harm Aldick
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
Licensed under the EUPL v. 1.2 or later
|
||||
Adapted from code originally licensed under the MIT license
|
||||
|
||||
Modified heavily for WLED
|
||||
*/
|
||||
@@ -2516,9 +2502,9 @@ static uint16_t ripple_base() {
|
||||
#endif
|
||||
{
|
||||
int left = rippleorigin - propI -1;
|
||||
int right = rippleorigin + propI +3;
|
||||
int right = rippleorigin + propI +2;
|
||||
for (int v = 0; v < 4; v++) {
|
||||
unsigned mag = scale8(cubicwave8((propF>>2)+(v-left)*64), amp);
|
||||
unsigned mag = scale8(cubicwave8((propF>>2) + v * 64), amp);
|
||||
SEGMENT.setPixelColor(left + v, color_blend(SEGMENT.getPixelColor(left + v), col, mag)); // TODO
|
||||
SEGMENT.setPixelColor(right - v, color_blend(SEGMENT.getPixelColor(right - v), col, mag)); // TODO
|
||||
}
|
||||
@@ -4027,7 +4013,7 @@ uint16_t mode_pacifica()
|
||||
|
||||
// Increment the four "color index start" counters, one for each wave layer.
|
||||
// Each is incremented at a different speed, and the speeds vary over time.
|
||||
unsigned sCIStart1 = SEGENV.aux0, sCIStart2 = SEGENV.aux1, sCIStart3 = SEGENV.step, sCIStart4 = SEGENV.step >> 16;
|
||||
unsigned sCIStart1 = SEGENV.aux0, sCIStart2 = SEGENV.aux1, sCIStart3 = SEGENV.step & 0xFFFF, sCIStart4 = (SEGENV.step >> 16);
|
||||
uint32_t deltams = (FRAMETIME >> 2) + ((FRAMETIME * SEGMENT.speed) >> 7);
|
||||
uint64_t deltat = (strip.now >> 2) + ((strip.now * SEGMENT.speed) >> 7);
|
||||
strip.now = deltat;
|
||||
@@ -4042,7 +4028,7 @@ uint16_t mode_pacifica()
|
||||
sCIStart3 -= (deltams1 * beatsin88(501,5,7));
|
||||
sCIStart4 -= (deltams2 * beatsin88(257,4,6));
|
||||
SEGENV.aux0 = sCIStart1; SEGENV.aux1 = sCIStart2;
|
||||
SEGENV.step = sCIStart4; SEGENV.step = (SEGENV.step << 16) + sCIStart3;
|
||||
SEGENV.step = (sCIStart4 << 16) | (sCIStart3 & 0xFFFF);
|
||||
|
||||
// Clear out the LED array to a dim background blue-green
|
||||
//SEGMENT.fill(132618);
|
||||
@@ -4920,8 +4906,8 @@ uint16_t mode_2DColoredBursts() { // By: ldirko https://editor.so
|
||||
SEGMENT.fadeToBlackBy(40);
|
||||
for (size_t i = 0; i < numLines; i++) {
|
||||
byte x1 = beatsin8(2 + SEGMENT.speed/16, 0, (cols - 1));
|
||||
byte x2 = beatsin8(1 + SEGMENT.speed/16, 0, (cols - 1));
|
||||
byte y1 = beatsin8(5 + SEGMENT.speed/16, 0, (rows - 1), 0, i * 24);
|
||||
byte x2 = beatsin8(1 + SEGMENT.speed/16, 0, (rows - 1));
|
||||
byte y1 = beatsin8(5 + SEGMENT.speed/16, 0, (cols - 1), 0, i * 24);
|
||||
byte y2 = beatsin8(3 + SEGMENT.speed/16, 0, (rows - 1), 0, i * 48 + 64);
|
||||
uint32_t color = ColorFromPalette(SEGPALETTE, i * 255 / numLines + (SEGENV.aux0&0xFF), 255, LINEARBLEND);
|
||||
|
||||
@@ -4999,9 +4985,11 @@ uint16_t mode_2DDNASpiral() { // By: ldirko https://editor.soulma
|
||||
// draw a gradient line between x and x1
|
||||
x = x / 2; x1 = x1 / 2;
|
||||
unsigned steps = abs8(x - x1) + 1;
|
||||
bool positive = (x1 >= x); // direction of drawing
|
||||
for (size_t k = 1; k <= steps; k++) {
|
||||
unsigned rate = k * 255 / steps;
|
||||
unsigned dx = lerp8by8(x, x1, rate);
|
||||
//unsigned dx = lerp8by8(x, x1, rate);
|
||||
unsigned dx = positive? (x + k-1) : (x - k+1); // behaves the same as "lerp8by8" but does not create holes
|
||||
//SEGMENT.setPixelColorXY(dx, i, ColorFromPalette(SEGPALETTE, hue, 255, LINEARBLEND).nscale8_video(rate));
|
||||
SEGMENT.addPixelColorXY(dx, i, ColorFromPalette(SEGPALETTE, hue, 255, LINEARBLEND)); // use setPixelColorXY for different look
|
||||
SEGMENT.fadePixelColorXY(dx, i, rate);
|
||||
@@ -7516,8 +7504,9 @@ uint16_t mode_2DAkemi(void) {
|
||||
|
||||
//add geq left and right
|
||||
if (um_data && fftResult) {
|
||||
for (int x=0; x < cols/8; x++) {
|
||||
unsigned band = x * cols/8;
|
||||
int xMax = cols/8;
|
||||
for (int x=0; x < xMax; x++) {
|
||||
unsigned band = map(x, 0, max(xMax,4), 0, 15); // map 0..cols/8 to 16 GEQ bands
|
||||
band = constrain(band, 0, 15);
|
||||
int barHeight = map(fftResult[band], 0, 255, 0, 17*rows/32);
|
||||
uint32_t color = SEGMENT.color_from_palette((band * 35), false, PALETTE_SOLID_WRAP, 0);
|
||||
@@ -7734,7 +7723,7 @@ uint16_t mode_2Doctopus() {
|
||||
const int C_Y = (rows / 2) + ((SEGMENT.custom2 - 128)*rows)/255;
|
||||
for (int x = 0; x < cols; x++) {
|
||||
for (int y = 0; y < rows; y++) {
|
||||
rMap[XY(x, y)].angle = 40.7436f * atan2f((y - C_Y), (x - C_X)); // avoid 128*atan2()/PI
|
||||
rMap[XY(x, y)].angle = int(40.7436f * atan2f((y - C_Y), (x - C_X))); // avoid 128*atan2()/PI
|
||||
rMap[XY(x, y)].radius = hypotf((x - C_X), (y - C_Y)) * mapp; //thanks Sutaburosu
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user