Minor tweaks to Chunchun & Plasma FX.
This commit is contained in:
parent
a057e50684
commit
61101987f9
@ -3159,13 +3159,17 @@ uint16_t WS2812FX::mode_tetrix(void) {
|
|||||||
/ adapted from https://github.com/atuline/FastLED-Demos/blob/master/plasma/plasma.ino
|
/ adapted from https://github.com/atuline/FastLED-Demos/blob/master/plasma/plasma.ino
|
||||||
*/
|
*/
|
||||||
uint16_t WS2812FX::mode_plasma(void) {
|
uint16_t WS2812FX::mode_plasma(void) {
|
||||||
uint8_t thisPhase = beatsin8(6+_segment_index%3,-64,64); // Setting phase change for a couple of waves.
|
// initialize phases on start
|
||||||
uint8_t thatPhase = beatsin8(7+_segment_index%3,-64,64);
|
if (SEGENV.call == 0) {
|
||||||
|
SEGENV.aux0 = random8(0,2); // add a bit of randomness
|
||||||
|
}
|
||||||
|
uint8_t thisPhase = beatsin8(6+SEGENV.aux0,-64,64);
|
||||||
|
uint8_t thatPhase = beatsin8(7+SEGENV.aux0,-64,64);
|
||||||
|
|
||||||
for (int i = 0; i < SEGLEN; i++) { // For each of the LED's in the strand, set color & brightness based on a wave as follows:
|
for (int i = 0; i < SEGLEN; i++) { // For each of the LED's in the strand, set color & brightness based on a wave as follows:
|
||||||
uint8_t colorIndex = cubicwave8((i*(1+ 3*(SEGMENT.speed >> 5)))+(thisPhase) & 0xFF)/2 // factor=23 // Create a wave and add a phase change and add another wave with its own phase change.
|
uint8_t colorIndex = cubicwave8((i*(2+ 3*(SEGMENT.speed >> 5))+thisPhase) & 0xFF)/2 // factor=23 // Create a wave and add a phase change and add another wave with its own phase change.
|
||||||
+ cos8((i*(1+ 2*(SEGMENT.speed >> 5)))+(thatPhase) & 0xFF)/2; // factor=15 // Hey, you can even change the frequencies if you wish.
|
+ cos8((i*(1+ 2*(SEGMENT.speed >> 5))+thatPhase) & 0xFF)/2; // factor=15 // Hey, you can even change the frequencies if you wish.
|
||||||
uint8_t thisBright = qsub8(colorIndex, beatsin8(6,0, (255 - SEGMENT.intensity)|0x01 ));
|
uint8_t thisBright = qsub8(colorIndex, beatsin8(7,0, (128 - (SEGMENT.intensity>>1))));
|
||||||
CRGB color = ColorFromPalette(currentPalette, colorIndex, thisBright, LINEARBLEND);
|
CRGB color = ColorFromPalette(currentPalette, colorIndex, thisBright, LINEARBLEND);
|
||||||
setPixelColor(i, color.red, color.green, color.blue);
|
setPixelColor(i, color.red, color.green, color.blue);
|
||||||
}
|
}
|
||||||
@ -3593,15 +3597,15 @@ uint16_t WS2812FX::mode_chunchun(void)
|
|||||||
{
|
{
|
||||||
fill(SEGCOLOR(1));
|
fill(SEGCOLOR(1));
|
||||||
uint16_t counter = now*(6 + (SEGMENT.speed >> 4));
|
uint16_t counter = now*(6 + (SEGMENT.speed >> 4));
|
||||||
uint16_t numBirds = SEGLEN >> 2;
|
uint16_t numBirds = 2 + (SEGLEN >> 3); // 2 + 1/8 of a segment
|
||||||
uint16_t span = SEGMENT.intensity << 8;
|
uint16_t span = (SEGMENT.intensity << 8) / numBirds;
|
||||||
|
|
||||||
for (uint16_t i = 0; i < numBirds; i++)
|
for (uint16_t i = 0; i < numBirds; i++)
|
||||||
{
|
{
|
||||||
counter -= span/numBirds;
|
counter -= span;
|
||||||
uint16_t megumin = sin16(counter) + 0x8000;
|
uint16_t megumin = sin16(counter) + 0x8000;
|
||||||
uint32_t bird = (megumin * SEGLEN) >> 16;
|
uint32_t bird = (megumin * SEGLEN) >> 16;
|
||||||
uint32_t c = color_from_palette((i * 255)/ numBirds, false, true, 0);
|
uint32_t c = color_from_palette((i * 255)/ numBirds, false, false, 0); // no palette wrapping
|
||||||
setPixelColor(bird, c);
|
setPixelColor(bird, c);
|
||||||
}
|
}
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
|
10
wled00/FX.h
10
wled00/FX.h
@ -322,11 +322,11 @@ class WS2812FX {
|
|||||||
|
|
||||||
// segment runtime parameters
|
// segment runtime parameters
|
||||||
typedef struct Segment_runtime { // 28 bytes
|
typedef struct Segment_runtime { // 28 bytes
|
||||||
unsigned long next_time;
|
unsigned long next_time; // millis() of next update
|
||||||
uint32_t step;
|
uint32_t step; // custom "step" var
|
||||||
uint32_t call;
|
uint32_t call; // call counter
|
||||||
uint16_t aux0;
|
uint16_t aux0; // custom var
|
||||||
uint16_t aux1;
|
uint16_t aux1; // custom var
|
||||||
byte* data = nullptr;
|
byte* data = nullptr;
|
||||||
bool allocateData(uint16_t len){
|
bool allocateData(uint16_t len){
|
||||||
if (data && _dataLen == len) return true; //already allocated
|
if (data && _dataLen == len) return true; //already allocated
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// version code in format yymmddb (b = daily build)
|
// version code in format yymmddb (b = daily build)
|
||||||
#define VERSION 2103011
|
#define VERSION 2103012
|
||||||
|
|
||||||
//uncomment this if you have a "my_config.h" file you'd like to use
|
//uncomment this if you have a "my_config.h" file you'd like to use
|
||||||
//#define WLED_USE_MY_CONFIG
|
//#define WLED_USE_MY_CONFIG
|
||||||
|
Loading…
Reference in New Issue
Block a user