Skip to content

Commit

Permalink
Fixed tricolor chase modes
Browse files Browse the repository at this point in the history
Added a new palette
  • Loading branch information
Aircoookie committed Oct 25, 2018
1 parent 9577e49 commit 32cf149
Show file tree
Hide file tree
Showing 9 changed files with 89 additions and 30 deletions.
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![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!

Expand Down
45 changes: 36 additions & 9 deletions wled00/WS2812FX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1129,12 +1129,6 @@ uint16_t WS2812FX::chase(uint32_t color1, uint32_t color2, uint32_t color3, uint
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.
Expand All @@ -1143,6 +1137,7 @@ uint16_t WS2812FX::mode_chase_color(void) {
return chase(SEGMENT.colors[1], SEGMENT.colors[0], SEGMENT.colors[0], 1);
}


/*
* Primary running followed by random color.
*/
Expand Down Expand Up @@ -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
*/
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]);
}


Expand Down Expand Up @@ -1825,24 +1848,28 @@ uint16_t WS2812FX::mode_tricolor_wipe(void)
uint16_t WS2812FX::mode_tricolor_fade(void)
{
uint32_t color1 = 0, color2 = 0;
byte stage = 0;

if(SEGMENT_RUNTIME.counter_mode_step < 256) {
color1 = SEGMENT.colors[0];
color2 = SEGMENT.colors[1];
stage = 0;
} else if(SEGMENT_RUNTIME.counter_mode_step < 512) {
color1 = SEGMENT.colors[1];
color2 = SEGMENT.colors[2];
stage = 1;
} else {
color1 = SEGMENT.colors[2];
color2 = SEGMENT.colors[0];
stage = 2;
}

byte stp = SEGMENT_RUNTIME.counter_mode_step % 256;
uint32_t color = 0;
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);
} else if (color2 == SEGMENT.colors[2]) {
} else if (stage == 1) {
color = color_blend(color1, color_from_palette(i, true, PALETTE_SOLID_WRAP, 2), stp);
} else {
color = color_blend(color1, color2, stp);
Expand Down
6 changes: 4 additions & 2 deletions wled00/data/index.htm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head><meta charset="utf-8"><meta name="theme-color" content="#fff">
<link rel='shortcut icon' type='image/x-icon' href='/favicon.ico'/>
<title>WLED 0.8.0</title>
<title>WLED 0.8.1</title>
<script>
var d=document;
var w=window.getComputedStyle(d.querySelector("html"));
Expand Down Expand Up @@ -172,7 +172,7 @@
case 3: gId("path1").style.fill = aC; gId("path2").style.fill = aC;
}
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;
fmr.style.fill=(Cf.TX.selectedIndex<1)?aC:dC;
}
Expand Down Expand Up @@ -716,6 +716,8 @@
<option value="42">Yelmag</option>
<option value="43">Yelblu</option>
<option value="44">Orange & Teal</option>
<option value="43">Tiamat</option>
<option value="44">April Night</option>
</select>
</div>
<div id="slX" class="sl">
Expand Down
4 changes: 3 additions & 1 deletion wled00/data/index_mobile.htm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta name="theme-color" content="#333333">
<meta content="yes" name="apple-mobile-web-app-capable">
<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>
*{transition-duration: 0.5s;}
body {
Expand Down Expand Up @@ -480,6 +480,8 @@
<li onclick="P(42)">Yelmag</li>
<li onclick="P(43)">Yelblu</li>
<li onclick="P(44)">Orange & Teal</li>
<li onclick="P(45)">Tiamat</li>
<li onclick="P(46)">April Night</li>
&nbsp;
<li><a href="#">Go to top</a></li></div>
<iframe id="stf" onload="feedback();" style="display:none;"></iframe>
Expand Down
Binary file modified wled00/data/settings_sec.htm
Binary file not shown.
6 changes: 3 additions & 3 deletions wled00/htmls00.h

Large diffs are not rendered by default.

25 changes: 23 additions & 2 deletions wled00/palettes.h
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,27 @@ DEFINE_GRADIENT_PALETTE( Tiamat_gp ) {
240, 193,213,253, //gc from 203,239,253
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.
// This will let us programmatically choose one based on
Expand Down Expand Up @@ -560,8 +580,9 @@ const TProgmemRGBGradientPalettePtr gGradientPalettes[] = {
BlacK_Red_Magenta_Yellow_gp, //42-29 Yelmag
Blue_Cyan_Yellow_gp, //43-30 Yelblu
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:
Expand Down
27 changes: 18 additions & 9 deletions wled00/wled00.ino
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,24 @@
* @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
#include <Arduino.h>
Expand Down Expand Up @@ -45,7 +58,7 @@


//version code in format yymmddb (b = daily build)
#define VERSION 1810241
#define VERSION 1810251
char versionString[] = "0.8.1";


Expand All @@ -54,10 +67,6 @@ char apPass[65] = "wled1234";
char otaPass[33] = "wledota";


//to toggle usb serial debug (un)comment following line(s)
//#define DEBUG


//spiffs FS only useful for debug (only ESP8266)
//#define USEFS

Expand Down
4 changes: 1 addition & 3 deletions wled00/wled05_init.ino
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ void initStrip()
if (bootPreset>0) applyPreset(bootPreset, turnOnAtBoot, true, true);
colorUpdated(0);
if(digitalRead(buttonPin) == LOW) buttonEnabled = false; //disable button if it is "pressed" unintentionally

}

void initAP(){
Expand Down Expand Up @@ -255,6 +256,3 @@ bool checkClientIsMobile(String useragent)
if (useragent.indexOf("iPod") >= 0) return true;
return false;
}



0 comments on commit 32cf149

Please sign in to comment.