Fixed tricolor chase modes

Added a new palette
This commit is contained in:
cschwinne 2018-10-25 20:55:29 +02:00
parent 9577e49231
commit 32cf1495d3
9 changed files with 89 additions and 30 deletions

View File

@ -1,6 +1,6 @@
![WLED logo](https://raw.githubusercontent.com/Aircoookie/WLED/development/wled_logo.png) ![WLED logo](https://raw.githubusercontent.com/Aircoookie/WLED/development/wled_logo.png)
## Welcome to my project WLED! (v0.8.0) ## Welcome to my project WLED! (v0.8.1-dev)
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) LEDs!

View File

@ -1129,12 +1129,6 @@ uint16_t WS2812FX::chase(uint32_t color1, uint32_t color2, uint32_t color3, uint
return SPEED_FORMULA_L; return SPEED_FORMULA_L;
} }
/*
* Tricolor chase mode
*/
uint16_t WS2812FX::mode_tricolor_chase(void) {
return chase(SEGMENT.colors[1], SEGMENT.colors[0], SEGMENT.colors[2], 1);
}
/* /*
* Bicolor chase, more primary color. * Bicolor chase, more primary color.
@ -1143,6 +1137,7 @@ uint16_t WS2812FX::mode_chase_color(void) {
return chase(SEGMENT.colors[1], SEGMENT.colors[0], SEGMENT.colors[0], 1); return chase(SEGMENT.colors[1], SEGMENT.colors[0], SEGMENT.colors[0], 1);
} }
/* /*
* Primary running followed by random color. * Primary running followed by random color.
*/ */
@ -1745,11 +1740,39 @@ uint16_t WS2812FX::mode_dual_color_wipe_out_in(void) {
} }
/*
* Tricolor chase function
*/
uint16_t WS2812FX::tricolor_chase(uint32_t color1, uint32_t color2, uint32_t color3) {
uint16_t index = SEGMENT_RUNTIME.counter_mode_step % 6;
for(uint16_t i=0; i < SEGMENT_LENGTH; i++, index++) {
if(index > 5) index = 0;
uint32_t color = color1;
if(index > 3) color = color_from_palette(i, true, PALETTE_SOLID_WRAP, 2);
else if(index > 1) color = color2;
setPixelColor(SEGMENT.stop - i, color);
}
SEGMENT_RUNTIME.counter_mode_step++;
return 35 + ((350 * (uint32_t)(255 - SEGMENT.speed)) / 255);
}
/* /*
* Alternating white/red/black pixels running. PLACEHOLDER * Alternating white/red/black pixels running. PLACEHOLDER
*/ */
uint16_t WS2812FX::mode_circus_combustus(void) { uint16_t WS2812FX::mode_circus_combustus(void) {
return chase(RED, WHITE, BLACK, 0); return tricolor_chase(RED, WHITE, BLACK);
}
/*
* Tricolor chase mode
*/
uint16_t WS2812FX::mode_tricolor_chase(void) {
return tricolor_chase(SEGMENT.colors[1], SEGMENT.colors[0], SEGMENT.colors[2]);
} }
@ -1825,24 +1848,28 @@ uint16_t WS2812FX::mode_tricolor_wipe(void)
uint16_t WS2812FX::mode_tricolor_fade(void) uint16_t WS2812FX::mode_tricolor_fade(void)
{ {
uint32_t color1 = 0, color2 = 0; uint32_t color1 = 0, color2 = 0;
byte stage = 0;
if(SEGMENT_RUNTIME.counter_mode_step < 256) { if(SEGMENT_RUNTIME.counter_mode_step < 256) {
color1 = SEGMENT.colors[0]; color1 = SEGMENT.colors[0];
color2 = SEGMENT.colors[1]; color2 = SEGMENT.colors[1];
stage = 0;
} else if(SEGMENT_RUNTIME.counter_mode_step < 512) { } else if(SEGMENT_RUNTIME.counter_mode_step < 512) {
color1 = SEGMENT.colors[1]; color1 = SEGMENT.colors[1];
color2 = SEGMENT.colors[2]; color2 = SEGMENT.colors[2];
stage = 1;
} else { } else {
color1 = SEGMENT.colors[2]; color1 = SEGMENT.colors[2];
color2 = SEGMENT.colors[0]; color2 = SEGMENT.colors[0];
stage = 2;
} }
byte stp = SEGMENT_RUNTIME.counter_mode_step % 256; byte stp = SEGMENT_RUNTIME.counter_mode_step % 256;
uint32_t color = 0; uint32_t color = 0;
for(uint16_t i=SEGMENT.start; i <= SEGMENT.stop; i++) { for(uint16_t i=SEGMENT.start; i <= SEGMENT.stop; i++) {
if (color1 == SEGMENT.colors[2]) { if (stage == 2) {
color = color_blend(color_from_palette(i, true, PALETTE_SOLID_WRAP, 2), color2, stp); color = color_blend(color_from_palette(i, true, PALETTE_SOLID_WRAP, 2), color2, stp);
} else if (color2 == SEGMENT.colors[2]) { } else if (stage == 1) {
color = color_blend(color1, color_from_palette(i, true, PALETTE_SOLID_WRAP, 2), stp); color = color_blend(color1, color_from_palette(i, true, PALETTE_SOLID_WRAP, 2), stp);
} else { } else {
color = color_blend(color1, color2, stp); color = color_blend(color1, color2, stp);

View File

@ -2,7 +2,7 @@
<html> <html>
<head><meta charset="utf-8"><meta name="theme-color" content="#fff"> <head><meta charset="utf-8"><meta name="theme-color" content="#fff">
<link rel='shortcut icon' type='image/x-icon' href='/favicon.ico'/> <link rel='shortcut icon' type='image/x-icon' href='/favicon.ico'/>
<title>WLED 0.8.0</title> <title>WLED 0.8.1</title>
<script> <script>
var d=document; var d=document;
var w=window.getComputedStyle(d.querySelector("html")); var w=window.getComputedStyle(d.querySelector("html"));
@ -172,7 +172,7 @@
case 3: gId("path1").style.fill = aC; gId("path2").style.fill = aC; case 3: gId("path1").style.fill = aC; gId("path2").style.fill = aC;
} }
tgb.style.fill=(Cf.SA.value>0)?aC:dC; tgb.style.fill=(Cf.SA.value>0)?aC:dC;
fpX.style.display=(Cf.TX.selectedIndex>64)?"block":"none"; fpX.style.display=(Cf.TX.selectedIndex>0)?"block":"none";
fof.style.fill=(Cf.TX.selectedIndex>64)?aC:dC; fof.style.fill=(Cf.TX.selectedIndex>64)?aC:dC;
fmr.style.fill=(Cf.TX.selectedIndex<1)?aC:dC; fmr.style.fill=(Cf.TX.selectedIndex<1)?aC:dC;
} }
@ -716,6 +716,8 @@
<option value="42">Yelmag</option> <option value="42">Yelmag</option>
<option value="43">Yelblu</option> <option value="43">Yelblu</option>
<option value="44">Orange & Teal</option> <option value="44">Orange & Teal</option>
<option value="43">Tiamat</option>
<option value="44">April Night</option>
</select> </select>
</div> </div>
<div id="slX" class="sl"> <div id="slX" class="sl">

View File

@ -7,7 +7,7 @@
<meta name="theme-color" content="#333333"> <meta name="theme-color" content="#333333">
<meta content="yes" name="apple-mobile-web-app-capable"> <meta content="yes" name="apple-mobile-web-app-capable">
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAGACGAAAAFgAAAIlQTkcNChoKAAAADUlIRFIAAAAQAAAAEAgGAAAAH/P/YQAAAE1JREFUOI1j/P//PwOxgNGeAUMxE9G6cQCKDWAhpADZ2f8PMjBS3QW08QK20KaZC2gfC9hCnqouoNgARgY7zMxAyNlUdQHlXiAlO2MDAD63EVqNHAe0AAAAAElFTkSuQmCC"/> <link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAGACGAAAAFgAAAIlQTkcNChoKAAAADUlIRFIAAAAQAAAAEAgGAAAAH/P/YQAAAE1JREFUOI1j/P//PwOxgNGeAUMxE9G6cQCKDWAhpADZ2f8PMjBS3QW08QK20KaZC2gfC9hCnqouoNgARgY7zMxAyNlUdQHlXiAlO2MDAD63EVqNHAe0AAAAAElFTkSuQmCC"/>
<title>WLED 0.8.0</title> <title>WLED 0.8.1</title>
<style> <style>
*{transition-duration: 0.5s;} *{transition-duration: 0.5s;}
body { body {
@ -480,6 +480,8 @@
<li onclick="P(42)">Yelmag</li> <li onclick="P(42)">Yelmag</li>
<li onclick="P(43)">Yelblu</li> <li onclick="P(43)">Yelblu</li>
<li onclick="P(44)">Orange & Teal</li> <li onclick="P(44)">Orange & Teal</li>
<li onclick="P(45)">Tiamat</li>
<li onclick="P(46)">April Night</li>
&nbsp; &nbsp;
<li><a href="#">Go to top</a></li></div> <li><a href="#">Go to top</a></li></div>
<iframe id="stf" onload="feedback();" style="display:none;"></iframe> <iframe id="stf" onload="feedback();" style="display:none;"></iframe>

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -515,7 +515,27 @@ DEFINE_GRADIENT_PALETTE( Tiamat_gp ) {
240, 193,213,253, //gc from 203,239,253 240, 193,213,253, //gc from 203,239,253
255, 255,249,255}; 255, 255,249,255};
//Custom palette by Aircoookie
DEFINE_GRADIENT_PALETTE( April_Night_gp ) {
0, 1, 5, 45, //deep blue
10, 1, 5, 45,
25, 5,169,175, //light blue
40, 1, 5, 45,
61, 1, 5, 45,
76, 45,175, 31, //green
91, 1, 5, 45,
112, 1, 5, 45,
127, 249,150, 5, //yellow
143, 1, 5, 45,
162, 1, 5, 45,
178, 255,92, 0, //pastel orange
193, 1, 5, 45,
214, 1, 5, 45,
229, 223, 45, 72, //pink
244, 1, 5, 45,
255, 1, 5, 45};
// Single array of defined cpt-city color palettes. // Single array of defined cpt-city color palettes.
// This will let us programmatically choose one based on // This will let us programmatically choose one based on
@ -560,8 +580,9 @@ const TProgmemRGBGradientPalettePtr gGradientPalettes[] = {
BlacK_Red_Magenta_Yellow_gp, //42-29 Yelmag BlacK_Red_Magenta_Yellow_gp, //42-29 Yelmag
Blue_Cyan_Yellow_gp, //43-30 Yelblu Blue_Cyan_Yellow_gp, //43-30 Yelblu
Orange_Teal_gp, //44-31 Orange & Teal Orange_Teal_gp, //44-31 Orange & Teal
Tiamat_gp //45-32 Tiamat Tiamat_gp, //45-32 Tiamat
}; April_Night_gp //46-33 April Night
};
// Count of how many cpt-city gradients are defined: // Count of how many cpt-city gradients are defined:

View File

@ -7,11 +7,24 @@
* @author Christian Schwinne * @author Christian Schwinne
*/ */
//ESP8266-01 got too little storage space to work with all features of WLED. To use it, you must use ESP8266 Arduino Core v2.3.0 and the setting 512K(64K SPIFFS).
//Uncomment the following line to disable some features (currently Mobile UI, welcome page and single digit + cronixie overlays) to compile for ESP8266-01
//#define WLED_FLASH_512K_MODE
//CURRENTLY NOT WORKING
//ESP8266-01 (blue) got too little storage space to work with all features of WLED. To use it, you must use ESP8266 Arduino Core v2.3.0 and the setting 512K(64K SPIFFS).
//ESP8266-01 (black) has 1MB flash and can thus fit the whole program. Use 1M(64K SPIFFS).
//If you want the OTA update function though, you need to make sure the sketch is smaller than 479kB.
//Uncomment the following lines to disable some features to compile for ESP8266-01 (max flash size 438kB):
//#define WLED_DISABLE_ALEXA
//#define WLED_DISABLE_BLYNK
//#define WLED_DISABLE_CRONIXIE
//#define WLED_DISABLE_HUESYNC
//#define WLED_DISABLE_MOBILE_UI
//#define WLED_DISABLE_OTA
//to toggle usb serial debug (un)comment following line(s)
//#define DEBUG
//library inclusions //library inclusions
#include <Arduino.h> #include <Arduino.h>
@ -45,7 +58,7 @@
//version code in format yymmddb (b = daily build) //version code in format yymmddb (b = daily build)
#define VERSION 1810241 #define VERSION 1810251
char versionString[] = "0.8.1"; char versionString[] = "0.8.1";
@ -54,10 +67,6 @@ char apPass[65] = "wled1234";
char otaPass[33] = "wledota"; char otaPass[33] = "wledota";
//to toggle usb serial debug (un)comment following line(s)
//#define DEBUG
//spiffs FS only useful for debug (only ESP8266) //spiffs FS only useful for debug (only ESP8266)
//#define USEFS //#define USEFS

View File

@ -138,6 +138,7 @@ void initStrip()
if (bootPreset>0) applyPreset(bootPreset, turnOnAtBoot, true, true); if (bootPreset>0) applyPreset(bootPreset, turnOnAtBoot, true, true);
colorUpdated(0); colorUpdated(0);
if(digitalRead(buttonPin) == LOW) buttonEnabled = false; //disable button if it is "pressed" unintentionally if(digitalRead(buttonPin) == LOW) buttonEnabled = false; //disable button if it is "pressed" unintentionally
} }
void initAP(){ void initAP(){
@ -255,6 +256,3 @@ bool checkClientIsMobile(String useragent)
if (useragent.indexOf("iPod") >= 0) return true; if (useragent.indexOf("iPod") >= 0) return true;
return false; return false;
} }