Skip to content

Commit

Permalink
Added Sunrise nightlight mode and more UI features
Browse files Browse the repository at this point in the history
-   Added Sunrise nightlight mode
-   Added Chunchun effect
-   Added `LO` (live override) command to HTTP API
-   Added `mode` to `nl` object of JSON state API, deprecating `fade`
-   Added light color scheme support to web UI (click sun next to brightness slider)
-   Added option to hide labels in web UI (click flame icon next to intensity slider)
-   Added hex color input (click palette icon next to palette select) (resolves wled#506)
-   Added support for RGB sliders (need to set in localstorage)
-   Added support for custom background color or image (need to set in localstorage)
-   Added option to hide bottom tab bar in PC mode (need to set in localstorage)
-   Fixed transition lag with multiple segments (fixes wled#985)
-   Changed Nightlight wording (resolves wled#940)
  • Loading branch information
Aircoookie committed Jun 22, 2020
1 parent 60c7ec5 commit 4f7dc5b
Show file tree
Hide file tree
Showing 21 changed files with 3,482 additions and 2,899 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

### Development versions after 0.10.0 release

#### Build 2006220

- Added Sunrise nightlight mode
- Added Chunchun effect
- Added `LO` (live override) command to HTTP API
- Added `mode` to `nl` object of JSON state API, deprecating `fade`
- Added light color scheme support to web UI (click sun next to brightness slider)
- Added option to hide labels in web UI (click flame icon next to intensity slider)
- Added hex color input (click palette icon next to palette select) (resolves #506)
- Added support for RGB sliders (need to set in localstorage)
- Added support for custom background color or image (need to set in localstorage)
- Added option to hide bottom tab bar in PC mode (need to set in localstorage)
- Fixed transition lag with multiple segments (fixes #985)
- Changed Nightlight wording (resolves #940)

#### Build 2006060

- Added five effects by Andrew Tuline (Phased, Phased Noise, Sine, Noise Pal and Twinkleup)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wled",
"version": "0.10.0",
"version": "0.10.1",
"description": "Tools for WLED project",
"main": "tools/cdata.js",
"directories": {
Expand Down
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ extra_configs =
# Please uncomment one of the lines below to select your board(s)
# ------------------------------------------------------------------------------

# Travis CI binaries (comment this out when building for single board)
# Travis CI binaries
default_envs = travis_esp8266, esp01, esp01_1m_ota, travis_esp32

# Release binaries
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<a href="https://github.com/Aircoookie/WLED-App"><img src="https://img.shields.io/badge/app-wled-blue.svg?style=flat-square"></a>
</p>

# 👋 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, WS2811, SK6812, APA102) LEDs or also SPI based chipsets like the WS2801!

Expand Down
2 changes: 1 addition & 1 deletion usermods/Temperature/readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Temperature usermod

Based on the excellent `QuinLED_Dig_Uno_Temp_MQTT` by srg74!
Based on the excellent `QuinLED_Dig_Uno_Temp_MQTT` by srg74 and 400killer!
This usermod will read from an attached DS18B20 temperature sensor (as available on the QuinLED Dig-Uno)
The temperature is displayed both in the Info section of the web UI as well as published to the `/temperature` MQTT topic if enabled.
This usermod will be expanded with support for different sensor types in the future.
Expand Down
27 changes: 25 additions & 2 deletions wled00/FX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3342,8 +3342,8 @@ uint16_t WS2812FX::mode_solid_glitter()
*/
uint16_t WS2812FX::mode_sunrise() {
//speed 0 - static sun
//speed 1 - 120: sunrise time in minutes
//speed 121 - 240 : sunset time in minutes - 120;
//speed 1 - 60: sunrise time in minutes
//speed 60 - 120 : sunset time in minutes - 60;
//speed above: "breathing" rise and set
if (SEGENV.call == 0 || SEGMENT.speed != SEGENV.aux0) {
SEGENV.step = millis(); //save starting time, millis() because now can change from sync
Expand Down Expand Up @@ -3540,3 +3540,26 @@ uint16_t WS2812FX::mode_flow(void)

return FRAMETIME;
}


/*
* Dots waving around in a sine/pendulum motion.
* Little pixel birds flying in a circle. By Aircoookie
*/
uint16_t WS2812FX::mode_chunchun(void)
{
fill(SEGCOLOR(1));
uint16_t counter = now*(6 + (SEGMENT.speed >> 4));
uint16_t numBirds = SEGLEN >> 2;
uint16_t span = SEGMENT.intensity << 8;

for (uint16_t i = 0; i < numBirds; i++)
{
counter -= span/numBirds;
int megumin = sin16(counter) + 0x8000;
uint32_t bird = (megumin * SEGLEN) >> 16;
uint32_t c = color_from_palette((i * 255)/ numBirds, false, true, 0);
setPixelColor(bird, c);
}
return FRAMETIME;
}
10 changes: 7 additions & 3 deletions wled00/FX.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
#define IS_REVERSE ((SEGMENT.options & REVERSE ) == REVERSE )
#define IS_SELECTED ((SEGMENT.options & SELECTED ) == SELECTED )

#define MODE_COUNT 111
#define MODE_COUNT 112

#define FX_MODE_STATIC 0
#define FX_MODE_BLINK 1
Expand Down Expand Up @@ -211,6 +211,7 @@
#define FX_MODE_SINEWAVE 108
#define FX_MODE_PHASEDNOISE 109
#define FX_MODE_FLOW 110
#define FX_MODE_CHUNCHUN 111

class WS2812FX {
typedef uint16_t (WS2812FX::*mode_ptr)(void);
Expand Down Expand Up @@ -410,6 +411,7 @@ class WS2812FX {
_mode[FX_MODE_SINEWAVE] = &WS2812FX::mode_sinewave;
_mode[FX_MODE_PHASEDNOISE] = &WS2812FX::mode_phased_noise;
_mode[FX_MODE_FLOW] = &WS2812FX::mode_flow;
_mode[FX_MODE_CHUNCHUN] = &WS2812FX::mode_chunchun;

_brightness = DEFAULT_BRIGHTNESS;
currentPalette = CRGBPalette16(CRGB::Black);
Expand Down Expand Up @@ -604,7 +606,8 @@ class WS2812FX {
mode_noisepal(void),
mode_sinewave(void),
mode_phased_noise(void),
mode_flow(void);
mode_flow(void),
mode_chunchun(void);

private:
NeoPixelWrapper *bus;
Expand Down Expand Up @@ -691,7 +694,8 @@ const char JSON_mode_names[] PROGMEM = R"=====([
"Noise 1","Noise 2","Noise 3","Noise 4","Colortwinkles","Lake","Meteor","Meteor Smooth","Railway","Ripple",
"Twinklefox","Twinklecat","Halloween Eyes","Solid Pattern","Solid Pattern Tri","Spots","Spots Fade","Glitter","Candle","Fireworks Starburst",
"Fireworks 1D","Bouncing Balls","Sinelon","Sinelon Dual","Sinelon Rainbow","Popcorn","Drip","Plasma","Percent","Ripple Rainbow",
"Heartbeat","Pacifica","Candle Multi", "Solid Glitter","Sunrise","Phased","Twinkleup","Noise Pal", "Sine","Phased Noise","Flow"
"Heartbeat","Pacifica","Candle Multi", "Solid Glitter","Sunrise","Phased","Twinkleup","Noise Pal", "Sine","Phased Noise",
"Flow","Chunchun"
])=====";


Expand Down
19 changes: 14 additions & 5 deletions wled00/FX_fcn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ void WS2812FX::setPixelColor(uint16_t i, byte r, byte g, byte b, byte w)
}
}

//reorder channels to selected order
RgbwColor col;
switch (colorOrder)
{
Expand Down Expand Up @@ -401,7 +402,12 @@ uint8_t WS2812FX::getMaxSegments(void) {

uint8_t WS2812FX::getMainSegmentId(void) {
if (mainSegment >= MAX_NUM_SEGMENTS) return 0;
return mainSegment;
if (_segments[mainSegment].isActive()) return mainSegment;
for (uint8_t i = 0; i < MAX_NUM_SEGMENTS; i++) //get first active
{
if (_segments[i].isActive()) return i;
}
return 0;
}

uint32_t WS2812FX::getColor(void) {
Expand Down Expand Up @@ -529,11 +535,14 @@ void WS2812FX::setShowCallback(show_callback cb)

void WS2812FX::setTransitionMode(bool t)
{
_segment_index = getMainSegmentId();
SEGMENT.setOption(SEG_OPTION_TRANSITIONAL, t);
if (!t) return;
unsigned long waitMax = millis() + 20; //refresh after 20 ms if transition enabled
if (SEGMENT.mode == FX_MODE_STATIC && SEGENV.next_time > waitMax) SEGENV.next_time = waitMax;
for (uint16_t i = 0; i < MAX_NUM_SEGMENTS; i++)
{
_segment_index = i;
SEGMENT.setOption(SEG_OPTION_TRANSITIONAL, t);

if (t && SEGMENT.mode == FX_MODE_STATIC && SEGENV.next_time > waitMax) SEGENV.next_time = waitMax;
}
}

/*
Expand Down
6 changes: 6 additions & 0 deletions wled00/const.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@
#define SEG_OPTION_NONUNITY 4 //Indicates that the effect does not use FRAMETIME or needs getPixelColor
#define SEG_OPTION_TRANSITIONAL 7

//Timer mode types
#define NL_MODE_SET 0 //After nightlight time elapsed, set to target brightness
#define NL_MODE_FADE 1 //Fade to target brightness gradually
#define NL_MODE_COLORFADE 2 //Fade to target brightness and secondary color gradually
#define NL_MODE_SUN 3 //Sunrise/sunset. Target brightness is set immediately, then Sunrise effect is started. Max 60 min.

//EEPROM size
#define EEPSIZE 2560 //Maximum is 4096

Expand Down
2,643 changes: 1,492 additions & 1,151 deletions wled00/data/index.htm

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion wled00/data/settings_leds.htm
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,13 @@ <h3>Transitions</h3>
<h3>Timed light</h3>
Default Duration: <input name="TL" type="number" min="1" max="255" required> min<br>
Default Target brightness: <input name="TB" type="number" min="0" max="255" required><br>
Fade down: <input type="checkbox" name="TW"><br>
Mode:
<select name="TW">
<option value="0">Wait and set</option>
<option value="1">Fade</option>
<option value="2">Fade Color</option>
<option value="3">Sunrise</option>
</select>
<h3>Advanced</h3>
Palette blending:
<select name="PB">
Expand Down
2 changes: 1 addition & 1 deletion wled00/data/update.htm
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</head>

<body>
<h2>WLED Software Update</h2>Installed version: 0.10.0<br>Download the latest binary: <a
<h2>WLED Software Update</h2>Installed version: ##VERSION##<br>Download the latest binary: <a
href="https://github.com/Aircoookie/WLED/releases"><img
src="https://img.shields.io/github/release/Aircoookie/WLED.svg?style=flat-square"></a><br>
<form method='POST' action='/update' enctype='multipart/form-data'><input type='file' class="bt" name='update'
Expand Down
2 changes: 1 addition & 1 deletion wled00/html_other.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const char PAGE_update[] PROGMEM = R"=====(<!DOCTYPE html><html><head><meta cont
<title>WLED Update</title><script>function B(){window.history.back()}</script>
<style>
.bt{background:#333;color:#fff;font-family:Verdana,sans-serif;border:.3ch solid #333;display:inline-block;font-size:20px;margin:8px;margin-top:12px}input[type=file]{font-size:16px}body{font-family:Verdana,sans-serif;text-align:center;background:#222;color:#fff;line-height:200%}
</style></head><body><h2>WLED Software Update</h2>Installed version: 0.10.0<br>
</style></head><body><h2>WLED Software Update</h2>Installed version: 0.10.1<br>
Download the latest binary: <a
href="https://github.com/Aircoookie/WLED/releases"><img
src="https://img.shields.io/github/release/Aircoookie/WLED.svg?style=flat-square">
Expand Down
16 changes: 9 additions & 7 deletions wled00/html_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,14 @@ name="TD" maxlength="5" size="2"> ms<br>Enable Palette transitions: <input
type="checkbox" name="PF"><h3>Timed light</h3>Default Duration: <input
name="TL" type="number" min="1" max="255" required> min<br>
Default Target brightness: <input name="TB" type="number" min="0" max="255"
required><br>Fade down: <input type="checkbox" name="TW"><br><h3>Advanced</h3>
Palette blending: <select name="PB"><option value="0">Linear (wrap if moving)
</option><option value="1">Linear (always wrap)</option><option value="2">
Linear (never wrap)</option><option value="3">None (not recommended)</option>
</select><br>Reverse LED order (rotate 180): <input type="checkbox" name="RV">
<br>Skip first LED: <input type="checkbox" name="SL"><hr><button type="button"
required><br>Mode: <select name="TW"><option value="0">Wait and set</option>
<option value="1">Fade</option><option value="2">Fade Color</option><option
value="3">Sunrise</option></select><h3>Advanced</h3>Palette blending: <select
name="PB"><option value="0">Linear (wrap if moving)</option><option value="1">
Linear (always wrap)</option><option value="2">Linear (never wrap)</option>
<option value="3">None (not recommended)</option></select><br>
Reverse LED order (rotate 180): <input type="checkbox" name="RV"><br>
Skip first LED: <input type="checkbox" name="SL"><hr><button type="button"
onclick="B()">Back</button><button type="submit">Save</button></form></body>
</html>)=====";

Expand Down Expand Up @@ -335,7 +337,7 @@ HTTP traffic is unencrypted. An attacker in the same network can intercept form
<h3>Software Update</h3><button type="button" onclick="U()">Manual OTA Update
</button><br>Enable ArduinoOTA: <input type="checkbox" name="AO"><br><h3>About
</h3><a href="https://github.com/Aircoookie/WLED/" target="_blank">WLED</a>
version 0.10.0<br><br><a
version 0.10.1<br><br><a
href="https://github.com/Aircoookie/WLED/wiki/Contributors-&-About"
target="_blank">Contributors, dependencies and special thanks</a><br>
A huge thank you to everyone who helped me create WLED!<br><br>
Expand Down
Loading

0 comments on commit 4f7dc5b

Please sign in to comment.