Remove leds array from utility functions + small things
- Remove CRGB* leds from utility functions - GameOfLife: fill_solid for prevLeds to for loop - Remove if !fftResult - Funky Plank: toggle src and dst - Comment drawLine as not used - Duplicate FadeToBlack, call one FadeToBlackOld
This commit is contained in:
parent
4202fb8cdc
commit
640f45f57d
158
wled00/FX.cpp
158
wled00/FX.cpp
@ -4570,10 +4570,10 @@ uint16_t mode_2DBlackHole(void) { // By: Stepko https://editor.soulma
|
|||||||
|
|
||||||
// initialize on first call
|
// initialize on first call
|
||||||
if (SEGENV.call == 0) {
|
if (SEGENV.call == 0) {
|
||||||
SEGMENT.fill_solid(nullptr, CRGB::Black);
|
SEGMENT.fill_solid(CRGB::Black);
|
||||||
}
|
}
|
||||||
|
|
||||||
SEGMENT.fadeToBlackBy(nullptr, 16 + (SEGMENT.speed>>3)); // create fading trails
|
SEGMENT.fadeToBlackBy(16 + (SEGMENT.speed>>3)); // create fading trails
|
||||||
float t = (float)(millis())/128; // timebase
|
float t = (float)(millis())/128; // timebase
|
||||||
// outer stars
|
// outer stars
|
||||||
for (size_t i = 0; i < 8; i++) {
|
for (size_t i = 0; i < 8; i++) {
|
||||||
@ -4590,7 +4590,7 @@ uint16_t mode_2DBlackHole(void) { // By: Stepko https://editor.soulma
|
|||||||
// central white dot
|
// central white dot
|
||||||
SEGMENT.setPixelColorXY(cols/2,rows/2, CHSV(0,0,255));
|
SEGMENT.setPixelColorXY(cols/2,rows/2, CHSV(0,0,255));
|
||||||
// blur everything a bit
|
// blur everything a bit
|
||||||
SEGMENT.blur2d(nullptr, 16);
|
SEGMENT.blur2d(16);
|
||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_2DBlackHole()
|
} // mode_2DBlackHole()
|
||||||
@ -4607,7 +4607,7 @@ uint16_t mode_2DColoredBursts() { // By: ldirko https://editor.so
|
|||||||
const uint16_t rows = SEGMENT.virtualHeight();
|
const uint16_t rows = SEGMENT.virtualHeight();
|
||||||
|
|
||||||
if (SEGENV.call == 0) {
|
if (SEGENV.call == 0) {
|
||||||
SEGMENT.fill_solid(nullptr, CRGB::Black);
|
SEGMENT.fill_solid(CRGB::Black);
|
||||||
SEGENV.aux0 = 0; // start with red hue
|
SEGENV.aux0 = 0; // start with red hue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4617,7 +4617,7 @@ uint16_t mode_2DColoredBursts() { // By: ldirko https://editor.so
|
|||||||
byte numLines = SEGMENT.intensity/16 + 1;
|
byte numLines = SEGMENT.intensity/16 + 1;
|
||||||
|
|
||||||
SEGENV.aux0++; // hue
|
SEGENV.aux0++; // hue
|
||||||
SEGMENT.fadeToBlackBy(nullptr, 40);
|
SEGMENT.fadeToBlackBy(40);
|
||||||
|
|
||||||
for (size_t i = 0; i < numLines; i++) {
|
for (size_t i = 0; i < numLines; i++) {
|
||||||
byte x1 = beatsin8(2 + SEGMENT.speed/16, 0, (cols - 1));
|
byte x1 = beatsin8(2 + SEGMENT.speed/16, 0, (cols - 1));
|
||||||
@ -4644,7 +4644,7 @@ uint16_t mode_2DColoredBursts() { // By: ldirko https://editor.so
|
|||||||
SEGMENT.addPixelColorXY(y1, y2, CRGB::White);
|
SEGMENT.addPixelColorXY(y1, y2, CRGB::White);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SEGMENT.blur2d(nullptr, 4);
|
SEGMENT.blur2d(4);
|
||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_2DColoredBursts()
|
} // mode_2DColoredBursts()
|
||||||
@ -4660,15 +4660,15 @@ uint16_t mode_2Ddna(void) { // dna originally by by ldirko at https://pa
|
|||||||
const uint16_t cols = SEGMENT.virtualWidth();
|
const uint16_t cols = SEGMENT.virtualWidth();
|
||||||
const uint16_t rows = SEGMENT.virtualHeight();
|
const uint16_t rows = SEGMENT.virtualHeight();
|
||||||
|
|
||||||
if (SEGENV.call == 0) SEGMENT.fill_solid(nullptr, CRGB::Black);
|
if (SEGENV.call == 0) SEGMENT.fill_solid(CRGB::Black);
|
||||||
|
|
||||||
SEGMENT.fadeToBlackBy(nullptr, 64);
|
SEGMENT.fadeToBlackBy(64);
|
||||||
|
|
||||||
for(int i = 0; i < cols; i++) {
|
for(int i = 0; i < cols; i++) {
|
||||||
SEGMENT.setPixelColorXY(i, beatsin8(SEGMENT.speed/8, 0, rows-1, 0, i*4), ColorFromPalette(SEGPALETTE, i*5+millis()/17, beatsin8(5, 55, 255, 0, i*10), LINEARBLEND));
|
SEGMENT.setPixelColorXY(i, beatsin8(SEGMENT.speed/8, 0, rows-1, 0, i*4), ColorFromPalette(SEGPALETTE, i*5+millis()/17, beatsin8(5, 55, 255, 0, i*10), LINEARBLEND));
|
||||||
SEGMENT.setPixelColorXY(i, beatsin8(SEGMENT.speed/8, 0, rows-1, 0, i*4+128), ColorFromPalette(SEGPALETTE,i*5+128+millis()/17, beatsin8(5, 55, 255, 0, i*10+128), LINEARBLEND)); // 180 degrees (128) out of phase
|
SEGMENT.setPixelColorXY(i, beatsin8(SEGMENT.speed/8, 0, rows-1, 0, i*4+128), ColorFromPalette(SEGPALETTE,i*5+128+millis()/17, beatsin8(5, 55, 255, 0, i*10+128), LINEARBLEND)); // 180 degrees (128) out of phase
|
||||||
}
|
}
|
||||||
SEGMENT.blur2d(nullptr, SEGMENT.intensity/8);
|
SEGMENT.blur2d(SEGMENT.intensity/8);
|
||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_2Ddna()
|
} // mode_2Ddna()
|
||||||
@ -4685,7 +4685,7 @@ uint16_t mode_2DDNASpiral() { // By: ldirko https://editor.soulma
|
|||||||
const uint16_t rows = SEGMENT.virtualHeight();
|
const uint16_t rows = SEGMENT.virtualHeight();
|
||||||
|
|
||||||
if (SEGENV.call == 0) {
|
if (SEGENV.call == 0) {
|
||||||
SEGMENT.fill_solid(nullptr, CRGB::Black);
|
SEGMENT.fill_solid(CRGB::Black);
|
||||||
SEGENV.aux0 = 0; // hue
|
SEGENV.aux0 = 0; // hue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4693,7 +4693,7 @@ uint16_t mode_2DDNASpiral() { // By: ldirko https://editor.soulma
|
|||||||
uint8_t freq = SEGMENT.intensity/8;
|
uint8_t freq = SEGMENT.intensity/8;
|
||||||
|
|
||||||
uint32_t ms = millis() / 20;
|
uint32_t ms = millis() / 20;
|
||||||
SEGMENT.nscale8(nullptr, 120);
|
SEGMENT.nscale8(120);
|
||||||
|
|
||||||
for (uint16_t i = 0; i < rows; i++) {
|
for (uint16_t i = 0; i < rows; i++) {
|
||||||
uint16_t x = beatsin8(speeds, 0, cols - 1, 0, i * freq) + beatsin8(speeds - 7, 0, cols - 1, 0, i * freq + 128);
|
uint16_t x = beatsin8(speeds, 0, cols - 1, 0, i * freq) + beatsin8(speeds - 7, 0, cols - 1, 0, i * freq + 128);
|
||||||
@ -4728,9 +4728,9 @@ uint16_t mode_2DDrift() { // By: Stepko https://editor.soulmateli
|
|||||||
const uint16_t cols = SEGMENT.virtualWidth();
|
const uint16_t cols = SEGMENT.virtualWidth();
|
||||||
const uint16_t rows = SEGMENT.virtualHeight();
|
const uint16_t rows = SEGMENT.virtualHeight();
|
||||||
|
|
||||||
if (SEGENV.call == 0) SEGMENT.fill_solid(nullptr, CRGB::Black);
|
if (SEGENV.call == 0) SEGMENT.fill_solid(CRGB::Black);
|
||||||
|
|
||||||
SEGMENT.fadeToBlackBy(nullptr, 128);
|
SEGMENT.fadeToBlackBy(128);
|
||||||
|
|
||||||
const uint16_t maxDim = MAX(cols, rows)/2;
|
const uint16_t maxDim = MAX(cols, rows)/2;
|
||||||
unsigned long t = millis() / (32 - (SEGMENT.speed>>3));
|
unsigned long t = millis() / (32 - (SEGMENT.speed>>3));
|
||||||
@ -4740,7 +4740,7 @@ uint16_t mode_2DDrift() { // By: Stepko https://editor.soulmateli
|
|||||||
uint16_t myY = (rows>>1) + (uint16_t)(cos_t(angle) * i) + (rows%2);
|
uint16_t myY = (rows>>1) + (uint16_t)(cos_t(angle) * i) + (rows%2);
|
||||||
SEGMENT.setPixelColorXY(myX,myY, ColorFromPalette(SEGPALETTE, (i * 20) + (t / 20), 255, LINEARBLEND));
|
SEGMENT.setPixelColorXY(myX,myY, ColorFromPalette(SEGPALETTE, (i * 20) + (t / 20), 255, LINEARBLEND));
|
||||||
}
|
}
|
||||||
SEGMENT.blur2d(nullptr, SEGMENT.intensity>>3);
|
SEGMENT.blur2d(SEGMENT.intensity>>3);
|
||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_2DDrift()
|
} // mode_2DDrift()
|
||||||
@ -4756,7 +4756,7 @@ uint16_t mode_2Dfirenoise(void) { // firenoise2d. By Andrew Tuline
|
|||||||
const uint16_t cols = SEGMENT.virtualWidth();
|
const uint16_t cols = SEGMENT.virtualWidth();
|
||||||
const uint16_t rows = SEGMENT.virtualHeight();
|
const uint16_t rows = SEGMENT.virtualHeight();
|
||||||
|
|
||||||
if (SEGENV.call == 0) SEGMENT.fill_solid(nullptr, CRGB::Black);
|
if (SEGENV.call == 0) SEGMENT.fill_solid(CRGB::Black);
|
||||||
|
|
||||||
uint16_t xscale = SEGMENT.intensity*4;
|
uint16_t xscale = SEGMENT.intensity*4;
|
||||||
uint32_t yscale = SEGMENT.speed*8;
|
uint32_t yscale = SEGMENT.speed*8;
|
||||||
@ -4788,13 +4788,13 @@ uint16_t mode_2DFrizzles(void) { // By: Stepko https://editor.so
|
|||||||
const uint16_t cols = SEGMENT.virtualWidth();
|
const uint16_t cols = SEGMENT.virtualWidth();
|
||||||
const uint16_t rows = SEGMENT.virtualHeight();
|
const uint16_t rows = SEGMENT.virtualHeight();
|
||||||
|
|
||||||
if (SEGENV.call == 0) SEGMENT.fill_solid(nullptr, CRGB::Black);
|
if (SEGENV.call == 0) SEGMENT.fill_solid(CRGB::Black);
|
||||||
|
|
||||||
SEGMENT.fadeToBlackBy(nullptr, 16);
|
SEGMENT.fadeToBlackBy(16);
|
||||||
for (size_t i = 8; i > 0; i--) {
|
for (size_t i = 8; i > 0; i--) {
|
||||||
SEGMENT.setPixelColorXY(beatsin8(SEGMENT.speed/8 + i, 0, cols - 1), beatsin8(SEGMENT.intensity/8 - i, 0, rows - 1), ColorFromPalette(SEGPALETTE, beatsin8(12, 0, 255), 255, LINEARBLEND));
|
SEGMENT.setPixelColorXY(beatsin8(SEGMENT.speed/8 + i, 0, cols - 1), beatsin8(SEGMENT.intensity/8 - i, 0, rows - 1), ColorFromPalette(SEGPALETTE, beatsin8(12, 0, 255), 255, LINEARBLEND));
|
||||||
}
|
}
|
||||||
SEGMENT.blur2d(nullptr, 16);
|
SEGMENT.blur2d(16);
|
||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_2DFrizzles()
|
} // mode_2DFrizzles()
|
||||||
@ -4837,7 +4837,8 @@ uint16_t mode_2Dgameoflife(void) { // Written by Ewoud Wijma, inspired by https:
|
|||||||
SEGMENT.setPixelColorXY(x,y, SEGMENT.color_from_palette(random8(), false, PALETTE_SOLID_WRAP, 0));
|
SEGMENT.setPixelColorXY(x,y, SEGMENT.color_from_palette(random8(), false, PALETTE_SOLID_WRAP, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
SEGMENT.fill_solid(prevLeds, CRGB::Black);
|
for(uint16_t y = 0; y < rows; y++) for (uint16_t x = 0; x < cols; x++) prevLeds[XY(x,y)] = CRGB::Black;
|
||||||
|
|
||||||
|
|
||||||
SEGENV.aux1 = 0;
|
SEGENV.aux1 = 0;
|
||||||
SEGENV.aux0 = 0xFFFF;
|
SEGENV.aux0 = 0xFFFF;
|
||||||
@ -5034,7 +5035,7 @@ uint16_t mode_2DJulia(void) { // An animated Julia set
|
|||||||
}
|
}
|
||||||
y += dy;
|
y += dy;
|
||||||
}
|
}
|
||||||
// blur2d( leds, 64);
|
// blur2d(64);
|
||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_2DJulia()
|
} // mode_2DJulia()
|
||||||
@ -5078,7 +5079,7 @@ uint16_t mode_2Dmatrix(void) { // Matrix2D. By Jeremy Williams.
|
|||||||
const uint16_t cols = SEGMENT.virtualWidth();
|
const uint16_t cols = SEGMENT.virtualWidth();
|
||||||
const uint16_t rows = SEGMENT.virtualHeight();
|
const uint16_t rows = SEGMENT.virtualHeight();
|
||||||
|
|
||||||
if (SEGENV.call == 0) SEGMENT.fill_solid(nullptr, CRGB::Black);
|
if (SEGENV.call == 0) SEGMENT.fill_solid(CRGB::Black);
|
||||||
|
|
||||||
uint8_t fade = map(SEGMENT.custom1, 0, 255, 50, 250); // equals trail size
|
uint8_t fade = map(SEGMENT.custom1, 0, 255, 50, 250); // equals trail size
|
||||||
uint8_t speed = (256-SEGMENT.speed) >> map(MIN(rows, 150), 0, 150, 0, 3); // slower speeds for small displays
|
uint8_t speed = (256-SEGMENT.speed) >> map(MIN(rows, 150), 0, 150, 0, 3); // slower speeds for small displays
|
||||||
@ -5225,9 +5226,9 @@ uint16_t mode_2DPlasmaball(void) { // By: Stepko https://edito
|
|||||||
const uint16_t cols = SEGMENT.virtualWidth();
|
const uint16_t cols = SEGMENT.virtualWidth();
|
||||||
const uint16_t rows = SEGMENT.virtualHeight();
|
const uint16_t rows = SEGMENT.virtualHeight();
|
||||||
|
|
||||||
if (SEGENV.call == 0) SEGMENT.fill_solid(nullptr, CRGB::Black);
|
if (SEGENV.call == 0) SEGMENT.fill_solid(CRGB::Black);
|
||||||
|
|
||||||
SEGMENT.fadeToBlackBy(nullptr, 64);
|
SEGMENT.fadeToBlackBy(64);
|
||||||
float t = millis() / (33 - SEGMENT.speed/8);
|
float t = millis() / (33 - SEGMENT.speed/8);
|
||||||
for (uint16_t i = 0; i < cols; i++) {
|
for (uint16_t i = 0; i < cols; i++) {
|
||||||
uint16_t thisVal = inoise8(i * 30, t, t);
|
uint16_t thisVal = inoise8(i * 30, t, t);
|
||||||
@ -5248,7 +5249,7 @@ uint16_t mode_2DPlasmaball(void) { // By: Stepko https://edito
|
|||||||
(rows - 1 - cy == 0)) ? ColorFromPalette(SEGPALETTE, beat8(5), thisVal, LINEARBLEND) : CRGB::Black);
|
(rows - 1 - cy == 0)) ? ColorFromPalette(SEGPALETTE, beat8(5), thisVal, LINEARBLEND) : CRGB::Black);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SEGMENT.blur2d(nullptr, 4);
|
SEGMENT.blur2d(4);
|
||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_2DPlasmaball()
|
} // mode_2DPlasmaball()
|
||||||
@ -5271,7 +5272,7 @@ uint16_t mode_2DPolarLights(void) { // By: Kostyantyn Matviyevskyy https
|
|||||||
|
|
||||||
if (SEGENV.call == 0) {
|
if (SEGENV.call == 0) {
|
||||||
SEGENV.step = 0;
|
SEGENV.step = 0;
|
||||||
SEGMENT.fill_solid(nullptr, CRGB::Black);
|
SEGMENT.fill_solid(CRGB::Black);
|
||||||
}
|
}
|
||||||
|
|
||||||
float adjustHeight = (float)map(rows, 8, 32, 28, 12);
|
float adjustHeight = (float)map(rows, 8, 32, 28, 12);
|
||||||
@ -5318,16 +5319,16 @@ uint16_t mode_2DPulser(void) { // By: ldirko https://edi
|
|||||||
//const uint16_t cols = SEGMENT.virtualWidth();
|
//const uint16_t cols = SEGMENT.virtualWidth();
|
||||||
const uint16_t rows = SEGMENT.virtualHeight();
|
const uint16_t rows = SEGMENT.virtualHeight();
|
||||||
|
|
||||||
if (SEGENV.call == 0) SEGMENT.fill_solid(nullptr, CRGB::Black);
|
if (SEGENV.call == 0) SEGMENT.fill_solid(CRGB::Black);
|
||||||
|
|
||||||
SEGMENT.fadeToBlackBy(nullptr, 8 - (SEGMENT.intensity>>5));
|
SEGMENT.fadeToBlackBy(8 - (SEGMENT.intensity>>5));
|
||||||
|
|
||||||
uint16_t a = strip.now / (18 - SEGMENT.speed / 16);
|
uint16_t a = strip.now / (18 - SEGMENT.speed / 16);
|
||||||
uint16_t x = (a / 14);
|
uint16_t x = (a / 14);
|
||||||
uint16_t y = map((sin8(a * 5) + sin8(a * 4) + sin8(a * 2)), 0, 765, rows-1, 0);
|
uint16_t y = map((sin8(a * 5) + sin8(a * 4) + sin8(a * 2)), 0, 765, rows-1, 0);
|
||||||
SEGMENT.setPixelColorXY(x, y, ColorFromPalette(SEGPALETTE, map(y, 0, rows-1, 0, 255), 255, LINEARBLEND));
|
SEGMENT.setPixelColorXY(x, y, ColorFromPalette(SEGPALETTE, map(y, 0, rows-1, 0, 255), 255, LINEARBLEND));
|
||||||
|
|
||||||
SEGMENT.blur2d(nullptr, 1 + (SEGMENT.intensity>>4));
|
SEGMENT.blur2d(1 + (SEGMENT.intensity>>4));
|
||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_2DPulser()
|
} // mode_2DPulser()
|
||||||
@ -5343,9 +5344,9 @@ uint16_t mode_2DSindots(void) { // By: ldirko http
|
|||||||
const uint16_t cols = SEGMENT.virtualWidth();
|
const uint16_t cols = SEGMENT.virtualWidth();
|
||||||
const uint16_t rows = SEGMENT.virtualHeight();
|
const uint16_t rows = SEGMENT.virtualHeight();
|
||||||
|
|
||||||
if (SEGENV.call == 0) SEGMENT.fill_solid(nullptr, CRGB::Black);
|
if (SEGENV.call == 0) SEGMENT.fill_solid(CRGB::Black);
|
||||||
|
|
||||||
SEGMENT.fadeToBlackBy(nullptr, 15);
|
SEGMENT.fadeToBlackBy(15);
|
||||||
byte t1 = millis() / (257 - SEGMENT.speed); // 20;
|
byte t1 = millis() / (257 - SEGMENT.speed); // 20;
|
||||||
byte t2 = sin8(t1) / 4 * 2;
|
byte t2 = sin8(t1) / 4 * 2;
|
||||||
for (uint16_t i = 0; i < 13; i++) {
|
for (uint16_t i = 0; i < 13; i++) {
|
||||||
@ -5353,7 +5354,7 @@ uint16_t mode_2DSindots(void) { // By: ldirko http
|
|||||||
byte y = sin8(t2 + i * SEGMENT.intensity/8)*(rows-1)/255; // max index now 255x15/255=15!
|
byte y = sin8(t2 + i * SEGMENT.intensity/8)*(rows-1)/255; // max index now 255x15/255=15!
|
||||||
SEGMENT.setPixelColorXY(x, y, ColorFromPalette(SEGPALETTE, i * 255 / 13, 255, LINEARBLEND));
|
SEGMENT.setPixelColorXY(x, y, ColorFromPalette(SEGPALETTE, i * 255 / 13, 255, LINEARBLEND));
|
||||||
}
|
}
|
||||||
SEGMENT.blur2d(nullptr, 16);
|
SEGMENT.blur2d(16);
|
||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_2DSindots()
|
} // mode_2DSindots()
|
||||||
@ -5371,13 +5372,13 @@ uint16_t mode_2Dsquaredswirl(void) { // By: Mark Kriegsman. https://g
|
|||||||
const uint16_t cols = SEGMENT.virtualWidth();
|
const uint16_t cols = SEGMENT.virtualWidth();
|
||||||
const uint16_t rows = SEGMENT.virtualHeight();
|
const uint16_t rows = SEGMENT.virtualHeight();
|
||||||
|
|
||||||
if (SEGENV.call == 0) SEGMENT.fill_solid(nullptr, CRGB::Black);
|
if (SEGENV.call == 0) SEGMENT.fill_solid(CRGB::Black);
|
||||||
|
|
||||||
const uint8_t kBorderWidth = 2;
|
const uint8_t kBorderWidth = 2;
|
||||||
|
|
||||||
SEGMENT.fadeToBlackBy(nullptr, 24);
|
SEGMENT.fadeToBlackBy(24);
|
||||||
uint8_t blurAmount = SEGMENT.custom3>>4;
|
uint8_t blurAmount = SEGMENT.custom3>>4;
|
||||||
SEGMENT.blur2d(nullptr, blurAmount);
|
SEGMENT.blur2d(blurAmount);
|
||||||
|
|
||||||
// Use two out-of-sync sine waves
|
// Use two out-of-sync sine waves
|
||||||
uint8_t i = beatsin8(19, kBorderWidth, cols-kBorderWidth);
|
uint8_t i = beatsin8(19, kBorderWidth, cols-kBorderWidth);
|
||||||
@ -5410,7 +5411,7 @@ uint16_t mode_2DSunradiation(void) { // By: ldirko https://edi
|
|||||||
if (!SEGENV.allocateData(sizeof(byte)*(cols+2)*(rows+2))) return mode_static(); //allocation failed
|
if (!SEGENV.allocateData(sizeof(byte)*(cols+2)*(rows+2))) return mode_static(); //allocation failed
|
||||||
byte *bump = reinterpret_cast<byte*>(SEGENV.data);
|
byte *bump = reinterpret_cast<byte*>(SEGENV.data);
|
||||||
|
|
||||||
if (SEGENV.call == 0) SEGMENT.fill_solid(nullptr, CRGB::Black);
|
if (SEGENV.call == 0) SEGMENT.fill_solid(CRGB::Black);
|
||||||
|
|
||||||
unsigned long t = millis() / 4;
|
unsigned long t = millis() / 4;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
@ -5455,7 +5456,7 @@ uint16_t mode_2Dtartan(void) { // By: Elliott Kember https://editor.so
|
|||||||
const uint16_t cols = SEGMENT.virtualWidth();
|
const uint16_t cols = SEGMENT.virtualWidth();
|
||||||
const uint16_t rows = SEGMENT.virtualHeight();
|
const uint16_t rows = SEGMENT.virtualHeight();
|
||||||
|
|
||||||
if (SEGENV.call == 0) SEGMENT.fill_solid(nullptr, CRGB::Black);
|
if (SEGENV.call == 0) SEGMENT.fill_solid(CRGB::Black);
|
||||||
|
|
||||||
uint8_t hue;
|
uint8_t hue;
|
||||||
int offsetX = beatsin16(3, -360, 360);
|
int offsetX = beatsin16(3, -360, 360);
|
||||||
@ -5484,7 +5485,7 @@ uint16_t mode_2Dspaceships(void) { //// Space ships by stepko (c)05.02.21 [ht
|
|||||||
const uint16_t cols = SEGMENT.virtualWidth();
|
const uint16_t cols = SEGMENT.virtualWidth();
|
||||||
const uint16_t rows = SEGMENT.virtualHeight();
|
const uint16_t rows = SEGMENT.virtualHeight();
|
||||||
|
|
||||||
if (SEGENV.call == 0) SEGMENT.fill_solid(nullptr, CRGB::Black);
|
if (SEGENV.call == 0) SEGMENT.fill_solid(CRGB::Black);
|
||||||
|
|
||||||
uint32_t tb = strip.now >> 12; // every ~4s
|
uint32_t tb = strip.now >> 12; // every ~4s
|
||||||
if (tb > SEGENV.step) {
|
if (tb > SEGENV.step) {
|
||||||
@ -5496,8 +5497,8 @@ uint16_t mode_2Dspaceships(void) { //// Space ships by stepko (c)05.02.21 [ht
|
|||||||
SEGENV.step = tb + random8(4);
|
SEGENV.step = tb + random8(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
SEGMENT.fadeToBlackBy(nullptr, map(SEGMENT.speed, 0, 255, 248, 16));
|
SEGMENT.fadeToBlackBy(map(SEGMENT.speed, 0, 255, 248, 16));
|
||||||
SEGMENT.move(SEGENV.aux0, 1, nullptr);
|
SEGMENT.move(SEGENV.aux0, 1);
|
||||||
for (size_t i = 0; i < 8; i++) {
|
for (size_t i = 0; i < 8; i++) {
|
||||||
byte x = beatsin8(12 + i, 2, cols - 3);
|
byte x = beatsin8(12 + i, 2, cols - 3);
|
||||||
byte y = beatsin8(15 + i, 2, rows - 3);
|
byte y = beatsin8(15 + i, 2, rows - 3);
|
||||||
@ -5510,7 +5511,7 @@ uint16_t mode_2Dspaceships(void) { //// Space ships by stepko (c)05.02.21 [ht
|
|||||||
SEGMENT.addPixelColorXY(x, y - 1, color);
|
SEGMENT.addPixelColorXY(x, y - 1, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SEGMENT.blur2d(nullptr, SEGMENT.intensity>>3);
|
SEGMENT.blur2d(SEGMENT.intensity>>3);
|
||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
}
|
}
|
||||||
@ -5550,7 +5551,7 @@ uint16_t mode_2Dcrazybees(void) {
|
|||||||
bee_t *bee = reinterpret_cast<bee_t*>(SEGENV.data);
|
bee_t *bee = reinterpret_cast<bee_t*>(SEGENV.data);
|
||||||
|
|
||||||
if (SEGENV.call == 0) {
|
if (SEGENV.call == 0) {
|
||||||
SEGMENT.fill_solid(nullptr, CRGB::Black);
|
SEGMENT.fill_solid(CRGB::Black);
|
||||||
for (size_t i = 0; i < n; i++) {
|
for (size_t i = 0; i < n; i++) {
|
||||||
bee[i].posX = random8(0, cols);
|
bee[i].posX = random8(0, cols);
|
||||||
bee[i].posY = random8(0, rows);
|
bee[i].posY = random8(0, rows);
|
||||||
@ -5561,7 +5562,7 @@ uint16_t mode_2Dcrazybees(void) {
|
|||||||
if (millis() > SEGENV.step) {
|
if (millis() > SEGENV.step) {
|
||||||
SEGENV.step = millis() + (FRAMETIME * 8 / ((SEGMENT.speed>>5)+1));
|
SEGENV.step = millis() + (FRAMETIME * 8 / ((SEGMENT.speed>>5)+1));
|
||||||
|
|
||||||
SEGMENT.fadeToBlackBy(nullptr, 32);
|
SEGMENT.fadeToBlackBy(32);
|
||||||
|
|
||||||
for (size_t i = 0; i < n; i++) {
|
for (size_t i = 0; i < n; i++) {
|
||||||
SEGMENT.addPixelColorXY(bee[i].aimX + 1, bee[i].aimY, CHSV(bee[i].hue, 255, 255));
|
SEGMENT.addPixelColorXY(bee[i].aimX + 1, bee[i].aimY, CHSV(bee[i].hue, 255, 255));
|
||||||
@ -5583,7 +5584,7 @@ uint16_t mode_2Dcrazybees(void) {
|
|||||||
bee[i].aimed(cols, rows);
|
bee[i].aimed(cols, rows);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SEGMENT.blur2d(nullptr, SEGMENT.intensity>>4);
|
SEGMENT.blur2d(SEGMENT.intensity>>4);
|
||||||
|
|
||||||
}
|
}
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
@ -5623,7 +5624,7 @@ uint16_t mode_2Dghostrider(void) {
|
|||||||
if (SEGENV.call == 0 || SEGENV.aux0 != cols || SEGENV.aux1 != rows) {
|
if (SEGENV.call == 0 || SEGENV.aux0 != cols || SEGENV.aux1 != rows) {
|
||||||
SEGENV.aux0 = cols;
|
SEGENV.aux0 = cols;
|
||||||
SEGENV.aux1 = rows;
|
SEGENV.aux1 = rows;
|
||||||
SEGMENT.fill_solid(nullptr, CRGB::Black);
|
SEGMENT.fill_solid(CRGB::Black);
|
||||||
random16_set_seed(strip.now);
|
random16_set_seed(strip.now);
|
||||||
lighter->angleSpeed = random8(0,20) - 10;
|
lighter->angleSpeed = random8(0,20) - 10;
|
||||||
lighter->Vspeed = 5;
|
lighter->Vspeed = 5;
|
||||||
@ -5639,10 +5640,10 @@ uint16_t mode_2Dghostrider(void) {
|
|||||||
if (millis() > SEGENV.step) {
|
if (millis() > SEGENV.step) {
|
||||||
SEGENV.step = millis() + 1024 / (cols+rows);
|
SEGENV.step = millis() + 1024 / (cols+rows);
|
||||||
|
|
||||||
SEGMENT.fadeToBlackBy(nullptr, (SEGMENT.speed>>2)+64);
|
SEGMENT.fadeToBlackBy((SEGMENT.speed>>2)+64);
|
||||||
|
|
||||||
CRGB color = CRGB::White;
|
CRGB color = CRGB::White;
|
||||||
SEGMENT.wu_pixel(nullptr, lighter->gPosX * 256 / 10, lighter->gPosY * 256 / 10, color);
|
SEGMENT.wu_pixel(lighter->gPosX * 256 / 10, lighter->gPosY * 256 / 10, color);
|
||||||
|
|
||||||
lighter->gPosX += lighter->Vspeed * sin_t(radians(lighter->gAngle));
|
lighter->gPosX += lighter->Vspeed * sin_t(radians(lighter->gAngle));
|
||||||
lighter->gPosY += lighter->Vspeed * cos_t(radians(lighter->gAngle));
|
lighter->gPosY += lighter->Vspeed * cos_t(radians(lighter->gAngle));
|
||||||
@ -5670,9 +5671,9 @@ uint16_t mode_2Dghostrider(void) {
|
|||||||
lighter->lightersPosX[i] += -7 * sin_t(radians(lighter->Angle[i]));
|
lighter->lightersPosX[i] += -7 * sin_t(radians(lighter->Angle[i]));
|
||||||
lighter->lightersPosY[i] += -7 * cos_t(radians(lighter->Angle[i]));
|
lighter->lightersPosY[i] += -7 * cos_t(radians(lighter->Angle[i]));
|
||||||
}
|
}
|
||||||
SEGMENT.wu_pixel(nullptr, lighter->lightersPosX[i] * 256 / 10, lighter->lightersPosY[i] * 256 / 10, ColorFromPalette(SEGPALETTE, (256 - lighter->time[i])));
|
SEGMENT.wu_pixel(lighter->lightersPosX[i] * 256 / 10, lighter->lightersPosY[i] * 256 / 10, ColorFromPalette(SEGPALETTE, (256 - lighter->time[i])));
|
||||||
}
|
}
|
||||||
SEGMENT.blur2d(nullptr, SEGMENT.intensity>>3);
|
SEGMENT.blur2d(SEGMENT.intensity>>3);
|
||||||
}
|
}
|
||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
@ -5707,7 +5708,7 @@ uint16_t mode_2Dfloatingblobs(void) {
|
|||||||
if (SEGENV.call == 0 || SEGENV.aux0 != cols || SEGENV.aux1 != rows) {
|
if (SEGENV.call == 0 || SEGENV.aux0 != cols || SEGENV.aux1 != rows) {
|
||||||
SEGENV.aux0 = cols;
|
SEGENV.aux0 = cols;
|
||||||
SEGENV.aux1 = rows;
|
SEGENV.aux1 = rows;
|
||||||
SEGMENT.fill_solid(nullptr, CRGB::Black);
|
SEGMENT.fill_solid(CRGB::Black);
|
||||||
for (size_t i = 0; i < MAX_BLOBS; i++) {
|
for (size_t i = 0; i < MAX_BLOBS; i++) {
|
||||||
blob->r[i] = cols>15 ? random8(1, cols/8.f) : 1;
|
blob->r[i] = cols>15 ? random8(1, cols/8.f) : 1;
|
||||||
blob->sX[i] = (float) random8(3, cols) / (float)(256 - SEGMENT.speed); // speed x
|
blob->sX[i] = (float) random8(3, cols) / (float)(256 - SEGMENT.speed); // speed x
|
||||||
@ -5721,7 +5722,7 @@ uint16_t mode_2Dfloatingblobs(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SEGMENT.fadeToBlackBy(nullptr, 20);
|
SEGMENT.fadeToBlackBy(20);
|
||||||
|
|
||||||
// Bounce balls around
|
// Bounce balls around
|
||||||
for (size_t i = 0; i < Amount; i++) {
|
for (size_t i = 0; i < Amount; i++) {
|
||||||
@ -5742,7 +5743,7 @@ uint16_t mode_2Dfloatingblobs(void) {
|
|||||||
}
|
}
|
||||||
CRGB c = ColorFromPalette(SEGPALETTE, blob->color[i]);
|
CRGB c = ColorFromPalette(SEGPALETTE, blob->color[i]);
|
||||||
//if (!SEGMENT.palette) c = SEGCOLOR(0);
|
//if (!SEGMENT.palette) c = SEGCOLOR(0);
|
||||||
if (blob->r[i] > 1.f) SEGMENT.fill_circle(nullptr, blob->y[i], blob->x[i], blob->r[i], c);
|
if (blob->r[i] > 1.f) SEGMENT.fill_circle(blob->y[i], blob->x[i], blob->r[i], c);
|
||||||
else SEGMENT.addPixelColorXY(blob->y[i], blob->x[i], c);
|
else SEGMENT.addPixelColorXY(blob->y[i], blob->x[i], c);
|
||||||
// move x
|
// move x
|
||||||
if (blob->x[i] + blob->r[i] >= cols - 1) blob->x[i] += (blob->sX[i] * ((cols - 1 - blob->x[i]) / blob->r[i] + 0.005f));
|
if (blob->x[i] + blob->r[i] >= cols - 1) blob->x[i] += (blob->sX[i] * ((cols - 1 - blob->x[i]) / blob->r[i] + 0.005f));
|
||||||
@ -5771,7 +5772,7 @@ uint16_t mode_2Dfloatingblobs(void) {
|
|||||||
blob->y[i] = rows - 1.01f;
|
blob->y[i] = rows - 1.01f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SEGMENT.blur2d(nullptr, cols+rows);
|
SEGMENT.blur2d(cols+rows);
|
||||||
|
|
||||||
if (SEGENV.step < millis()) SEGENV.step = millis() + 2000; // change colors every 2 seconds
|
if (SEGENV.step < millis()) SEGENV.step = millis() + 2000; // change colors every 2 seconds
|
||||||
|
|
||||||
@ -5846,16 +5847,16 @@ uint16_t mode_2Ddriftrose(void) {
|
|||||||
const float L = min(cols, rows) / 2.f;
|
const float L = min(cols, rows) / 2.f;
|
||||||
|
|
||||||
if (SEGENV.call == 0) {
|
if (SEGENV.call == 0) {
|
||||||
SEGMENT.fill_solid(nullptr, CRGB::Black);
|
SEGMENT.fill_solid(CRGB::Black);
|
||||||
}
|
}
|
||||||
|
|
||||||
SEGMENT.fadeToBlackBy(nullptr, 32+(SEGMENT.speed>>3));
|
SEGMENT.fadeToBlackBy(32+(SEGMENT.speed>>3));
|
||||||
for (size_t i = 1; i < 37; i++) {
|
for (size_t i = 1; i < 37; i++) {
|
||||||
uint32_t x = (CX + (sin_t(radians(i * 10)) * (beatsin8(i, 0, L*2)-L))) * 255.f;
|
uint32_t x = (CX + (sin_t(radians(i * 10)) * (beatsin8(i, 0, L*2)-L))) * 255.f;
|
||||||
uint32_t y = (CY + (cos_t(radians(i * 10)) * (beatsin8(i, 0, L*2)-L))) * 255.f;
|
uint32_t y = (CY + (cos_t(radians(i * 10)) * (beatsin8(i, 0, L*2)-L))) * 255.f;
|
||||||
SEGMENT.wu_pixel(nullptr, x, y, CHSV(i * 10, 255, 255));
|
SEGMENT.wu_pixel(x, y, CHSV(i * 10, 255, 255));
|
||||||
}
|
}
|
||||||
SEGMENT.blur2d(nullptr, (SEGMENT.intensity>>4)+1);
|
SEGMENT.blur2d((SEGMENT.intensity>>4)+1);
|
||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
}
|
}
|
||||||
@ -5888,7 +5889,6 @@ static const char *_data_FX_MODE_2DDRIFTROSE PROGMEM = "2D Drift Rose@Fade,Blur;
|
|||||||
binNum = (uint8_t*) um_data->u_data[7]; // requires UI element (SEGMENT.customX?), changes source element
|
binNum = (uint8_t*) um_data->u_data[7]; // requires UI element (SEGMENT.customX?), changes source element
|
||||||
fftBin = (float*) um_data->u_data[8];
|
fftBin = (float*) um_data->u_data[8];
|
||||||
} else {
|
} else {
|
||||||
// add support for no audio data
|
|
||||||
um_data = simulateSound(SEGMENT.soundSim);
|
um_data = simulateSound(SEGMENT.soundSim);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
@ -5908,7 +5908,6 @@ uint16_t mode_ripplepeak(void) { // * Ripple peak. By Andrew Tuli
|
|||||||
|
|
||||||
um_data_t *um_data;
|
um_data_t *um_data;
|
||||||
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||||
// add support for no audio data
|
|
||||||
um_data = simulateSound(SEGMENT.soundSim);
|
um_data = simulateSound(SEGMENT.soundSim);
|
||||||
}
|
}
|
||||||
uint8_t samplePeak = *(uint8_t*)um_data->u_data[3];
|
uint8_t samplePeak = *(uint8_t*)um_data->u_data[3];
|
||||||
@ -5982,11 +5981,11 @@ uint16_t mode_2DSwirl(void) {
|
|||||||
const uint16_t cols = SEGMENT.virtualWidth();
|
const uint16_t cols = SEGMENT.virtualWidth();
|
||||||
const uint16_t rows = SEGMENT.virtualHeight();
|
const uint16_t rows = SEGMENT.virtualHeight();
|
||||||
|
|
||||||
if (SEGENV.call == 0) SEGMENT.fill_solid(nullptr, CRGB::Black);
|
if (SEGENV.call == 0) SEGMENT.fill_solid(CRGB::Black);
|
||||||
|
|
||||||
const uint8_t borderWidth = 2;
|
const uint8_t borderWidth = 2;
|
||||||
|
|
||||||
SEGMENT.blur2d(nullptr, SEGMENT.custom1);
|
SEGMENT.blur2d(SEGMENT.custom1);
|
||||||
|
|
||||||
uint8_t i = beatsin8( 27*SEGMENT.speed/255, borderWidth, cols - borderWidth);
|
uint8_t i = beatsin8( 27*SEGMENT.speed/255, borderWidth, cols - borderWidth);
|
||||||
uint8_t j = beatsin8( 41*SEGMENT.speed/255, borderWidth, rows - borderWidth);
|
uint8_t j = beatsin8( 41*SEGMENT.speed/255, borderWidth, rows - borderWidth);
|
||||||
@ -5996,7 +5995,6 @@ uint16_t mode_2DSwirl(void) {
|
|||||||
|
|
||||||
um_data_t *um_data;
|
um_data_t *um_data;
|
||||||
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||||
// add support for no audio data
|
|
||||||
um_data = simulateSound(SEGMENT.soundSim);
|
um_data = simulateSound(SEGMENT.soundSim);
|
||||||
}
|
}
|
||||||
float volumeSmth = *(float*) um_data->u_data[0]; //ewowi: use instead of sampleAvg???
|
float volumeSmth = *(float*) um_data->u_data[0]; //ewowi: use instead of sampleAvg???
|
||||||
@ -6027,17 +6025,16 @@ uint16_t mode_2DWaverly(void) {
|
|||||||
const uint16_t rows = SEGMENT.virtualHeight();
|
const uint16_t rows = SEGMENT.virtualHeight();
|
||||||
|
|
||||||
if (SEGENV.call == 0) {
|
if (SEGENV.call == 0) {
|
||||||
SEGMENT.fill_solid(nullptr, CRGB::Black);
|
SEGMENT.fill_solid(CRGB::Black);
|
||||||
}
|
}
|
||||||
|
|
||||||
um_data_t *um_data;
|
um_data_t *um_data;
|
||||||
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||||
// add support for no audio data
|
|
||||||
um_data = simulateSound(SEGMENT.soundSim);
|
um_data = simulateSound(SEGMENT.soundSim);
|
||||||
}
|
}
|
||||||
float volumeSmth = *(float*) um_data->u_data[0];
|
float volumeSmth = *(float*) um_data->u_data[0];
|
||||||
|
|
||||||
SEGMENT.fadeToBlackBy(nullptr, SEGMENT.speed);
|
SEGMENT.fadeToBlackBy(SEGMENT.speed);
|
||||||
|
|
||||||
long t = millis() / 2;
|
long t = millis() / 2;
|
||||||
for (uint16_t i = 0; i < cols; i++) {
|
for (uint16_t i = 0; i < cols; i++) {
|
||||||
@ -6054,7 +6051,7 @@ uint16_t mode_2DWaverly(void) {
|
|||||||
SEGMENT.addPixelColorXY((cols - 1) - i, (rows - 1) - j, ColorFromPalette(SEGPALETTE, map(j, 0, thisMax, 250, 0), 255, LINEARBLEND));
|
SEGMENT.addPixelColorXY((cols - 1) - i, (rows - 1) - j, ColorFromPalette(SEGPALETTE, map(j, 0, thisMax, 250, 0), 255, LINEARBLEND));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SEGMENT.blur2d(nullptr, 16);
|
SEGMENT.blur2d(16);
|
||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_2DWaverly()
|
} // mode_2DWaverly()
|
||||||
@ -6084,7 +6081,6 @@ uint16_t mode_gravcenter(void) { // Gravcenter. By Andrew Tuline.
|
|||||||
|
|
||||||
um_data_t *um_data;
|
um_data_t *um_data;
|
||||||
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||||
// add support for no audio data
|
|
||||||
um_data = simulateSound(SEGMENT.soundSim);
|
um_data = simulateSound(SEGMENT.soundSim);
|
||||||
}
|
}
|
||||||
float volumeSmth = *(float*) um_data->u_data[0];
|
float volumeSmth = *(float*) um_data->u_data[0];
|
||||||
@ -6131,7 +6127,6 @@ uint16_t mode_gravcentric(void) { // Gravcentric. By Andrew
|
|||||||
|
|
||||||
um_data_t *um_data;
|
um_data_t *um_data;
|
||||||
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||||
// add support for no audio data
|
|
||||||
um_data = simulateSound(SEGMENT.soundSim);
|
um_data = simulateSound(SEGMENT.soundSim);
|
||||||
}
|
}
|
||||||
float volumeSmth = *(float*) um_data->u_data[0];
|
float volumeSmth = *(float*) um_data->u_data[0];
|
||||||
@ -6181,7 +6176,6 @@ uint16_t mode_gravimeter(void) { // Gravmeter. By Andrew Tuline.
|
|||||||
|
|
||||||
um_data_t *um_data;
|
um_data_t *um_data;
|
||||||
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||||
// add support for no audio data
|
|
||||||
um_data = simulateSound(SEGMENT.soundSim);
|
um_data = simulateSound(SEGMENT.soundSim);
|
||||||
}
|
}
|
||||||
float volumeSmth = *(float*) um_data->u_data[0];
|
float volumeSmth = *(float*) um_data->u_data[0];
|
||||||
@ -6221,7 +6215,6 @@ static const char *_data_FX_MODE_GRAVIMETER PROGMEM = "Gravimeter ♪@Rate of fa
|
|||||||
uint16_t mode_juggles(void) { // Juggles. By Andrew Tuline.
|
uint16_t mode_juggles(void) { // Juggles. By Andrew Tuline.
|
||||||
um_data_t *um_data;
|
um_data_t *um_data;
|
||||||
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||||
// add support for no audio data
|
|
||||||
um_data = simulateSound(SEGMENT.soundSim);
|
um_data = simulateSound(SEGMENT.soundSim);
|
||||||
}
|
}
|
||||||
float volumeSmth = *(float*) um_data->u_data[0];
|
float volumeSmth = *(float*) um_data->u_data[0];
|
||||||
@ -6244,7 +6237,6 @@ static const char *_data_FX_MODE_JUGGLES PROGMEM = "Juggles ♪@!,# of balls;,!;
|
|||||||
uint16_t mode_matripix(void) { // Matripix. By Andrew Tuline.
|
uint16_t mode_matripix(void) { // Matripix. By Andrew Tuline.
|
||||||
um_data_t *um_data;
|
um_data_t *um_data;
|
||||||
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||||
// add support for no audio data
|
|
||||||
um_data = simulateSound(SEGMENT.soundSim);
|
um_data = simulateSound(SEGMENT.soundSim);
|
||||||
}
|
}
|
||||||
int16_t volumeRaw = *(int16_t*)um_data->u_data[1];
|
int16_t volumeRaw = *(int16_t*)um_data->u_data[1];
|
||||||
@ -6273,7 +6265,6 @@ uint16_t mode_midnoise(void) { // Midnoise. By Andrew Tuline.
|
|||||||
|
|
||||||
um_data_t *um_data;
|
um_data_t *um_data;
|
||||||
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||||
// add support for no audio data
|
|
||||||
um_data = simulateSound(SEGMENT.soundSim);
|
um_data = simulateSound(SEGMENT.soundSim);
|
||||||
}
|
}
|
||||||
float volumeSmth = *(float*) um_data->u_data[0];
|
float volumeSmth = *(float*) um_data->u_data[0];
|
||||||
@ -6312,7 +6303,6 @@ uint16_t mode_noisefire(void) { // Noisefire. By Andrew Tuline.
|
|||||||
|
|
||||||
um_data_t *um_data;
|
um_data_t *um_data;
|
||||||
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||||
// add support for no audio data
|
|
||||||
um_data = simulateSound(SEGMENT.soundSim);
|
um_data = simulateSound(SEGMENT.soundSim);
|
||||||
}
|
}
|
||||||
float volumeSmth = *(float*) um_data->u_data[0];
|
float volumeSmth = *(float*) um_data->u_data[0];
|
||||||
@ -6338,7 +6328,6 @@ uint16_t mode_noisemeter(void) { // Noisemeter. By Andrew Tuline.
|
|||||||
|
|
||||||
um_data_t *um_data;
|
um_data_t *um_data;
|
||||||
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||||
// add support for no audio data
|
|
||||||
um_data = simulateSound(SEGMENT.soundSim);
|
um_data = simulateSound(SEGMENT.soundSim);
|
||||||
}
|
}
|
||||||
float volumeSmth = *(float*) um_data->u_data[0];
|
float volumeSmth = *(float*) um_data->u_data[0];
|
||||||
@ -6372,7 +6361,6 @@ uint16_t mode_pixelwave(void) { // Pixelwave. By Andrew Tuline.
|
|||||||
|
|
||||||
um_data_t *um_data;
|
um_data_t *um_data;
|
||||||
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||||
// add support for no audio data
|
|
||||||
um_data = simulateSound(SEGMENT.soundSim);
|
um_data = simulateSound(SEGMENT.soundSim);
|
||||||
}
|
}
|
||||||
int16_t volumeRaw = *(int16_t*)um_data->u_data[1];
|
int16_t volumeRaw = *(int16_t*)um_data->u_data[1];
|
||||||
@ -6409,7 +6397,6 @@ uint16_t mode_plasmoid(void) { // Plasmoid. By Andrew Tuline.
|
|||||||
|
|
||||||
um_data_t *um_data;
|
um_data_t *um_data;
|
||||||
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||||
// add support for no audio data
|
|
||||||
um_data = simulateSound(SEGMENT.soundSim);
|
um_data = simulateSound(SEGMENT.soundSim);
|
||||||
}
|
}
|
||||||
float volumeSmth = *(float*) um_data->u_data[0];
|
float volumeSmth = *(float*) um_data->u_data[0];
|
||||||
@ -6447,7 +6434,6 @@ uint16_t mode_puddlepeak(void) { // Puddlepeak. By Andrew Tuline.
|
|||||||
|
|
||||||
um_data_t *um_data;
|
um_data_t *um_data;
|
||||||
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||||
// add support for no audio data
|
|
||||||
um_data = simulateSound(SEGMENT.soundSim);
|
um_data = simulateSound(SEGMENT.soundSim);
|
||||||
}
|
}
|
||||||
uint8_t samplePeak = *(uint8_t*)um_data->u_data[3];
|
uint8_t samplePeak = *(uint8_t*)um_data->u_data[3];
|
||||||
@ -6491,7 +6477,6 @@ uint16_t mode_puddles(void) { // Puddles. By Andrew Tuline.
|
|||||||
|
|
||||||
um_data_t *um_data;
|
um_data_t *um_data;
|
||||||
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||||
// add support for no audio data
|
|
||||||
um_data = simulateSound(SEGMENT.soundSim);
|
um_data = simulateSound(SEGMENT.soundSim);
|
||||||
}
|
}
|
||||||
int16_t volumeRaw = *(int16_t*)um_data->u_data[1];
|
int16_t volumeRaw = *(int16_t*)um_data->u_data[1];
|
||||||
@ -6632,11 +6617,9 @@ static const char *_data_FX_MODE_BINMAP PROGMEM = " ♫ Binmap@,,Input level=128
|
|||||||
uint16_t mode_blurz(void) { // Blurz. By Andrew Tuline.
|
uint16_t mode_blurz(void) { // Blurz. By Andrew Tuline.
|
||||||
um_data_t *um_data;
|
um_data_t *um_data;
|
||||||
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||||
// add support for no audio data
|
|
||||||
um_data = simulateSound(SEGMENT.soundSim);
|
um_data = simulateSound(SEGMENT.soundSim);
|
||||||
}
|
}
|
||||||
uint8_t *fftResult = (uint8_t*)um_data->u_data[2];
|
uint8_t *fftResult = (uint8_t*)um_data->u_data[2];
|
||||||
if (!fftResult) return mode_static();
|
|
||||||
|
|
||||||
if (SEGENV.call == 0) {
|
if (SEGENV.call == 0) {
|
||||||
SEGMENT.fill(BLACK);
|
SEGMENT.fill(BLACK);
|
||||||
@ -6664,11 +6647,9 @@ uint16_t mode_DJLight(void) { // Written by ??? Adapted by Wil
|
|||||||
|
|
||||||
um_data_t *um_data;
|
um_data_t *um_data;
|
||||||
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||||
// add support for no audio data
|
|
||||||
um_data = simulateSound(SEGMENT.soundSim);
|
um_data = simulateSound(SEGMENT.soundSim);
|
||||||
}
|
}
|
||||||
uint8_t *fftResult = (uint8_t*)um_data->u_data[2];
|
uint8_t *fftResult = (uint8_t*)um_data->u_data[2];
|
||||||
if (!fftResult) return mode_static();
|
|
||||||
|
|
||||||
uint8_t secondHand = micros()/(256-SEGMENT.speed)/500+1 % 64;
|
uint8_t secondHand = micros()/(256-SEGMENT.speed)/500+1 % 64;
|
||||||
if (SEGENV.aux0 != secondHand) { // Triggered millis timing.
|
if (SEGENV.aux0 != secondHand) { // Triggered millis timing.
|
||||||
@ -6696,7 +6677,6 @@ uint16_t mode_freqmap(void) { // Map FFT_MajorPeak to SEGLEN.
|
|||||||
|
|
||||||
um_data_t *um_data;
|
um_data_t *um_data;
|
||||||
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||||
// add support for no audio data
|
|
||||||
um_data = simulateSound(SEGMENT.soundSim);
|
um_data = simulateSound(SEGMENT.soundSim);
|
||||||
}
|
}
|
||||||
float FFT_MajorPeak = *(float*) um_data->u_data[4];
|
float FFT_MajorPeak = *(float*) um_data->u_data[4];
|
||||||
@ -6723,7 +6703,6 @@ static const char *_data_FX_MODE_FREQMAP PROGMEM = "Freqmap ♫@Fade rate,Starti
|
|||||||
uint16_t mode_freqmatrix(void) { // Freqmatrix. By Andreas Pleschung.
|
uint16_t mode_freqmatrix(void) { // Freqmatrix. By Andreas Pleschung.
|
||||||
um_data_t *um_data;
|
um_data_t *um_data;
|
||||||
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||||
// add support for no audio data
|
|
||||||
um_data = simulateSound(SEGMENT.soundSim);
|
um_data = simulateSound(SEGMENT.soundSim);
|
||||||
}
|
}
|
||||||
float FFT_MajorPeak = *(float*)um_data->u_data[4];
|
float FFT_MajorPeak = *(float*)um_data->u_data[4];
|
||||||
@ -6777,7 +6756,6 @@ static const char *_data_FX_MODE_FREQMATRIX PROGMEM = "Freqmatrix ♫@Time delay
|
|||||||
uint16_t mode_freqpixels(void) { // Freqpixel. By Andrew Tuline.
|
uint16_t mode_freqpixels(void) { // Freqpixel. By Andrew Tuline.
|
||||||
um_data_t *um_data;
|
um_data_t *um_data;
|
||||||
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||||
// add support for no audio data
|
|
||||||
um_data = simulateSound(SEGMENT.soundSim);
|
um_data = simulateSound(SEGMENT.soundSim);
|
||||||
}
|
}
|
||||||
float FFT_MajorPeak = *(float*) um_data->u_data[4];
|
float FFT_MajorPeak = *(float*) um_data->u_data[4];
|
||||||
@ -6815,7 +6793,6 @@ static const char *_data_FX_MODE_FREQPIXELS PROGMEM = "Freqpixels ♫@Fade rate,
|
|||||||
uint16_t mode_freqwave(void) { // Freqwave. By Andreas Pleschung.
|
uint16_t mode_freqwave(void) { // Freqwave. By Andreas Pleschung.
|
||||||
um_data_t *um_data;
|
um_data_t *um_data;
|
||||||
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||||
// add support for no audio data
|
|
||||||
um_data = simulateSound(SEGMENT.soundSim);
|
um_data = simulateSound(SEGMENT.soundSim);
|
||||||
}
|
}
|
||||||
float FFT_MajorPeak = *(float*) um_data->u_data[4];
|
float FFT_MajorPeak = *(float*) um_data->u_data[4];
|
||||||
@ -6875,7 +6852,6 @@ uint16_t mode_gravfreq(void) { // Gravfreq. By Andrew Tuline.
|
|||||||
|
|
||||||
um_data_t *um_data;
|
um_data_t *um_data;
|
||||||
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||||
// add support for no audio data
|
|
||||||
um_data = simulateSound(SEGMENT.soundSim);
|
um_data = simulateSound(SEGMENT.soundSim);
|
||||||
}
|
}
|
||||||
float FFT_MajorPeak = *(float*) um_data->u_data[4];
|
float FFT_MajorPeak = *(float*) um_data->u_data[4];
|
||||||
@ -6920,11 +6896,9 @@ static const char *_data_FX_MODE_GRAVFREQ PROGMEM = "Gravfreq ♫@Rate of fall,S
|
|||||||
uint16_t mode_noisemove(void) { // Noisemove. By: Andrew Tuline
|
uint16_t mode_noisemove(void) { // Noisemove. By: Andrew Tuline
|
||||||
um_data_t *um_data;
|
um_data_t *um_data;
|
||||||
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||||
// add support for no audio data
|
|
||||||
um_data = simulateSound(SEGMENT.soundSim);
|
um_data = simulateSound(SEGMENT.soundSim);
|
||||||
}
|
}
|
||||||
uint8_t *fftResult = (uint8_t*)um_data->u_data[2];
|
uint8_t *fftResult = (uint8_t*)um_data->u_data[2];
|
||||||
if (!fftResult) return mode_static();
|
|
||||||
|
|
||||||
SEGMENT.fade_out(224); // Just in case something doesn't get faded.
|
SEGMENT.fade_out(224); // Just in case something doesn't get faded.
|
||||||
|
|
||||||
@ -6946,7 +6920,6 @@ static const char *_data_FX_MODE_NOISEMOVE PROGMEM = "Noisemove ♫@Speed of per
|
|||||||
uint16_t mode_rocktaves(void) { // Rocktaves. Same note from each octave is same colour. By: Andrew Tuline
|
uint16_t mode_rocktaves(void) { // Rocktaves. Same note from each octave is same colour. By: Andrew Tuline
|
||||||
um_data_t *um_data;
|
um_data_t *um_data;
|
||||||
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||||
// add support for no audio data
|
|
||||||
um_data = simulateSound(SEGMENT.soundSim);
|
um_data = simulateSound(SEGMENT.soundSim);
|
||||||
}
|
}
|
||||||
float FFT_MajorPeak = *(float*) um_data->u_data[4];
|
float FFT_MajorPeak = *(float*) um_data->u_data[4];
|
||||||
@ -6986,7 +6959,6 @@ uint16_t mode_waterfall(void) { // Waterfall. By: Andrew Tulin
|
|||||||
|
|
||||||
um_data_t *um_data;
|
um_data_t *um_data;
|
||||||
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||||
// add support for no audio data
|
|
||||||
um_data = simulateSound(SEGMENT.soundSim);
|
um_data = simulateSound(SEGMENT.soundSim);
|
||||||
}
|
}
|
||||||
uint8_t samplePeak = *(uint8_t*)um_data->u_data[3];
|
uint8_t samplePeak = *(uint8_t*)um_data->u_data[3];
|
||||||
@ -7039,11 +7011,9 @@ uint16_t mode_2DGEQ(void) { // By Will Tatam. Code reduction by Ewoud Wijma.
|
|||||||
|
|
||||||
um_data_t *um_data;
|
um_data_t *um_data;
|
||||||
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||||
// add support for no audio data
|
|
||||||
um_data = simulateSound(SEGMENT.soundSim);
|
um_data = simulateSound(SEGMENT.soundSim);
|
||||||
}
|
}
|
||||||
uint8_t *fftResult = (uint8_t*)um_data->u_data[2];
|
uint8_t *fftResult = (uint8_t*)um_data->u_data[2];
|
||||||
if (!fftResult) return mode_static();
|
|
||||||
|
|
||||||
if (SEGENV.call == 0) for (int i=0; i<cols; i++) previousBarHeight[i] = 0;
|
if (SEGENV.call == 0) for (int i=0; i<cols; i++) previousBarHeight[i] = 0;
|
||||||
|
|
||||||
@ -7100,11 +7070,9 @@ uint16_t mode_2DFunkyPlank(void) { // Written by ??? Adapted by Wil
|
|||||||
|
|
||||||
um_data_t *um_data;
|
um_data_t *um_data;
|
||||||
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||||
// add support for no audio data
|
|
||||||
um_data = simulateSound(SEGMENT.soundSim);
|
um_data = simulateSound(SEGMENT.soundSim);
|
||||||
}
|
}
|
||||||
uint8_t *fftResult = (uint8_t*)um_data->u_data[2];
|
uint8_t *fftResult = (uint8_t*)um_data->u_data[2];
|
||||||
if (!fftResult) return mode_static();
|
|
||||||
|
|
||||||
uint8_t secondHand = micros()/(256-SEGMENT.speed)/500+1 % 64;
|
uint8_t secondHand = micros()/(256-SEGMENT.speed)/500+1 % 64;
|
||||||
if (SEGENV.aux0 != secondHand) { // Triggered millis timing.
|
if (SEGENV.aux0 != secondHand) { // Triggered millis timing.
|
||||||
@ -7124,7 +7092,7 @@ uint16_t mode_2DFunkyPlank(void) { // Written by ??? Adapted by Wil
|
|||||||
// Update the display:
|
// Update the display:
|
||||||
for (int i = (rows - 1); i > 0; i--) {
|
for (int i = (rows - 1); i > 0; i--) {
|
||||||
for (int j = (cols - 1); j >= 0; j--) {
|
for (int j = (cols - 1); j >= 0; j--) {
|
||||||
SEGMENT.setPixelColorXY(j, i-1, SEGMENT.getPixelColorXY(j, i));
|
SEGMENT.setPixelColorXY(j, i, SEGMENT.getPixelColorXY(j, i-1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
32
wled00/FX.h
32
wled00/FX.h
@ -575,22 +575,22 @@ typedef struct Segment {
|
|||||||
void addPixelColorXY(uint16_t x, uint16_t y, uint32_t color);
|
void addPixelColorXY(uint16_t x, uint16_t y, uint32_t color);
|
||||||
void addPixelColorXY(uint16_t x, uint16_t y, byte r, byte g, byte b, byte w = 0) { addPixelColorXY(x, y, RGBW32(r,g,b,w)); } // automatically inline
|
void addPixelColorXY(uint16_t x, uint16_t y, byte r, byte g, byte b, byte w = 0) { addPixelColorXY(x, y, RGBW32(r,g,b,w)); } // automatically inline
|
||||||
void addPixelColorXY(uint16_t x, uint16_t y, CRGB c) { addPixelColorXY(x, y, c.red, c.green, c.blue); } // automatically inline
|
void addPixelColorXY(uint16_t x, uint16_t y, CRGB c) { addPixelColorXY(x, y, c.red, c.green, c.blue); } // automatically inline
|
||||||
void blur1d(CRGB* leds, fract8 blur_amount);
|
void blur1d(fract8 blur_amount);
|
||||||
void blur1d(uint16_t i, bool vertical, fract8 blur_amount, CRGB* leds=nullptr); // 1D box blur (with weight)
|
void blur1d(uint16_t i, bool vertical, fract8 blur_amount); // 1D box blur (with weight)
|
||||||
void blur2d(CRGB* leds, fract8 blur_amount);
|
void blur2d(fract8 blur_amount);
|
||||||
void blurRow(uint16_t row, fract8 blur_amount, CRGB* leds=nullptr);
|
void blurRow(uint16_t row, fract8 blur_amount);
|
||||||
void blurCol(uint16_t col, fract8 blur_amount, CRGB* leds=nullptr);
|
void blurCol(uint16_t col, fract8 blur_amount);
|
||||||
void moveX(CRGB *leds, int8_t delta);
|
void moveX(int8_t delta);
|
||||||
void moveY(CRGB *leds, int8_t delta);
|
void moveY(int8_t delta);
|
||||||
void move(uint8_t dir, uint8_t delta, CRGB *leds=nullptr);
|
void move(uint8_t dir, uint8_t delta);
|
||||||
void fill_solid(CRGB* leds, CRGB c);
|
void fill_solid(CRGB c);
|
||||||
void fill_circle(CRGB* leds, uint16_t cx, uint16_t cy, uint8_t radius, CRGB c);
|
void fill_circle(uint16_t cx, uint16_t cy, uint8_t radius, CRGB c);
|
||||||
void fadeToBlackBy(CRGB* leds, uint8_t fadeBy);
|
void fadeToBlackByOld(uint8_t fadeBy);
|
||||||
void nscale8(CRGB* leds, uint8_t scale);
|
void nscale8(uint8_t scale);
|
||||||
void drawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, CRGB c, CRGB *leds = nullptr);
|
// void drawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, CRGB c, CRGB *leds = nullptr);
|
||||||
void drawCharacter(unsigned char chr, int16_t x, int16_t y, uint8_t w, uint8_t h, CRGB color, CRGB *leds = nullptr);
|
void drawCharacter(unsigned char chr, int16_t x, int16_t y, uint8_t w, uint8_t h, CRGB color);
|
||||||
void wu_pixel(CRGB *leds, uint32_t x, uint32_t y, CRGB c);
|
void wu_pixel(uint32_t x, uint32_t y, CRGB c);
|
||||||
inline void drawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint32_t c) { drawLine(x0, y0, x1, y1, CRGB(byte(c>>16), byte(c>>8), byte(c))); }
|
// inline void drawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint32_t c) { drawLine(x0, y0, x1, y1, CRGB(byte(c>>16), byte(c>>8), byte(c))); }
|
||||||
inline void drawCharacter(unsigned char chr, int16_t x, int16_t y, uint8_t w, uint8_t h, uint32_t c) { drawCharacter(chr, x, y, w, h, CRGB(byte(c>>16), byte(c>>8), byte(c))); }
|
inline void drawCharacter(unsigned char chr, int16_t x, int16_t y, uint8_t w, uint8_t h, uint32_t c) { drawCharacter(chr, x, y, w, h, CRGB(byte(c>>16), byte(c>>8), byte(c))); }
|
||||||
} segment;
|
} segment;
|
||||||
//static int i = sizeof(Segment);
|
//static int i = sizeof(Segment);
|
||||||
|
@ -276,7 +276,7 @@ void Segment::addPixelColorXY(uint16_t x, uint16_t y, uint32_t color) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// blurRow: perform a blur on a row of a rectangular matrix
|
// blurRow: perform a blur on a row of a rectangular matrix
|
||||||
void Segment::blurRow(uint16_t row, fract8 blur_amount, CRGB* leds) {
|
void Segment::blurRow(uint16_t row, fract8 blur_amount) {
|
||||||
#ifndef WLED_DISABLE_2D
|
#ifndef WLED_DISABLE_2D
|
||||||
const uint16_t cols = virtualWidth();
|
const uint16_t cols = virtualWidth();
|
||||||
const uint16_t rows = virtualHeight();
|
const uint16_t rows = virtualHeight();
|
||||||
@ -287,25 +287,23 @@ void Segment::blurRow(uint16_t row, fract8 blur_amount, CRGB* leds) {
|
|||||||
uint8_t seep = blur_amount >> 1;
|
uint8_t seep = blur_amount >> 1;
|
||||||
CRGB carryover = CRGB::Black;
|
CRGB carryover = CRGB::Black;
|
||||||
for (uint16_t x = 0; x < cols; x++) {
|
for (uint16_t x = 0; x < cols; x++) {
|
||||||
CRGB cur = leds ? leds[XY(x,row)] : CRGB(getPixelColorXY(x, row));
|
CRGB cur = CRGB(getPixelColorXY(x, row));
|
||||||
CRGB part = cur;
|
CRGB part = cur;
|
||||||
part.nscale8(seep);
|
part.nscale8(seep);
|
||||||
cur.nscale8(keep);
|
cur.nscale8(keep);
|
||||||
cur += carryover;
|
cur += carryover;
|
||||||
if (x) {
|
if (x) {
|
||||||
CRGB prev = (leds ? leds[XY(x-1,row)] : CRGB(getPixelColorXY(x-1, row))) + part;
|
CRGB prev = CRGB(getPixelColorXY(x-1, row)) + part;
|
||||||
if (leds) leds[XY(x-1,row)] = prev;
|
setPixelColorXY(x-1, row, prev);
|
||||||
else setPixelColorXY(x-1, row, prev);
|
|
||||||
}
|
}
|
||||||
if (leds) leds[XY(x,row)] = cur;
|
setPixelColorXY(x, row, cur);
|
||||||
else setPixelColorXY(x, row, cur);
|
|
||||||
carryover = part;
|
carryover = part;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// blurCol: perform a blur on a column of a rectangular matrix
|
// blurCol: perform a blur on a column of a rectangular matrix
|
||||||
void Segment::blurCol(uint16_t col, fract8 blur_amount, CRGB* leds) {
|
void Segment::blurCol(uint16_t col, fract8 blur_amount) {
|
||||||
#ifndef WLED_DISABLE_2D
|
#ifndef WLED_DISABLE_2D
|
||||||
const uint16_t cols = virtualWidth();
|
const uint16_t cols = virtualWidth();
|
||||||
const uint16_t rows = virtualHeight();
|
const uint16_t rows = virtualHeight();
|
||||||
@ -316,18 +314,16 @@ void Segment::blurCol(uint16_t col, fract8 blur_amount, CRGB* leds) {
|
|||||||
uint8_t seep = blur_amount >> 1;
|
uint8_t seep = blur_amount >> 1;
|
||||||
CRGB carryover = CRGB::Black;
|
CRGB carryover = CRGB::Black;
|
||||||
for (uint16_t i = 0; i < rows; i++) {
|
for (uint16_t i = 0; i < rows; i++) {
|
||||||
CRGB cur = leds ? leds[XY(col,i)] : CRGB(getPixelColorXY(col, i));
|
CRGB cur = CRGB(getPixelColorXY(col, i));
|
||||||
CRGB part = cur;
|
CRGB part = cur;
|
||||||
part.nscale8(seep);
|
part.nscale8(seep);
|
||||||
cur.nscale8(keep);
|
cur.nscale8(keep);
|
||||||
cur += carryover;
|
cur += carryover;
|
||||||
if (i) {
|
if (i) {
|
||||||
CRGB prev = (leds ? leds[XY(col,i-1)] : CRGB(getPixelColorXY(col, i-1))) + part;
|
CRGB prev = CRGB(getPixelColorXY(col, i-1)) + part;
|
||||||
if (leds) leds[XY(col,i-1)] = prev;
|
setPixelColorXY(col, i-1, prev);
|
||||||
else setPixelColorXY(col, i-1, prev);
|
|
||||||
}
|
}
|
||||||
if (leds) leds[XY(col,i)] = cur;
|
setPixelColorXY(col, i, cur);
|
||||||
else setPixelColorXY(col, i, cur);
|
|
||||||
carryover = part;
|
carryover = part;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -347,15 +343,15 @@ void Segment::blurCol(uint16_t col, fract8 blur_amount, CRGB* leds) {
|
|||||||
// eventually all the way to black; this is by design so that
|
// eventually all the way to black; this is by design so that
|
||||||
// it can be used to (slowly) clear the LEDs to black.
|
// it can be used to (slowly) clear the LEDs to black.
|
||||||
|
|
||||||
void Segment::blur1d(CRGB* leds, fract8 blur_amount) {
|
void Segment::blur1d(fract8 blur_amount) {
|
||||||
#ifndef WLED_DISABLE_2D
|
#ifndef WLED_DISABLE_2D
|
||||||
const uint16_t rows = virtualHeight();
|
const uint16_t rows = virtualHeight();
|
||||||
for (uint16_t y = 0; y < rows; y++) blurRow(y, blur_amount, leds);
|
for (uint16_t y = 0; y < rows; y++) blurRow(y, blur_amount);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1D Box blur (with added weight - blur_amount: [0=no blur, 255=max blur])
|
// 1D Box blur (with added weight - blur_amount: [0=no blur, 255=max blur])
|
||||||
void Segment::blur1d(uint16_t i, bool vertical, fract8 blur_amount, CRGB* leds) {
|
void Segment::blur1d(uint16_t i, bool vertical, fract8 blur_amount) {
|
||||||
#ifndef WLED_DISABLE_2D
|
#ifndef WLED_DISABLE_2D
|
||||||
const uint16_t cols = virtualWidth();
|
const uint16_t cols = virtualWidth();
|
||||||
const uint16_t rows = virtualHeight();
|
const uint16_t rows = virtualHeight();
|
||||||
@ -373,9 +369,9 @@ void Segment::blur1d(uint16_t i, bool vertical, fract8 blur_amount, CRGB* leds)
|
|||||||
uint16_t yp = vertical ? y-1 : y;
|
uint16_t yp = vertical ? y-1 : y;
|
||||||
uint16_t xn = vertical ? x : x+1;
|
uint16_t xn = vertical ? x : x+1;
|
||||||
uint16_t yn = vertical ? y+1 : y;
|
uint16_t yn = vertical ? y+1 : y;
|
||||||
CRGB curr = leds ? leds[XY(x,y)] : CRGB(getPixelColorXY(x,y));
|
CRGB curr = CRGB(getPixelColorXY(x,y));
|
||||||
CRGB prev = (xp<0 || yp<0) ? CRGB::Black : (leds ? leds[XY(xp,yp)] : CRGB(getPixelColorXY(xp,yp)));
|
CRGB prev = (xp<0 || yp<0) ? CRGB::Black : CRGB(getPixelColorXY(xp,yp));
|
||||||
CRGB next = ((vertical && yn>=dim1) || (!vertical && xn>=dim1)) ? CRGB::Black : (leds ? leds[XY(xn,yn)] : CRGB(getPixelColorXY(xn,yn)));
|
CRGB next = ((vertical && yn>=dim1) || (!vertical && xn>=dim1)) ? CRGB::Black : CRGB(getPixelColorXY(xn,yn));
|
||||||
uint16_t r, g, b;
|
uint16_t r, g, b;
|
||||||
r = (curr.r*keep + (prev.r + next.r)*seep) / 3;
|
r = (curr.r*keep + (prev.r + next.r)*seep) / 3;
|
||||||
g = (curr.g*keep + (prev.g + next.g)*seep) / 3;
|
g = (curr.g*keep + (prev.g + next.g)*seep) / 3;
|
||||||
@ -385,22 +381,21 @@ void Segment::blur1d(uint16_t i, bool vertical, fract8 blur_amount, CRGB* leds)
|
|||||||
for (uint16_t j = 0; j < dim1; j++) {
|
for (uint16_t j = 0; j < dim1; j++) {
|
||||||
uint16_t x = vertical ? i : j;
|
uint16_t x = vertical ? i : j;
|
||||||
uint16_t y = vertical ? j : i;
|
uint16_t y = vertical ? j : i;
|
||||||
if (leds) leds[XY(x,y)] = tmp[j];
|
setPixelColorXY(x, y, tmp[j]);
|
||||||
else setPixelColorXY(x, y, tmp[j]);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Segment::blur2d(CRGB* leds, fract8 blur_amount) {
|
void Segment::blur2d(fract8 blur_amount) {
|
||||||
#ifndef WLED_DISABLE_2D
|
#ifndef WLED_DISABLE_2D
|
||||||
const uint16_t cols = virtualWidth();
|
const uint16_t cols = virtualWidth();
|
||||||
const uint16_t rows = virtualHeight();
|
const uint16_t rows = virtualHeight();
|
||||||
for (uint16_t i = 0; i < rows; i++) blurRow(i, blur_amount, leds); // blur all rows
|
for (uint16_t i = 0; i < rows; i++) blurRow(i, blur_amount); // blur all rows
|
||||||
for (uint16_t k = 0; k < cols; k++) blurCol(k, blur_amount, leds); // blur all columns
|
for (uint16_t k = 0; k < cols; k++) blurCol(k, blur_amount); // blur all columns
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Segment::moveX(CRGB *leds, int8_t delta) {
|
void Segment::moveX(int8_t delta) {
|
||||||
#ifndef WLED_DISABLE_2D
|
#ifndef WLED_DISABLE_2D
|
||||||
const uint16_t cols = virtualWidth();
|
const uint16_t cols = virtualWidth();
|
||||||
const uint16_t rows = virtualHeight();
|
const uint16_t rows = virtualHeight();
|
||||||
@ -408,20 +403,18 @@ void Segment::moveX(CRGB *leds, int8_t delta) {
|
|||||||
if (delta > 0) {
|
if (delta > 0) {
|
||||||
for (uint8_t y = 0; y < rows; y++) for (uint8_t x = 0; x < cols-1; x++) {
|
for (uint8_t y = 0; y < rows; y++) for (uint8_t x = 0; x < cols-1; x++) {
|
||||||
if (x + delta >= cols) break;
|
if (x + delta >= cols) break;
|
||||||
if (leds) leds[XY(x, y)] = leds[XY((x + delta)%cols, y)];
|
setPixelColorXY(x, y, getPixelColorXY((x + delta)%cols, y));
|
||||||
else setPixelColorXY(x, y, getPixelColorXY((x + delta)%cols, y));
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (uint8_t y = 0; y < rows; y++) for (int16_t x = cols-1; x >= 0; x--) {
|
for (uint8_t y = 0; y < rows; y++) for (int16_t x = cols-1; x >= 0; x--) {
|
||||||
if (x + delta < 0) break;
|
if (x + delta < 0) break;
|
||||||
if (leds) leds[XY(x, y)] = leds[XY(x + delta, y)];
|
setPixelColorXY(x, y, getPixelColorXY(x + delta, y));
|
||||||
else setPixelColorXY(x, y, getPixelColorXY(x + delta, y));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Segment::moveY(CRGB *leds, int8_t delta) {
|
void Segment::moveY(int8_t delta) {
|
||||||
#ifndef WLED_DISABLE_2D
|
#ifndef WLED_DISABLE_2D
|
||||||
const uint16_t cols = virtualWidth();
|
const uint16_t cols = virtualWidth();
|
||||||
const uint16_t rows = virtualHeight();
|
const uint16_t rows = virtualHeight();
|
||||||
@ -429,14 +422,12 @@ void Segment::moveY(CRGB *leds, int8_t delta) {
|
|||||||
if (delta > 0) {
|
if (delta > 0) {
|
||||||
for (uint8_t x = 0; x < cols; x++) for (uint8_t y = 0; y < rows-1; y++) {
|
for (uint8_t x = 0; x < cols; x++) for (uint8_t y = 0; y < rows-1; y++) {
|
||||||
if (y + delta >= rows) break;
|
if (y + delta >= rows) break;
|
||||||
if (leds) leds[XY(x, y)] = leds[XY(x, (y + delta))];
|
setPixelColorXY(x, y, getPixelColorXY(x, (y + delta)));
|
||||||
else setPixelColorXY(x, y, getPixelColorXY(x, (y + delta)));
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (uint8_t x = 0; x < cols; x++) for (int16_t y = rows-1; y >= 0; y--) {
|
for (uint8_t x = 0; x < cols; x++) for (int16_t y = rows-1; y >= 0; y--) {
|
||||||
if (y + delta < 0) break;
|
if (y + delta < 0) break;
|
||||||
if (leds) leds[XY(x, y)] = leds[XY(x, y + delta)];
|
setPixelColorXY(x, y, getPixelColorXY(x, y + delta));
|
||||||
else setPixelColorXY(x, y, getPixelColorXY(x, y + delta));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -445,35 +436,34 @@ void Segment::moveY(CRGB *leds, int8_t delta) {
|
|||||||
// move() - move all pixels in desired direction delta number of pixels
|
// move() - move all pixels in desired direction delta number of pixels
|
||||||
// @param dir direction: 0=left, 1=left-up, 2=up, 3=right-up, 4=right, 5=right-down, 6=down, 7=left-down
|
// @param dir direction: 0=left, 1=left-up, 2=up, 3=right-up, 4=right, 5=right-down, 6=down, 7=left-down
|
||||||
// @param delta number of pixels to move
|
// @param delta number of pixels to move
|
||||||
void Segment::move(uint8_t dir, uint8_t delta, CRGB *leds) {
|
void Segment::move(uint8_t dir, uint8_t delta) {
|
||||||
#ifndef WLED_DISABLE_2D
|
#ifndef WLED_DISABLE_2D
|
||||||
if (delta==0) return;
|
if (delta==0) return;
|
||||||
switch (dir) {
|
switch (dir) {
|
||||||
case 0: moveX(leds, delta); break;
|
case 0: moveX(delta); break;
|
||||||
case 1: moveX(leds, delta); moveY(leds, delta); break;
|
case 1: moveX(delta); moveY(delta); break;
|
||||||
case 2: moveY(leds, delta); break;
|
case 2: moveY(delta); break;
|
||||||
case 3: moveX(leds,-delta); moveY(leds, delta); break;
|
case 3: moveX(-delta); moveY(delta); break;
|
||||||
case 4: moveX(leds,-delta); break;
|
case 4: moveX(-delta); break;
|
||||||
case 5: moveX(leds,-delta); moveY(leds,-delta); break;
|
case 5: moveX(-delta); moveY(-delta); break;
|
||||||
case 6: moveY(leds,-delta); break;
|
case 6: moveY(-delta); break;
|
||||||
case 7: moveX(leds, delta); moveY(leds,-delta); break;
|
case 7: moveX(delta); moveY(-delta); break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Segment::fill_solid(CRGB* leds, CRGB color) {
|
void Segment::fill_solid(CRGB color) {
|
||||||
#ifndef WLED_DISABLE_2D
|
#ifndef WLED_DISABLE_2D
|
||||||
const uint16_t cols = virtualWidth();
|
const uint16_t cols = virtualWidth();
|
||||||
const uint16_t rows = virtualHeight();
|
const uint16_t rows = virtualHeight();
|
||||||
for(uint16_t y = 0; y < rows; y++) for (uint16_t x = 0; x < cols; x++) {
|
for(uint16_t y = 0; y < rows; y++) for (uint16_t x = 0; x < cols; x++) {
|
||||||
if (leds) leds[XY(x,y)] = color;
|
setPixelColorXY(x, y, color);
|
||||||
else setPixelColorXY(x, y, color);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// by stepko, taken from https://editor.soulmatelights.com/gallery/573-blobs
|
// by stepko, taken from https://editor.soulmatelights.com/gallery/573-blobs
|
||||||
void Segment::fill_circle(CRGB* leds, uint16_t cx, uint16_t cy, uint8_t radius, CRGB col) {
|
void Segment::fill_circle(uint16_t cx, uint16_t cy, uint8_t radius, CRGB col) {
|
||||||
#ifndef WLED_DISABLE_2D
|
#ifndef WLED_DISABLE_2D
|
||||||
const uint16_t cols = virtualWidth();
|
const uint16_t cols = virtualWidth();
|
||||||
const uint16_t rows = virtualHeight();
|
const uint16_t rows = virtualHeight();
|
||||||
@ -482,50 +472,47 @@ void Segment::fill_circle(CRGB* leds, uint16_t cx, uint16_t cy, uint8_t radius,
|
|||||||
if (x * x + y * y <= radius * radius &&
|
if (x * x + y * y <= radius * radius &&
|
||||||
int16_t(cx)+x>=0 && int16_t(cy)+y>=0 &&
|
int16_t(cx)+x>=0 && int16_t(cy)+y>=0 &&
|
||||||
int16_t(cx)+x<cols && int16_t(cy)+y<rows) {
|
int16_t(cx)+x<cols && int16_t(cy)+y<rows) {
|
||||||
if (leds) leds[XY(cx + x, cy + y)] += col;
|
addPixelColorXY(cx + x, cy + y, col);
|
||||||
else addPixelColorXY(cx + x, cy + y, col);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Segment::fadeToBlackBy(CRGB* leds, uint8_t fadeBy) {
|
void Segment::fadeToBlackByOld(uint8_t fadeBy) {
|
||||||
#ifndef WLED_DISABLE_2D
|
#ifndef WLED_DISABLE_2D
|
||||||
nscale8(leds, 255 - fadeBy);
|
nscale8(255 - fadeBy);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Segment::nscale8(CRGB* leds, uint8_t scale) {
|
void Segment::nscale8(uint8_t scale) {
|
||||||
#ifndef WLED_DISABLE_2D
|
#ifndef WLED_DISABLE_2D
|
||||||
const uint16_t cols = virtualWidth();
|
const uint16_t cols = virtualWidth();
|
||||||
const uint16_t rows = virtualHeight();
|
const uint16_t rows = virtualHeight();
|
||||||
for(uint16_t y = 0; y < rows; y++) for (uint16_t x = 0; x < cols; x++) {
|
for(uint16_t y = 0; y < rows; y++) for (uint16_t x = 0; x < cols; x++)
|
||||||
if (leds) leds[XY(x,y)].nscale8(scale);
|
setPixelColorXY(x, y, CRGB(getPixelColorXY(x, y)).nscale8(scale));
|
||||||
else setPixelColorXY(x, y, CRGB(getPixelColorXY(x, y)).nscale8(scale));
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//line function
|
//line function
|
||||||
void Segment::drawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, CRGB c, CRGB *leds) {
|
// void Segment::drawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, CRGB c, CRGB *leds) {
|
||||||
#ifndef WLED_DISABLE_2D
|
// #ifndef WLED_DISABLE_2D
|
||||||
const uint16_t cols = virtualWidth();
|
// const uint16_t cols = virtualWidth();
|
||||||
const uint16_t rows = virtualHeight();
|
// const uint16_t rows = virtualHeight();
|
||||||
if (x0 >= cols || x1 >= cols || y0 >= rows || y1 >= rows) return;
|
// if (x0 >= cols || x1 >= cols || y0 >= rows || y1 >= rows) return;
|
||||||
const int16_t dx = abs(x1-x0), sx = x0<x1 ? 1 : -1;
|
// const int16_t dx = abs(x1-x0), sx = x0<x1 ? 1 : -1;
|
||||||
const int16_t dy = abs(y1-y0), sy = y0<y1 ? 1 : -1;
|
// const int16_t dy = abs(y1-y0), sy = y0<y1 ? 1 : -1;
|
||||||
int16_t err = (dx>dy ? dx : -dy)/2, e2;
|
// int16_t err = (dx>dy ? dx : -dy)/2, e2;
|
||||||
for (;;) {
|
// for (;;) {
|
||||||
if (leds == nullptr) setPixelColorXY(x0,y0,c);
|
// if (leds == nullptr) setPixelColorXY(x0,y0,c);
|
||||||
else leds[XY(x0,y0)] = c;
|
// else leds[XY(x0,y0)] = c;
|
||||||
if (x0==x1 && y0==y1) break;
|
// if (x0==x1 && y0==y1) break;
|
||||||
e2 = err;
|
// e2 = err;
|
||||||
if (e2 >-dx) { err -= dy; x0 += sx; }
|
// if (e2 >-dx) { err -= dy; x0 += sx; }
|
||||||
if (e2 < dy) { err += dx; y0 += sy; }
|
// if (e2 < dy) { err += dx; y0 += sy; }
|
||||||
}
|
// }
|
||||||
#endif
|
// #endif
|
||||||
}
|
// }
|
||||||
|
|
||||||
#ifndef WLED_DISABLE_2D
|
#ifndef WLED_DISABLE_2D
|
||||||
// font curtesy of https://github.com/idispatch/raster-fonts
|
// font curtesy of https://github.com/idispatch/raster-fonts
|
||||||
@ -6682,7 +6669,7 @@ static const unsigned char console_font_5x8[] PROGMEM = {
|
|||||||
|
|
||||||
// draws a raster font character on canvas
|
// draws a raster font character on canvas
|
||||||
// only supports 5x8 and 6x8 fonts ATM
|
// only supports 5x8 and 6x8 fonts ATM
|
||||||
void Segment::drawCharacter(unsigned char chr, int16_t x, int16_t y, uint8_t w, uint8_t h, CRGB color, CRGB *leds) {
|
void Segment::drawCharacter(unsigned char chr, int16_t x, int16_t y, uint8_t w, uint8_t h, CRGB color) {
|
||||||
#ifndef WLED_DISABLE_2D
|
#ifndef WLED_DISABLE_2D
|
||||||
const uint16_t cols = virtualWidth();
|
const uint16_t cols = virtualWidth();
|
||||||
const uint16_t rows = virtualHeight();
|
const uint16_t rows = virtualHeight();
|
||||||
@ -6700,8 +6687,7 @@ void Segment::drawCharacter(unsigned char chr, int16_t x, int16_t y, uint8_t w,
|
|||||||
for (uint8_t j = 0; j<w; j++) { // character width
|
for (uint8_t j = 0; j<w; j++) { // character width
|
||||||
int16_t x0 = x + (w-1) - j;
|
int16_t x0 = x + (w-1) - j;
|
||||||
if ((x0 >= 0 || x0 < cols) && ((bits>>(j+(8-w))) & 0x01)) { // bit set & drawing on-screen
|
if ((x0 >= 0 || x0 < cols) && ((bits>>(j+(8-w))) & 0x01)) { // bit set & drawing on-screen
|
||||||
if (leds) leds[XY(x0,y0)] = color;
|
setPixelColorXY(x0, y0, color);
|
||||||
else setPixelColorXY(x0, y0, color);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6709,7 +6695,7 @@ void Segment::drawCharacter(unsigned char chr, int16_t x, int16_t y, uint8_t w,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define WU_WEIGHT(a,b) ((uint8_t) (((a)*(b)+(a)+(b))>>8))
|
#define WU_WEIGHT(a,b) ((uint8_t) (((a)*(b)+(a)+(b))>>8))
|
||||||
void Segment::wu_pixel(CRGB *leds, uint32_t x, uint32_t y, CRGB c) { //awesome wu_pixel procedure by reddit u/sutaburosu
|
void Segment::wu_pixel(uint32_t x, uint32_t y, CRGB c) { //awesome wu_pixel procedure by reddit u/sutaburosu
|
||||||
#ifndef WLED_DISABLE_2D
|
#ifndef WLED_DISABLE_2D
|
||||||
// extract the fractional parts and derive their inverses
|
// extract the fractional parts and derive their inverses
|
||||||
uint8_t xx = x & 0xff, yy = y & 0xff, ix = 255 - xx, iy = 255 - yy;
|
uint8_t xx = x & 0xff, yy = y & 0xff, ix = 255 - xx, iy = 255 - yy;
|
||||||
@ -6720,22 +6706,13 @@ void Segment::wu_pixel(CRGB *leds, uint32_t x, uint32_t y, CRGB c) { //awes
|
|||||||
for (uint8_t i = 0; i < 4; i++) {
|
for (uint8_t i = 0; i < 4; i++) {
|
||||||
uint16_t xx = (x >> 8) + (i & 1);
|
uint16_t xx = (x >> 8) + (i & 1);
|
||||||
uint16_t yy = (y >> 8) + ((i >> 1) & 1);
|
uint16_t yy = (y >> 8) + ((i >> 1) & 1);
|
||||||
uint16_t xy = XY(xx, yy);
|
|
||||||
CRGB color;
|
CRGB color;
|
||||||
if (leds) {
|
|
||||||
color.r = qadd8(leds[xy].r, c.r * wu[i] >> 8);
|
|
||||||
color.g = qadd8(leds[xy].g, c.g * wu[i] >> 8);
|
|
||||||
color.b = qadd8(leds[xy].b, c.b * wu[i] >> 8);
|
|
||||||
leds[xy] = color;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
CRGB oColor = getPixelColorXY(xx, yy);
|
CRGB oColor = getPixelColorXY(xx, yy);
|
||||||
color.r = qadd8(oColor.r, c.r * wu[i] >> 8);
|
color.r = qadd8(oColor.r, c.r * wu[i] >> 8);
|
||||||
color.g = qadd8(oColor.g, c.g * wu[i] >> 8);
|
color.g = qadd8(oColor.g, c.g * wu[i] >> 8);
|
||||||
color.b = qadd8(oColor.b, c.b * wu[i] >> 8);
|
color.b = qadd8(oColor.b, c.b * wu[i] >> 8);
|
||||||
setPixelColorXY(xx, yy, color);
|
setPixelColorXY(xx, yy, color);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#undef WU_WEIGHT
|
#undef WU_WEIGHT
|
||||||
|
Loading…
Reference in New Issue
Block a user