kopia lustrzana https://github.com/Aircoookie/WLED
				
				
				
			Improved rainbow effects
							rodzic
							
								
									273c6467c8
								
							
						
					
					
						commit
						f30ffb4413
					
				| 
						 | 
					@ -7,7 +7,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Welcome to my project WLED!
 | 
					## Welcome to my project WLED!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
A fast and feature-rich implementation of an ESP8266/ESP32 webserver to control NeoPixel (WS2812B) LEDs!
 | 
					A fast and feature-rich implementation of an ESP8266/ESP32 webserver to control NeoPixel (WS2812B, WS2811, SK6812, APA102) LEDs!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Features:
 | 
					### Features:
 | 
				
			||||||
- WS2812FX library integrated for 80 special effects   
 | 
					- WS2812FX library integrated for 80 special effects   
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -43,6 +43,7 @@ uint16_t WS2812FX::mode_static(void) {
 | 
				
			||||||
 * Blink/strobe function
 | 
					 * Blink/strobe function
 | 
				
			||||||
 * Alternate between color1 and color2
 | 
					 * Alternate between color1 and color2
 | 
				
			||||||
 * if(strobe == true) then create a strobe effect
 | 
					 * if(strobe == true) then create a strobe effect
 | 
				
			||||||
 | 
					 * NOTE: Maybe re-rework without timer
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
uint16_t WS2812FX::blink(uint32_t color1, uint32_t color2, bool strobe, bool do_palette) {
 | 
					uint16_t WS2812FX::blink(uint32_t color1, uint32_t color2, bool strobe, bool do_palette) {
 | 
				
			||||||
  uint16_t stateTime = SEGENV.aux1;
 | 
					  uint16_t stateTime = SEGENV.aux1;
 | 
				
			||||||
| 
						 | 
					@ -232,16 +233,27 @@ uint16_t WS2812FX::mode_random_color(void) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Lights every LED in a random color. Changes all LED at the same time
 | 
					 * Lights every LED in a random color. Changes all LED at the same time
 | 
				
			||||||
// * to new random colors. NOTE: Problematic for revamp. Consider using data array?
 | 
					// * to new random colors.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
uint16_t WS2812FX::mode_dynamic(void) {
 | 
					uint16_t WS2812FX::mode_dynamic(void) {
 | 
				
			||||||
  if(SEGMENT.intensity > 127 || SEGENV.call == 0) {
 | 
					  if(SEGENV.call == 0) {
 | 
				
			||||||
    for(uint16_t i=SEGMENT.start; i < SEGMENT.stop; i++) {
 | 
					    for(uint16_t i=SEGMENT.start; i < SEGMENT.stop; i++) _locked[i] = random8();
 | 
				
			||||||
      setPixelColor(i, color_wheel(random8()));
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  setPixelColor(SEGMENT.start + random16(SEGLEN), color_wheel(random8()));
 | 
					
 | 
				
			||||||
  return 50 + (15 * (uint32_t)(255 - SEGMENT.speed));
 | 
					  uint32_t cycleTime = 50 + (255 - SEGMENT.speed)*15;
 | 
				
			||||||
 | 
					  uint32_t it = now / cycleTime;
 | 
				
			||||||
 | 
					  if (it != SEGENV.step) //new color
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    for(uint16_t i=SEGMENT.start; i < SEGMENT.stop; i++) {
 | 
				
			||||||
 | 
					      if (random8() <= SEGMENT.intensity) _locked[i] = random8();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    SEGENV.step = it;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  for(uint16_t i=SEGMENT.start; i < SEGMENT.stop; i++) {
 | 
				
			||||||
 | 
					    setPixelColor(i, color_wheel(_locked[i]));
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  return FRAMETIME;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -309,7 +321,7 @@ uint16_t WS2812FX::scan(bool dual)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//TODO add intensity (more than 1 pixel lit)
 | 
					//NOTE: add intensity (more than 1 pixel lit)
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Runs a single pixel back and forth.
 | 
					 * Runs a single pixel back and forth.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
| 
						 | 
					@ -330,11 +342,12 @@ uint16_t WS2812FX::mode_dual_scan(void) {
 | 
				
			||||||
 * Cycles all LEDs at once through a rainbow.
 | 
					 * Cycles all LEDs at once through a rainbow.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
uint16_t WS2812FX::mode_rainbow(void) {
 | 
					uint16_t WS2812FX::mode_rainbow(void) {
 | 
				
			||||||
  uint32_t color = color_wheel(SEGENV.step);
 | 
					  uint16_t counter = (now * ((SEGMENT.speed >> 3) +2)) & 0xFFFF;
 | 
				
			||||||
  fill(color);
 | 
					  counter = counter >> 8;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  SEGENV.step = (SEGENV.step + 1) & 0xFF;
 | 
					  fill(color_wheel(counter));
 | 
				
			||||||
  return 1 + (((uint32_t)(255 - SEGMENT.speed)) / 5);
 | 
					
 | 
				
			||||||
 | 
					  return FRAMETIME;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -342,13 +355,16 @@ uint16_t WS2812FX::mode_rainbow(void) {
 | 
				
			||||||
 * Cycles a rainbow over the entire string of LEDs.
 | 
					 * Cycles a rainbow over the entire string of LEDs.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
uint16_t WS2812FX::mode_rainbow_cycle(void) {
 | 
					uint16_t WS2812FX::mode_rainbow_cycle(void) {
 | 
				
			||||||
 | 
					  uint16_t counter = (now * ((SEGMENT.speed >> 3) +2)) & 0xFFFF;
 | 
				
			||||||
 | 
					  counter = counter >> 8;
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
  for(uint16_t i=0; i < SEGLEN; i++) {
 | 
					  for(uint16_t i=0; i < SEGLEN; i++) {
 | 
				
			||||||
    uint32_t color = color_wheel(((i * 256 / ((uint16_t)(SEGLEN*(float)(SEGMENT.intensity/128.0))+1)) + SEGENV.step) & 0xFF);
 | 
					    //intensity/29 = 0 (1/16) 1 (1/8) 2 (1/4) 3 (1/2) 4 (1) 5 (2) 6 (4) 7 (8) 8 (16)
 | 
				
			||||||
    setPixelColor(SEGMENT.start + i, color);
 | 
					    uint8_t index = (i * (16 << (SEGMENT.intensity /29)) / SEGLEN) + counter;
 | 
				
			||||||
 | 
					    setPixelColor(SEGMENT.start + i, color_wheel(index));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  SEGENV.step = (SEGENV.step + 1) & 0xFF;
 | 
					  return FRAMETIME;
 | 
				
			||||||
  return 1 + (((uint32_t)(255 - SEGMENT.speed)) / 5);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -85,7 +85,7 @@ bool WS2812FX::modeUsesLock(uint8_t m)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if (m == FX_MODE_FIRE_2012 || m == FX_MODE_COLORTWINKLE  ||
 | 
					  if (m == FX_MODE_FIRE_2012 || m == FX_MODE_COLORTWINKLE  ||
 | 
				
			||||||
      m == FX_MODE_METEOR    || m == FX_MODE_METEOR_SMOOTH || 
 | 
					      m == FX_MODE_METEOR    || m == FX_MODE_METEOR_SMOOTH || 
 | 
				
			||||||
      m == FX_MODE_RIPPLE) return true;
 | 
					      m == FX_MODE_RIPPLE    || m == FX_MODE_DYNAMIC ) return true;
 | 
				
			||||||
  return false;
 | 
					  return false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -98,7 +98,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//version code in format yymmddb (b = daily build)
 | 
					//version code in format yymmddb (b = daily build)
 | 
				
			||||||
#define VERSION 1910033
 | 
					#define VERSION 1910042
 | 
				
			||||||
char versionString[] = "0.8.5";
 | 
					char versionString[] = "0.8.5";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -160,7 +160,7 @@ byte briMultiplier =  100;                    //% of brightness to set (to limit
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//User Interface CONFIG
 | 
					//User Interface CONFIG
 | 
				
			||||||
char serverDescription[33] = "WLED Light";    //Name of module
 | 
					char serverDescription[33] = "WLED";          //Name of module
 | 
				
			||||||
byte currentTheme = 7;                        //UI theme index for settings and classic UI
 | 
					byte currentTheme = 7;                        //UI theme index for settings and classic UI
 | 
				
			||||||
byte uiConfiguration = 0;                     //0: automatic (depends on user-agent) 1: classic UI 2: mobile UI
 | 
					byte uiConfiguration = 0;                     //0: automatic (depends on user-agent) 1: classic UI 2: mobile UI
 | 
				
			||||||
bool useHSB = true;                           //classic UI: use HSB sliders instead of RGB by default
 | 
					bool useHSB = true;                           //classic UI: use HSB sliders instead of RGB by default
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Ładowanie…
	
		Reference in New Issue