Skip to content

Commit 5eadbe7

Browse files
committed
FX update
- Meteor: trail & 0.13 behaviour - Meteor Smooth: train & 0.13 behaviour - Scrolling Text: rotation
1 parent ea7e0c6 commit 5eadbe7

File tree

5 files changed

+35
-31
lines changed

5 files changed

+35
-31
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#### Build 2309240
44
- Release of WLED beta version 0.14.0-b6 "Hoshi"
5-
- Effect bugfixes and improvements
5+
- Effect bugfixes and improvements (Meteor, Meteor Smooth, Scrolling Text)
66
- audioreactive: bugfixes for ES8388 and ES7243 init; minor improvements for analog inputs
77

88
#### Build 2309100

wled00/FX.cpp

+23-21
Original file line numberDiff line numberDiff line change
@@ -2260,17 +2260,18 @@ uint16_t mode_meteor() {
22602260

22612261
byte* trail = SEGENV.data;
22622262

2263-
byte meteorSize= 1+ SEGLEN / 10;
2263+
const unsigned meteorSize= 1 + SEGLEN / 20; // 5%
22642264
uint16_t counter = strip.now * ((SEGMENT.speed >> 2) +8);
22652265
uint16_t in = counter * SEGLEN >> 16;
22662266

2267+
const int max = SEGMENT.palette==5 || !SEGMENT.check1 ? 240 : 255;
22672268
// fade all leds to colors[1] in LEDs one step
22682269
for (int i = 0; i < SEGLEN; i++) {
2269-
if (random8() <= 255 - SEGMENT.intensity)
2270-
{
2271-
byte meteorTrailDecay = 128 + random8(127);
2270+
if (random8() <= 255 - SEGMENT.intensity) {
2271+
byte meteorTrailDecay = 162 + random8(92);
22722272
trail[i] = scale8(trail[i], meteorTrailDecay);
2273-
SEGMENT.setPixelColor(i, color_blend(SEGCOLOR(1), SEGMENT.color_from_palette(i, true, false, 0), trail[i]));
2273+
uint32_t col = SEGMENT.check1 ? SEGMENT.color_from_palette(i, true, false, 0, trail[i]) : SEGMENT.color_from_palette(trail[i], false, true, 255);
2274+
SEGMENT.setPixelColor(i, col);
22742275
}
22752276
}
22762277

@@ -2280,13 +2281,14 @@ uint16_t mode_meteor() {
22802281
if (index >= SEGLEN) {
22812282
index -= SEGLEN;
22822283
}
2283-
trail[index] = 240;
2284-
SEGMENT.setPixelColor(index, SEGMENT.color_from_palette(index, true, false, 0));
2284+
trail[index] = max;
2285+
uint32_t col = SEGMENT.check1 ? SEGMENT.color_from_palette(index, true, false, 0, trail[index]) : SEGMENT.color_from_palette(trail[index], false, true, 255);
2286+
SEGMENT.setPixelColor(index, col);
22852287
}
22862288

22872289
return FRAMETIME;
22882290
}
2289-
static const char _data_FX_MODE_METEOR[] PROGMEM = "Meteor@!,Trail length;!,!;!;1";
2291+
static const char _data_FX_MODE_METEOR[] PROGMEM = "Meteor@!,Trail,,,,Gradient;;!;1";
22902292

22912293

22922294
// smooth meteor effect
@@ -2298,18 +2300,17 @@ uint16_t mode_meteor_smooth() {
22982300

22992301
byte* trail = SEGENV.data;
23002302

2301-
byte meteorSize= 1+ SEGLEN / 10;
2303+
const unsigned meteorSize= 1+ SEGLEN / 20; // 5%
23022304
uint16_t in = map((SEGENV.step >> 6 & 0xFF), 0, 255, 0, SEGLEN -1);
23032305

2306+
const int max = SEGMENT.palette==5 || !SEGMENT.check1 ? 240 : 255;
23042307
// fade all leds to colors[1] in LEDs one step
23052308
for (int i = 0; i < SEGLEN; i++) {
2306-
if (trail[i] != 0 && random8() <= 255 - SEGMENT.intensity)
2307-
{
2308-
int change = 3 - random8(12); //change each time between -8 and +3
2309-
trail[i] += change;
2310-
if (trail[i] > 245) trail[i] = 0;
2311-
if (trail[i] > 240) trail[i] = 240;
2312-
SEGMENT.setPixelColor(i, color_blend(SEGCOLOR(1), SEGMENT.color_from_palette(i, true, false, 0), trail[i]));
2309+
if (/*trail[i] != 0 &&*/ random8() <= 255 - SEGMENT.intensity) {
2310+
int change = trail[i] + 4 - random8(24); //change each time between -20 and +4
2311+
trail[i] = constrain(change, 0, max);
2312+
uint32_t col = SEGMENT.check1 ? SEGMENT.color_from_palette(i, true, false, 0, trail[i]) : SEGMENT.color_from_palette(trail[i], false, true, 255);
2313+
SEGMENT.setPixelColor(i, col);
23132314
}
23142315
}
23152316

@@ -2319,14 +2320,15 @@ uint16_t mode_meteor_smooth() {
23192320
if (index >= SEGLEN) {
23202321
index -= SEGLEN;
23212322
}
2322-
trail[index] = 240;
2323-
SEGMENT.setPixelColor(index, SEGMENT.color_from_palette(index, true, false, 0));
2323+
trail[index] = max;
2324+
uint32_t col = SEGMENT.check1 ? SEGMENT.color_from_palette(index, true, false, 0, trail[index]) : SEGMENT.color_from_palette(trail[index], false, true, 255);
2325+
SEGMENT.setPixelColor(index, col);
23242326
}
23252327

23262328
SEGENV.step += SEGMENT.speed +1;
23272329
return FRAMETIME;
23282330
}
2329-
static const char _data_FX_MODE_METEOR_SMOOTH[] PROGMEM = "Meteor Smooth@!,Trail length;!,!;!;1";
2331+
static const char _data_FX_MODE_METEOR_SMOOTH[] PROGMEM = "Meteor Smooth@!,Trail,,,,Gradient;;!;1";
23302332

23312333

23322334
//Railway Crossing / Christmas Fairy lights
@@ -5984,12 +5986,12 @@ uint16_t mode_2Dscrollingtext(void) {
59845986
col1 = SEGCOLOR(0);
59855987
col2 = SEGCOLOR(2);
59865988
}
5987-
SEGMENT.drawCharacter(text[i], xoffset, yoffset, letterWidth, letterHeight, col1, col2, (SEGMENT.custom3+1)>>3);
5989+
SEGMENT.drawCharacter(text[i], xoffset, yoffset, letterWidth, letterHeight, col1, col2, map(SEGMENT.custom3, 0, 31, -2, 2));
59885990
}
59895991

59905992
return FRAMETIME;
59915993
}
5992-
static const char _data_FX_MODE_2DSCROLLTEXT[] PROGMEM = "Scrolling Text@!,Y Offset,Trail,Font size,Rotate,Gradient,Overlay,Reverse;!,!,Gradient;!;2;ix=128,c1=0,c3=0,rev=0,mi=0,rY=0,mY=0";
5994+
static const char _data_FX_MODE_2DSCROLLTEXT[] PROGMEM = "Scrolling Text@!,Y Offset,Trail,Font size,Rotate,Gradient,Overlay,Reverse;!,!,Gradient;!;2;ix=128,c1=0,rev=0,mi=0,rY=0,mY=0";
59935995

59945996

59955997
////////////////////////////

wled00/FX.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -629,9 +629,9 @@ typedef struct Segment {
629629
void fill_circle(uint16_t cx, uint16_t cy, uint8_t radius, CRGB c);
630630
void drawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint32_t c);
631631
void drawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, CRGB c) { drawLine(x0, y0, x1, y1, RGBW32(c.r,c.g,c.b,0)); } // automatic inline
632-
void drawCharacter(unsigned char chr, int16_t x, int16_t y, uint8_t w, uint8_t h, uint32_t color, uint32_t col2 = 0, uint8_t rotate = 0);
632+
void drawCharacter(unsigned char chr, int16_t x, int16_t y, uint8_t w, uint8_t h, uint32_t color, uint32_t col2 = 0, int8_t rotate = 0);
633633
void drawCharacter(unsigned char chr, int16_t x, int16_t y, uint8_t w, uint8_t h, CRGB c) { drawCharacter(chr, x, y, w, h, RGBW32(c.r,c.g,c.b,0)); } // automatic inline
634-
void drawCharacter(unsigned char chr, int16_t x, int16_t y, uint8_t w, uint8_t h, CRGB c, CRGB c2, uint8_t rotate = 0) { drawCharacter(chr, x, y, w, h, RGBW32(c.r,c.g,c.b,0), RGBW32(c2.r,c2.g,c2.b,0), rotate); } // automatic inline
634+
void drawCharacter(unsigned char chr, int16_t x, int16_t y, uint8_t w, uint8_t h, CRGB c, CRGB c2, int8_t rotate = 0) { drawCharacter(chr, x, y, w, h, RGBW32(c.r,c.g,c.b,0), RGBW32(c2.r,c2.g,c2.b,0), rotate); } // automatic inline
635635
void wu_pixel(uint32_t x, uint32_t y, CRGB c);
636636
void blur1d(fract8 blur_amount); // blur all rows in 1 dimension
637637
void blur2d(fract8 blur_amount) { blur(blur_amount); }
@@ -661,8 +661,9 @@ typedef struct Segment {
661661
void fill_circle(uint16_t cx, uint16_t cy, uint8_t radius, CRGB c) {}
662662
void drawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint32_t c) {}
663663
void drawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, CRGB c) {}
664-
void drawCharacter(unsigned char chr, int16_t x, int16_t y, uint8_t w, uint8_t h, uint32_t color) {}
664+
void drawCharacter(unsigned char chr, int16_t x, int16_t y, uint8_t w, uint8_t h, uint32_t color, uint32_t = 0, int8_t = 0) {}
665665
void drawCharacter(unsigned char chr, int16_t x, int16_t y, uint8_t w, uint8_t h, CRGB color) {}
666+
void drawCharacter(unsigned char chr, int16_t x, int16_t y, uint8_t w, uint8_t h, CRGB c, CRGB c2, int8_t rotate = 0) {}
666667
void wu_pixel(uint32_t x, uint32_t y, CRGB c) {}
667668
#endif
668669
} segment;

wled00/FX_2Dfcn.cpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ void Segment::drawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint3
571571

572572
// draws a raster font character on canvas
573573
// only supports: 4x6=24, 5x8=40, 5x12=60, 6x8=48 and 7x9=63 fonts ATM
574-
void Segment::drawCharacter(unsigned char chr, int16_t x, int16_t y, uint8_t w, uint8_t h, uint32_t color, uint32_t col2, uint8_t rotate) {
574+
void Segment::drawCharacter(unsigned char chr, int16_t x, int16_t y, uint8_t w, uint8_t h, uint32_t color, uint32_t col2, int8_t rotate) {
575575
if (!isActive()) return; // not active
576576
if (chr < 32 || chr > 126) return; // only ASCII 32-126 supported
577577
chr -= 32; // align with font table entries
@@ -597,10 +597,11 @@ void Segment::drawCharacter(unsigned char chr, int16_t x, int16_t y, uint8_t w,
597597
for (int j = 0; j<w; j++) { // character width
598598
int x0, y0;
599599
switch (rotate) {
600-
case 3: x0 = x + (h-1) - i; y0 = y + (w-1) - j; break;
601-
case 2: x0 = x + j; y0 = y + (h-1) - i; break;
602-
case 1: x0 = x + i; y0 = y + j; break;
603-
default: x0 = x + (w-1) - j; y0 = y + i; break;
600+
case -1: x0 = x + (h-1) - i; y0 = y + (w-1) - j; break; // -90 deg
601+
case -2:
602+
case 2: x0 = x + j; y0 = y + (h-1) - i; break; // 180 deg
603+
case 1: x0 = x + i; y0 = y + j; break; // +90 deg
604+
default: x0 = x + (w-1) - j; y0 = y + i; break; // no rotation
604605
}
605606
if (x0 < 0 || x0 >= cols || y0 < 0 || y0 >= rows) continue; // drawing off-screen
606607
if (((bits>>(j+(8-w))) & 0x01)) { // bit set

wled00/wled.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99

1010
// version code in format yymmddb (b = daily build)
11-
#define VERSION 2309240
11+
#define VERSION 2309241
1212

1313
//uncomment this if you have a "my_config.h" file you'd like to use
1414
//#define WLED_USE_MY_CONFIG

0 commit comments

Comments
 (0)