First commit of 0.8.0 dev cycle

Updated to newer WS2812FX version which supports segments (not supported in WLED yet)
Added new (FastLED) effects
Adjusted FX speed timings
Removed Sweep transition and Custom Chase (seldomly used - hinder development)
Removed solid overlay (no longer needed once segments are added)
Fixed Blynk effect set
This commit is contained in:
cschwinne 2018-09-04 15:51:38 +02:00
parent 1d4d885276
commit 70d0aae07c
16 changed files with 2374 additions and 2490 deletions

View File

@ -1,8 +1,12 @@
//this code is a modified version of https://github.com/Makuna/NeoPixelBus/issues/103 //this code is a modified version of https://github.com/Makuna/NeoPixelBus/issues/103
#ifndef NpbWrapper_h
#define NpbWrapper_h
//#define WORKAROUND_ESP32_BITBANG //#define WORKAROUND_ESP32_BITBANG
//see https://github.com/Aircoookie/WLED/issues/2 for flicker free ESP32 support //see https://github.com/Aircoookie/WLED/issues/2 for flicker free ESP32 support
#define LEDPIN 2 //strip pin. Only effective for ESP32, ESP8266 must use gpio2
//uncomment this if red and green are swapped //uncomment this if red and green are swapped
//#define SWAPRG //#define SWAPRG
@ -13,9 +17,12 @@
#else #else
#define PIXELMETHOD NeoEsp32RmtWS2813_V3Method #define PIXELMETHOD NeoEsp32RmtWS2813_V3Method
#endif #endif
#else #else //esp8266
//you may change to DMA method on pin GPIO3 here
#define PIXELMETHOD NeoEsp8266Uart800KbpsMethod #define PIXELMETHOD NeoEsp8266Uart800KbpsMethod
//#define PIXELMETHOD NeoEsp8266Dma800KbpsMethod
#endif #endif
//handle swapping Red and Green automatically //handle swapping Red and Green automatically
#ifdef SWAPRG #ifdef SWAPRG
#define PIXELFEATURE3 NeoRgbFeature #define PIXELFEATURE3 NeoRgbFeature
@ -52,7 +59,7 @@ public:
cleanup(); cleanup();
} }
void Begin(NeoPixelType type, uint16_t countPixels, uint8_t pin) void Begin(NeoPixelType type, uint16_t countPixels)
{ {
cleanup(); cleanup();
_type = type; _type = type;
@ -60,12 +67,12 @@ public:
switch (_type) { switch (_type) {
case NeoPixelType_Grb: case NeoPixelType_Grb:
_pGrb = new NeoPixelBrightnessBus<PIXELFEATURE3,PIXELMETHOD>(countPixels, pin); _pGrb = new NeoPixelBrightnessBus<PIXELFEATURE3,PIXELMETHOD>(countPixels, LEDPIN);
_pGrb->Begin(); _pGrb->Begin();
break; break;
case NeoPixelType_Grbw: case NeoPixelType_Grbw:
_pGrbw = new NeoPixelBrightnessBus<PIXELFEATURE4,PIXELMETHOD>(countPixels, pin); _pGrbw = new NeoPixelBrightnessBus<PIXELFEATURE4,PIXELMETHOD>(countPixels, LEDPIN);
_pGrbw->Begin(); _pGrbw->Begin();
break; break;
} }
@ -110,7 +117,7 @@ public:
void SetPixelColor(uint16_t indexPixel, RgbwColor color) void SetPixelColor(uint16_t indexPixel, RgbwColor color)
{ {
switch (_type) { switch (_type) {
case NeoPixelType_Grb: _pGrbw->SetPixelColor(indexPixel, color); break; case NeoPixelType_Grb: _pGrb->SetPixelColor(indexPixel, RgbColor(color.R,color.G,color.B)); break;
case NeoPixelType_Grbw: _pGrbw->SetPixelColor(indexPixel, color); break; case NeoPixelType_Grbw: _pGrbw->SetPixelColor(indexPixel, color); break;
} }
} }
@ -174,3 +181,4 @@ private:
} }
} }
}; };
#endif

File diff suppressed because it is too large Load Diff

View File

@ -2,18 +2,17 @@
/* /*
WS2812FX.h - Library for WS2812 LED effects. WS2812FX.h - Library for WS2812 LED effects.
Harm Aldick - 2016 Harm Aldick - 2016
www.aldick.org www.aldick.org
FEATURES FEATURES
* A lot of blinken modes and counting * A lot of blinken modes and counting
* WS2812FX can be used as drop-in replacement for Adafruit Neopixel Library * WS2812FX can be used as drop-in replacement for Adafruit NeoPixel Library
NOTES NOTES
* Uses the Adafruit Neopixel library. Get it here: * Uses the Adafruit NeoPixel library. Get it here:
https://github.com/adafruit/Adafruit_NeoPixel https://github.com/adafruit/Adafruit_NeoPixel
LICENSE LICENSE
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2016 Harm Aldick Copyright (c) 2016 Harm Aldick
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
@ -29,27 +28,61 @@
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
Heavily modified to work with WLED - differs from Github WS2812FX CHANGELOG
2016-05-28 Initial beta release
2016-06-03 Code cleanup, minor improvements, new modes
2016-06-04 2 new fx, fixed setColor (now also resets _mode_color)
2017-02-02 added external trigger functionality (e.g. for sound-to-light)
Modified for WLED
*/ */
#ifndef WS2812FX_h #ifndef WS2812FX_h
#define WS2812FX_h #define WS2812FX_h
#include "Arduino.h"
#include "NpbWrapper.h" #include "NpbWrapper.h"
#define DEFAULT_BRIGHTNESS 50 #define DEFAULT_BRIGHTNESS (uint8_t)50
#define DEFAULT_MODE 0 #define DEFAULT_MODE (uint8_t)0
#define DEFAULT_SPEED 150 #define DEFAULT_SPEED (uint16_t)1000
#define DEFAULT_COLOR 0xFFAA00 #define DEFAULT_COLOR (uint32_t)0xFF0000
#define SPEED_MIN 0 #define min(a,b) ((a)<(b)?(a):(b))
#define SPEED_MAX 255 #define max(a,b) ((a)>(b)?(a):(b))
#define BRIGHTNESS_MIN 0 /* each segment uses 38 bytes of SRAM memory, so if you're application fails because of
#define BRIGHTNESS_MAX 255 insufficient memory, decreasing MAX_NUM_SEGMENTS may help */
#define MAX_NUM_SEGMENTS 12
#define NUM_COLORS 3 /* number of colors per segment */
#define SEGMENT _segments[_segment_index]
#define SEGMENT_RUNTIME _segment_runtimes[_segment_index]
#define SEGMENT_LENGTH (SEGMENT.stop - SEGMENT.start + 1)
#define SPEED_FORMULA_L 5 + (50*(255 - SEGMENT.speed))/SEGMENT_LENGTH
#define RESET_RUNTIME memset(_segment_runtimes, 0, sizeof(_segment_runtimes))
#define MODE_COUNT 58 // some common colors
#define RED (uint32_t)0xFF0000
#define GREEN (uint32_t)0x00FF00
#define BLUE (uint32_t)0x0000FF
#define WHITE (uint32_t)0xFFFFFF
#define BLACK (uint32_t)0x000000
#define YELLOW (uint32_t)0xFFFF00
#define CYAN (uint32_t)0x00FFFF
#define MAGENTA (uint32_t)0xFF00FF
#define PURPLE (uint32_t)0x400080
#define ORANGE (uint32_t)0xFF3000
#define PINK (uint32_t)0xFF1493
#define ULTRAWHITE (uint32_t)0xFFFFFFFF
// options
// bit 8: reverse animation
// bits 5-7: fade rate (0-7)
// bit 4: gamma correction
// bits 1-3: TBD
#define NO_OPTIONS (uint8_t)0x00
#define REVERSE (uint8_t)0x80
#define IS_REVERSE ((SEGMENT.options & REVERSE) == REVERSE)
#define MODE_COUNT 72
#define FX_MODE_STATIC 0 #define FX_MODE_STATIC 0
#define FX_MODE_BLINK 1 #define FX_MODE_BLINK 1
@ -57,7 +90,7 @@
#define FX_MODE_COLOR_WIPE 3 #define FX_MODE_COLOR_WIPE 3
#define FX_MODE_COLOR_WIPE_RANDOM 4 #define FX_MODE_COLOR_WIPE_RANDOM 4
#define FX_MODE_RANDOM_COLOR 5 #define FX_MODE_RANDOM_COLOR 5
#define FX_MODE_EASTER 6 #define FX_MODE_COLOR_SWEEP 6
#define FX_MODE_DYNAMIC 7 #define FX_MODE_DYNAMIC 7
#define FX_MODE_RAINBOW 8 #define FX_MODE_RAINBOW 8
#define FX_MODE_RAINBOW_CYCLE 9 #define FX_MODE_RAINBOW_CYCLE 9
@ -104,193 +137,225 @@
#define FX_MODE_DUAL_COLOR_WIPE_OUT_OUT 50 #define FX_MODE_DUAL_COLOR_WIPE_OUT_OUT 50
#define FX_MODE_DUAL_COLOR_WIPE_OUT_IN 51 #define FX_MODE_DUAL_COLOR_WIPE_OUT_IN 51
#define FX_MODE_CIRCUS_COMBUSTUS 52 #define FX_MODE_CIRCUS_COMBUSTUS 52
#define FX_MODE_CUSTOM_CHASE 53 #define FX_MODE_HALLOWEEN 53
#define FX_MODE_CC_ON_RAINBOW 54 #define FX_MODE_TRICOLOR_CHASE 54
#define FX_MODE_CC_ON_RAINBOW_CYCLE 55 #define FX_MODE_TRICOLOR_WIPE 55
#define FX_MODE_CC_BLINK 56 #define FX_MODE_TRICOLOR_FADE 56
#define FX_MODE_CC_RANDOM 57 #define FX_MODE_LIGHTNING 57
#define FX_MODE_ICU 58
#define FX_MODE_MULTI_COMET 59
#define FX_MODE_DUAL_LARSON_SCANNER 60
#define FX_MODE_RANDOM_CHASE 61
#define FX_MODE_OSCILLATE 62
#define FX_MODE_FIRE_2012 63
#define FX_MODE_JUGGLE 64
#define FX_MODE_PALETTE 65
#define FX_MODE_BPM 66
#define FX_MODE_FILLNOISE8 67
#define FX_MODE_NOISE16_1 68
#define FX_MODE_NOISE16_2 69
#define FX_MODE_NOISE16_3 70
#define FX_MODE_NOISE16_4 71
class WS2812FX { class WS2812FX {
typedef void (WS2812FX::*mode_ptr)(void); typedef uint16_t (WS2812FX::*mode_ptr)(void);
// segment parameters
public: public:
WS2812FX(){ typedef struct Segment { // 20 bytes
uint16_t start;
uint16_t stop;
uint8_t speed;
uint8_t intensity;
uint8_t mode;
uint8_t options;
uint32_t colors[NUM_COLORS];
} segment;
_mode[FX_MODE_STATIC] = &WS2812FX::mode_static; // segment runtime parameters
_mode[FX_MODE_BLINK] = &WS2812FX::mode_blink; typedef struct Segment_runtime { // 17 bytes
_mode[FX_MODE_BREATH] = &WS2812FX::mode_breath; unsigned long next_time;
_mode[FX_MODE_COLOR_WIPE] = &WS2812FX::mode_color_wipe; uint32_t counter_mode_step;
_mode[FX_MODE_COLOR_WIPE_RANDOM] = &WS2812FX::mode_color_wipe_random; uint32_t counter_mode_call;
_mode[FX_MODE_RANDOM_COLOR] = &WS2812FX::mode_random_color; uint16_t aux_param;
_mode[FX_MODE_EASTER] = &WS2812FX::mode_easter; uint16_t aux_param2;
_mode[FX_MODE_DYNAMIC] = &WS2812FX::mode_dynamic; bool trans_act;
_mode[FX_MODE_RAINBOW] = &WS2812FX::mode_rainbow; } segment_runtime;
_mode[FX_MODE_RAINBOW_CYCLE] = &WS2812FX::mode_rainbow_cycle;
_mode[FX_MODE_SCAN] = &WS2812FX::mode_scan; WS2812FX() {
_mode[FX_MODE_DUAL_SCAN] = &WS2812FX::mode_dual_scan; _mode[FX_MODE_STATIC] = &WS2812FX::mode_static;
_mode[FX_MODE_FADE] = &WS2812FX::mode_fade; _mode[FX_MODE_BLINK] = &WS2812FX::mode_blink;
_mode[FX_MODE_THEATER_CHASE] = &WS2812FX::mode_theater_chase; _mode[FX_MODE_COLOR_WIPE] = &WS2812FX::mode_color_wipe;
_mode[FX_MODE_THEATER_CHASE_RAINBOW] = &WS2812FX::mode_theater_chase_rainbow; _mode[FX_MODE_COLOR_WIPE_RANDOM] = &WS2812FX::mode_color_wipe_random;
_mode[FX_MODE_RUNNING_LIGHTS] = &WS2812FX::mode_running_lights; _mode[FX_MODE_RANDOM_COLOR] = &WS2812FX::mode_random_color;
_mode[FX_MODE_TWINKLE] = &WS2812FX::mode_twinkle; _mode[FX_MODE_COLOR_SWEEP] = &WS2812FX::mode_color_sweep;
_mode[FX_MODE_TWINKLE_RANDOM] = &WS2812FX::mode_twinkle_random; _mode[FX_MODE_DYNAMIC] = &WS2812FX::mode_dynamic;
_mode[FX_MODE_TWINKLE_FADE] = &WS2812FX::mode_twinkle_fade; _mode[FX_MODE_RAINBOW] = &WS2812FX::mode_rainbow;
_mode[FX_MODE_TWINKLE_FADE_RANDOM] = &WS2812FX::mode_twinkle_fade_random; _mode[FX_MODE_RAINBOW_CYCLE] = &WS2812FX::mode_rainbow_cycle;
_mode[FX_MODE_SPARKLE] = &WS2812FX::mode_sparkle; _mode[FX_MODE_SCAN] = &WS2812FX::mode_scan;
_mode[FX_MODE_FLASH_SPARKLE] = &WS2812FX::mode_flash_sparkle; _mode[FX_MODE_DUAL_SCAN] = &WS2812FX::mode_dual_scan;
_mode[FX_MODE_HYPER_SPARKLE] = &WS2812FX::mode_hyper_sparkle; _mode[FX_MODE_FADE] = &WS2812FX::mode_fade;
_mode[FX_MODE_STROBE] = &WS2812FX::mode_strobe; _mode[FX_MODE_THEATER_CHASE] = &WS2812FX::mode_theater_chase;
_mode[FX_MODE_STROBE_RAINBOW] = &WS2812FX::mode_strobe_rainbow; _mode[FX_MODE_THEATER_CHASE_RAINBOW] = &WS2812FX::mode_theater_chase_rainbow;
_mode[FX_MODE_MULTI_STROBE] = &WS2812FX::mode_multi_strobe; _mode[FX_MODE_TWINKLE] = &WS2812FX::mode_twinkle;
_mode[FX_MODE_BLINK_RAINBOW] = &WS2812FX::mode_blink_rainbow; _mode[FX_MODE_TWINKLE_RANDOM] = &WS2812FX::mode_twinkle_random;
_mode[FX_MODE_ANDROID] = &WS2812FX::mode_android; _mode[FX_MODE_TWINKLE_FADE] = &WS2812FX::mode_twinkle_fade;
_mode[FX_MODE_CHASE_COLOR] = &WS2812FX::mode_chase_color; _mode[FX_MODE_TWINKLE_FADE_RANDOM] = &WS2812FX::mode_twinkle_fade_random;
_mode[FX_MODE_CHASE_RANDOM] = &WS2812FX::mode_chase_random; _mode[FX_MODE_SPARKLE] = &WS2812FX::mode_sparkle;
_mode[FX_MODE_CHASE_RAINBOW] = &WS2812FX::mode_chase_rainbow; _mode[FX_MODE_FLASH_SPARKLE] = &WS2812FX::mode_flash_sparkle;
_mode[FX_MODE_CHASE_FLASH] = &WS2812FX::mode_chase_flash; _mode[FX_MODE_HYPER_SPARKLE] = &WS2812FX::mode_hyper_sparkle;
_mode[FX_MODE_CHASE_FLASH_RANDOM] = &WS2812FX::mode_chase_flash_random; _mode[FX_MODE_STROBE] = &WS2812FX::mode_strobe;
_mode[FX_MODE_CHASE_RAINBOW_WHITE] = &WS2812FX::mode_chase_rainbow_white; _mode[FX_MODE_STROBE_RAINBOW] = &WS2812FX::mode_strobe_rainbow;
_mode[FX_MODE_COLORFUL] = &WS2812FX::mode_colorful; _mode[FX_MODE_MULTI_STROBE] = &WS2812FX::mode_multi_strobe;
_mode[FX_MODE_TRAFFIC_LIGHT] = &WS2812FX::mode_traffic_light; _mode[FX_MODE_BLINK_RAINBOW] = &WS2812FX::mode_blink_rainbow;
_mode[FX_MODE_COLOR_SWEEP_RANDOM] = &WS2812FX::mode_color_sweep_random; _mode[FX_MODE_ANDROID] = &WS2812FX::mode_android;
_mode[FX_MODE_RUNNING_COLOR] = &WS2812FX::mode_running_color; _mode[FX_MODE_CHASE_COLOR] = &WS2812FX::mode_chase_color;
_mode[FX_MODE_RUNNING_RED_BLUE] = &WS2812FX::mode_running_red_blue; _mode[FX_MODE_CHASE_RANDOM] = &WS2812FX::mode_chase_random;
_mode[FX_MODE_RUNNING_RANDOM] = &WS2812FX::mode_running_random; _mode[FX_MODE_CHASE_RAINBOW] = &WS2812FX::mode_chase_rainbow;
_mode[FX_MODE_LARSON_SCANNER] = &WS2812FX::mode_larson_scanner; _mode[FX_MODE_CHASE_FLASH] = &WS2812FX::mode_chase_flash;
_mode[FX_MODE_COMET] = &WS2812FX::mode_comet; _mode[FX_MODE_CHASE_FLASH_RANDOM] = &WS2812FX::mode_chase_flash_random;
_mode[FX_MODE_FIREWORKS] = &WS2812FX::mode_fireworks; _mode[FX_MODE_CHASE_RAINBOW_WHITE] = &WS2812FX::mode_chase_rainbow_white;
_mode[FX_MODE_FIREWORKS_RANDOM] = &WS2812FX::mode_fireworks_random; _mode[FX_MODE_COLORFUL] = &WS2812FX::mode_colorful;
_mode[FX_MODE_MERRY_CHRISTMAS] = &WS2812FX::mode_merry_christmas; _mode[FX_MODE_TRAFFIC_LIGHT] = &WS2812FX::mode_traffic_light;
_mode[FX_MODE_FIRE_FLICKER] = &WS2812FX::mode_fire_flicker; _mode[FX_MODE_COLOR_SWEEP_RANDOM] = &WS2812FX::mode_color_sweep_random;
_mode[FX_MODE_GRADIENT] = &WS2812FX::mode_gradient; _mode[FX_MODE_RUNNING_COLOR] = &WS2812FX::mode_running_color;
_mode[FX_MODE_LOADING] = &WS2812FX::mode_loading; _mode[FX_MODE_RUNNING_RED_BLUE] = &WS2812FX::mode_running_red_blue;
_mode[FX_MODE_RUNNING_RANDOM] = &WS2812FX::mode_running_random;
_mode[FX_MODE_LARSON_SCANNER] = &WS2812FX::mode_larson_scanner;
_mode[FX_MODE_COMET] = &WS2812FX::mode_comet;
_mode[FX_MODE_FIREWORKS] = &WS2812FX::mode_fireworks;
_mode[FX_MODE_FIREWORKS_RANDOM] = &WS2812FX::mode_fireworks_random;
_mode[FX_MODE_MERRY_CHRISTMAS] = &WS2812FX::mode_merry_christmas;
_mode[FX_MODE_FIRE_FLICKER] = &WS2812FX::mode_fire_flicker;
_mode[FX_MODE_GRADIENT] = &WS2812FX::mode_gradient;
_mode[FX_MODE_LOADING] = &WS2812FX::mode_loading;
_mode[FX_MODE_DUAL_COLOR_WIPE_IN_OUT] = &WS2812FX::mode_dual_color_wipe_in_out; _mode[FX_MODE_DUAL_COLOR_WIPE_IN_OUT] = &WS2812FX::mode_dual_color_wipe_in_out;
_mode[FX_MODE_DUAL_COLOR_WIPE_IN_IN] = &WS2812FX::mode_dual_color_wipe_in_in; _mode[FX_MODE_DUAL_COLOR_WIPE_IN_IN] = &WS2812FX::mode_dual_color_wipe_in_in;
_mode[FX_MODE_DUAL_COLOR_WIPE_OUT_OUT] = &WS2812FX::mode_dual_color_wipe_out_out; _mode[FX_MODE_DUAL_COLOR_WIPE_OUT_OUT] = &WS2812FX::mode_dual_color_wipe_out_out;
_mode[FX_MODE_DUAL_COLOR_WIPE_OUT_IN] = &WS2812FX::mode_dual_color_wipe_out_in; _mode[FX_MODE_DUAL_COLOR_WIPE_OUT_IN] = &WS2812FX::mode_dual_color_wipe_out_in;
_mode[FX_MODE_CIRCUS_COMBUSTUS] = &WS2812FX::mode_circus_combustus; _mode[FX_MODE_CIRCUS_COMBUSTUS] = &WS2812FX::mode_circus_combustus;
_mode[FX_MODE_CUSTOM_CHASE] = &WS2812FX::mode_cc_standard; _mode[FX_MODE_HALLOWEEN] = &WS2812FX::mode_halloween;
_mode[FX_MODE_CC_ON_RAINBOW] = &WS2812FX::mode_cc_rainbow; _mode[FX_MODE_TRICOLOR_CHASE] = &WS2812FX::mode_tricolor_chase;
_mode[FX_MODE_CC_ON_RAINBOW_CYCLE] = &WS2812FX::mode_cc_cycle; _mode[FX_MODE_TRICOLOR_WIPE] = &WS2812FX::mode_tricolor_wipe;
_mode[FX_MODE_CC_BLINK] = &WS2812FX::mode_cc_blink; _mode[FX_MODE_TRICOLOR_FADE] = &WS2812FX::mode_tricolor_fade;
_mode[FX_MODE_CC_RANDOM] = &WS2812FX::mode_cc_random; _mode[FX_MODE_BREATH] = &WS2812FX::mode_breath;
_mode[FX_MODE_RUNNING_LIGHTS] = &WS2812FX::mode_running_lights;
_mode[FX_MODE_LIGHTNING] = &WS2812FX::mode_lightning;
_mode[FX_MODE_ICU] = &WS2812FX::mode_icu;
_mode[FX_MODE_MULTI_COMET] = &WS2812FX::mode_multi_comet;
_mode[FX_MODE_DUAL_LARSON_SCANNER] = &WS2812FX::mode_dual_larson_scanner;
_mode[FX_MODE_RANDOM_CHASE] = &WS2812FX::mode_random_chase;
_mode[FX_MODE_OSCILLATE] = &WS2812FX::mode_oscillate;
_mode[FX_MODE_FIRE_2012] = &WS2812FX::mode_fire_2012;
_mode[FX_MODE_BPM] = &WS2812FX::mode_bpm;
_mode[FX_MODE_JUGGLE] = &WS2812FX::mode_juggle;
_mode[FX_MODE_PALETTE] = &WS2812FX::mode_palette;
_mode[FX_MODE_FILLNOISE8] = &WS2812FX::mode_fillnoise8;
_mode[FX_MODE_NOISE16_1] = &WS2812FX::mode_noise16_1;
_mode[FX_MODE_NOISE16_2] = &WS2812FX::mode_noise16_2;
_mode[FX_MODE_NOISE16_3] = &WS2812FX::mode_noise16_3;
_mode[FX_MODE_NOISE16_4] = &WS2812FX::mode_noise16_4;
_mode_index = DEFAULT_MODE;
_speed = DEFAULT_SPEED;
_brightness = DEFAULT_BRIGHTNESS; _brightness = DEFAULT_BRIGHTNESS;
_running = false; _running = false;
_led_count = 255; _num_segments = 1;
_mode_last_call_time = 0; _segments[0].mode = DEFAULT_MODE;
_mode_delay = 0; _segments[0].colors[0] = DEFAULT_COLOR;
_color = DEFAULT_COLOR; _segments[0].start = 0;
_mode_color = DEFAULT_COLOR; _segments[0].speed = DEFAULT_SPEED;
_color_sec = 0;
_mode_var1 = 0;
_cc_fs = true;
_cc_fe = false;
_cc_is = 0;
_cc_i1 = 0;
_cc_i2 = 254;
_cc_num1 = 5;
_cc_num2 = 5;
_ccStep = 1;
_counter_mode_call = 0;
_counter_mode_step = 0;
_counter_ccStep = 0;
_fastStandard = false;
_reverseMode = false; _reverseMode = false;
_skipFirstMode = false; _skipFirstMode = false;
_locked = NULL; _locked = NULL;
_cronixieDigits = new byte[6]; _cronixieDigits = new byte[6];
bus = new NeoPixelWrapper(); bus = new NeoPixelWrapper();
RESET_RUNTIME;
} }
void void
show(void), init(bool supportWhite, uint16_t countPixels, bool skipFirst),
setPixelColor(uint16_t i, byte r, byte g, byte b),
setPixelColor(uint16_t i, byte r, byte g, byte b, byte w),
init(bool supportWhite, uint16_t countPixels, uint8_t pin, bool skipFirst),
service(void), service(void),
start(void), clear(void),
stop(void), strip_off(void),
setMode(byte m), fade_out(uint8_t r),
setCustomChase(byte i1, uint16_t i2, byte is, byte np, byte ns, byte stp, bool fs, bool fe), setMode(uint8_t m),
setCCIndex1(byte i1), setSpeed(uint8_t s),
setCCIndex2(uint16_t i2), setIntensity(uint8_t i),
setCCStart(byte is), setColor(uint8_t r, uint8_t g, uint8_t b, uint8_t w = 0),
setCCNum1(byte np), setSecondaryColor(uint8_t r, uint8_t g, uint8_t b, uint8_t w = 0),
setCCNum2(byte ns),
setCCStep(byte stp),
setCCFS(bool fs),
setCCFE(bool fe),
setSpeed(byte s),
setIntensity(byte in),
increaseSpeed(byte s),
decreaseSpeed(byte s),
setColor(byte r, byte g, byte b),
setColor(byte r, byte g, byte b, byte w),
setColor(uint32_t c), setColor(uint32_t c),
setSecondaryColor(byte r, byte g, byte b),
setSecondaryColor(byte r, byte g, byte b, byte w),
setSecondaryColor(uint32_t c), setSecondaryColor(uint32_t c),
setBrightness(byte b), setBrightness(uint8_t b),
increaseBrightness(byte s),
decreaseBrightness(byte s),
setReverseMode(bool b), setReverseMode(bool b),
driverModeCronixie(bool b), driverModeCronixie(bool b),
setCronixieDigits(byte* d), setCronixieDigits(byte* d),
setCronixieBacklight(bool b), setCronixieBacklight(bool b),
setIndividual(int i), setIndividual(uint16_t i, uint32_t col),
setIndividual(int i, uint32_t col), setRange(uint16_t i, uint16_t i2, uint32_t col),
setRange(int i, int i2), lock(uint16_t i),
setRange(int i, int i2, uint32_t col), lockRange(uint16_t i, uint16_t i2),
lock(int i), unlock(uint16_t i),
lockRange(int i, int i2), unlockRange(uint16_t i, uint16_t i2),
lockAll(void),
unlock(int i),
unlockRange(int i, int i2),
unlockAll(void), unlockAll(void),
setFastUpdateMode(bool b),
trigger(void), trigger(void),
setFade(int sp); setNumSegments(uint8_t n),
setSegment(uint8_t n, uint16_t start, uint16_t stop, uint8_t mode, uint32_t color, uint8_t speed, uint8_t intensity, bool reverse),
setSegment(uint8_t n, uint16_t start, uint16_t stop, uint8_t mode, const uint32_t colors[], uint8_t speed, uint8_t intensity, bool reverse),
setSegment(uint8_t n, uint16_t start, uint16_t stop, uint8_t mode, const uint32_t colors[], uint8_t speed, uint8_t intensity, uint8_t options),
resetSegments(),
setPixelColor(uint16_t n, uint32_t c),
setPixelColor(uint16_t n, uint8_t r, uint8_t g, uint8_t b, uint8_t w = 0),
show(void);
bool uint8_t
isRunning(void), getBrightness(void),
isLocked(int i);
byte
get_random_wheel_index(byte),
getMode(void), getMode(void),
getSpeed(void), getSpeed(void),
getIntensity(void), getNumSegments(void),
getBrightness(void), get_random_wheel_index(uint8_t);
getModeCount(void);
uint32_t uint32_t
color_wheel(byte), color_wheel(uint8_t),
color_blend(uint32_t,uint32_t,uint8_t),
getPixelColor(uint16_t),
getColor(void); getColor(void);
double double
getPowerEstimate(uint16_t leds, uint32_t c, byte b), getPowerEstimate(uint16_t leds, uint32_t c, byte b),
getSafePowerMultiplier(double safeMilliAmps, uint16_t leds, uint32_t c, byte b); getSafePowerMultiplier(double safeMilliAmps, uint16_t leds, uint32_t c, byte b);
private: WS2812FX::Segment
NeoPixelWrapper *bus; getSegment(void);
void WS2812FX::Segment_runtime
begin(bool supportWhite, uint16_t countPixels, uint8_t pin, bool skipFirst), getSegmentRuntime(void);
clear(void),
setPixelColor(uint16_t i, uint32_t c), WS2812FX::Segment*
setPixelColorRaw(uint16_t i, byte r, byte g, byte b, byte w), getSegments(void);
dofade(void),
strip_off(void), // mode helper functions
strip_off_respectLock(void), uint16_t
blink(uint32_t, uint32_t, bool strobe),
color_wipe(uint32_t, uint32_t, bool),
theater_chase(uint32_t, uint32_t),
twinkle(uint32_t),
twinkle_fade(uint32_t),
chase(uint32_t, uint32_t, uint32_t),
running(uint32_t, uint32_t),
fireworks(uint32_t),
tricolor_chase(uint32_t, uint32_t, uint32_t);
// builtin modes
uint16_t
mode_static(void), mode_static(void),
mode_blink(void), mode_blink(void),
mode_blink_rainbow(void),
mode_strobe(void),
mode_strobe_rainbow(void),
mode_color_wipe(void), mode_color_wipe(void),
mode_color_sweep(void),
mode_color_wipe_random(void), mode_color_wipe_random(void),
mode_color_sweep_random(void),
mode_random_color(void), mode_random_color(void),
mode_easter(void),
mode_dynamic(void), mode_dynamic(void),
mode_breath(void), mode_breath(void),
mode_fade(void), mode_fade(void),
@ -308,10 +373,7 @@ class WS2812FX {
mode_sparkle(void), mode_sparkle(void),
mode_flash_sparkle(void), mode_flash_sparkle(void),
mode_hyper_sparkle(void), mode_hyper_sparkle(void),
mode_strobe(void),
mode_strobe_rainbow(void),
mode_multi_strobe(void), mode_multi_strobe(void),
mode_blink_rainbow(void),
mode_android(void), mode_android(void),
mode_chase_color(void), mode_chase_color(void),
mode_chase_random(void), mode_chase_random(void),
@ -320,9 +382,7 @@ class WS2812FX {
mode_chase_flash_random(void), mode_chase_flash_random(void),
mode_chase_rainbow_white(void), mode_chase_rainbow_white(void),
mode_colorful(void), mode_colorful(void),
mode_colorful_internal(uint32_t*),
mode_traffic_light(void), mode_traffic_light(void),
mode_color_sweep_random(void),
mode_running_color(void), mode_running_color(void),
mode_running_red_blue(void), mode_running_red_blue(void),
mode_running_random(void), mode_running_random(void),
@ -331,6 +391,7 @@ class WS2812FX {
mode_fireworks(void), mode_fireworks(void),
mode_fireworks_random(void), mode_fireworks_random(void),
mode_merry_christmas(void), mode_merry_christmas(void),
mode_halloween(void),
mode_fire_flicker(void), mode_fire_flicker(void),
mode_gradient(void), mode_gradient(void),
mode_loading(void), mode_loading(void),
@ -339,67 +400,57 @@ class WS2812FX {
mode_dual_color_wipe_out_out(void), mode_dual_color_wipe_out_out(void),
mode_dual_color_wipe_out_in(void), mode_dual_color_wipe_out_in(void),
mode_circus_combustus(void), mode_circus_combustus(void),
mode_cc_core(void), mode_bicolor_chase(void),
mode_cc_standard(void), mode_tricolor_chase(void),
mode_cc_rainbow(void), mode_tricolor_wipe(void),
mode_cc_cycle(void), mode_tricolor_fade(void),
mode_cc_blink(void), mode_icu(void),
mode_cc_random(void); mode_multi_comet(void),
mode_dual_larson_scanner(void),
mode_random_chase(void),
mode_oscillate(void),
mode_fire_2012(void),
mode_bpm(void),
mode_juggle(void),
mode_palette(void),
mode_fillnoise8(void),
mode_noise16_1(void),
mode_noise16_2(void),
mode_noise16_3(void),
mode_noise16_4(void),
mode_lightning(void);
bool private:
_triggered, NeoPixelWrapper *bus;
_rgbwMode,
_skipFirstMode, uint16_t _length;
_fastStandard, uint16_t _rand16seed;
_reverseMode, uint8_t _brightness;
_cronixieMode,
_cronixieBacklightEnabled,
_cc_fs,
_cc_fe,
_running;
bool*
_locked;
byte
_mode_index,
_speed,
_intensity,
_cc_i1,
_cc_is,
_cc_num1,
_cc_num2,
_ccStep,
_brightness;
byte*
_cronixieDigits;
uint16_t
minval(uint16_t v, uint16_t w),
maxval(uint16_t v, uint16_t w),
_cc_i2,
_led_count;
uint32_t
getPixelColor(uint16_t i),
_color,
_color_sec,
_counter_mode_call,
_counter_mode_step,
_counter_ccStep,
_mode_var1,
_mode_color,
_mode_delay;
double double
_cronixieSecMultiplier; _cronixieSecMultiplier;
unsigned long boolean
_mode_last_call_time; _running,
_rgbwMode,
_reverseMode,
_cronixieMode,
_cronixieBacklightEnabled,
_skipFirstMode,
_triggered;
mode_ptr byte* _locked;
_mode[MODE_COUNT]; byte* _cronixieDigits;
mode_ptr _mode[MODE_COUNT]; // SRAM footprint: 4 bytes per element
uint8_t _segment_index = 0;
uint8_t _num_segments = 1;
segment _segments[MAX_NUM_SEGMENTS] = { // SRAM footprint: 20 bytes per element
// start, stop, speed, intensity, mode, options, color[]
{ 0, 7, DEFAULT_SPEED, 128, FX_MODE_STATIC, NO_OPTIONS, {DEFAULT_COLOR}}
};
segment_runtime _segment_runtimes[MAX_NUM_SEGMENTS]; // SRAM footprint: 17 bytes per element
}; };
#endif #endif

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.7.1</title> <title>WLED 0.8.0-a</title>
<script> <script>
var d=document; var d=document;
var w=window.getComputedStyle(d.querySelector("html")); var w=window.getComputedStyle(d.querySelector("html"));
@ -120,16 +120,9 @@
d.Cf.SB.value=b; d.Cf.SB.value=b;
GC(); GC();
} }
function GetCC() function GP()
{ {
resp+="&CP="; resp+= "&FP=" + Cf.TX.selectedIndex;
resp+=d.Cf.PF.value;
resp+="&CS=";
resp+=d.Cf.SF.value;
resp+="&CM=";
resp+=d.Cf.HF.value;
resp+=(d.Cf.SC.checked)?"&CF=1":"&CF=0";
resp+=(d.Cf.EC.checked)?"&CE=1":"&CE=0";
GIO(); GIO();
} }
function CV(v) function CV(v)
@ -178,8 +171,8 @@
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;
ccX.style.display=(Cf.TX.selectedIndex>52)?"block":"none"; fpX.style.display=(Cf.TX.selectedIndex>64)?"block":"none";
fof.style.fill=(Cf.TX.selectedIndex>52)?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;
} }
function TgT() function TgT()
@ -198,10 +191,10 @@
function SwFX(s) function SwFX(s)
{ {
var n=Cf.TX.selectedIndex+s; var n=Cf.TX.selectedIndex+s;
if (n==-1||n==58) return; if (n==-1||n==72) return;
Cf.TX.selectedIndex =n; Cf.TX.selectedIndex =n;
if (n < 0) Cf.TX.selectedIndex = 0; if (n < 0) Cf.TX.selectedIndex = 0;
if (n > 57) Cf.TX.selectedIndex = 53; if (n > 71) Cf.TX.selectedIndex = 65;
GX(); GX();
} }
function TgHSB() function TgHSB()
@ -598,7 +591,7 @@
<option value="3">Wipe (3)</option> <option value="3">Wipe (3)</option>
<option value="4">Wipe Random (4)</option> <option value="4">Wipe Random (4)</option>
<option value="5">Color R (5)</option> <option value="5">Color R (5)</option>
<option value="6">Easter (6)</option> <option value="6">Sweep (6)</option>
<option value="7">Dynamic (7)</option> <option value="7">Dynamic (7)</option>
<option value="8">Colorloop (8)</option> <option value="8">Colorloop (8)</option>
<option value="9">Rainbow (9)</option> <option value="9">Rainbow (9)</option>
@ -645,11 +638,25 @@
<option value="50">Wipe OO (50)</option> <option value="50">Wipe OO (50)</option>
<option value="51">Wipe OI (51)</option> <option value="51">Wipe OI (51)</option>
<option value="52">Circus (52)</option> <option value="52">Circus (52)</option>
<option value="53">Custom Chase (53)</option> <option value="53">Halloween (53)</option>
<option value="54">CC Colorloop (54)</option> <option value="54">Tricolor Chase (54)</option>
<option value="55">CC Rainbow (55)</option> <option value="55">Tricolor Wipe (55)</option>
<option value="56">CC Blink (56)</option> <option value="56">Tricolor Fade (56)</option>
<option value="57">CC Random (57)</option> <option value="57">Lighting (57)</option>
<option value="58">ICU (58)</option>
<option value="59">Multi Comet (59)</option>
<option value="60">Scanner x2 (60)</option>
<option value="61">Random Chase (61)</option>
<option value="62">Oscillate (62)</option>
<option value="63">Fire 2012 (63)</option>
<option value="64">Juggle (64)</option>
<option value="65">Palette (65)</option>
<option value="66">BPM (66)</option>
<option value="67">Fill Noise 8 (67)</option>
<option value="68">Noise 16 1 (68)</option>
<option value="69">Noise 16 2 (69)</option>
<option value="70">Noise 16 3 (70)</option>
<option value="71">Noise 16 4 (71)</option>
</select><br><br> </select><br><br>
Set secondary color to Set secondary color to
<button type="button" onclick="CS(0)">White</button> <button type="button" onclick="CS(0)">White</button>
@ -658,12 +665,22 @@
<button type="button" onclick="CS(3)">Primary</button> <button type="button" onclick="CS(3)">Primary</button>
<button type="button" onclick="CS(4)">Swap P/S</button> <button type="button" onclick="CS(4)">Swap P/S</button>
or <button type="button" onclick="CS(5)">Set Primary to Random</button> or <button type="button" onclick="CS(5)">Set Primary to Random</button>
<div id="ccX"> <div id="fpX">
<br>Custom Theater Chase<br> <br>FastLED Palette<br><br>
using <input id="ccP" name="PF" type="number" value="2" min="0" max="255" step="1" onchange="GetCC()"> primary and <select name="FP" onchange="GP()">
<input id="ccS" name ="SF" type="number" value="4" min="0" max="255" step="1" onchange="GetCC()"> secondary color LEDs,<br> <option value="0" selected>Random Cycle</option>
doing <input id="ccH" name="HF" type="number" value="1" min="0" max="255" step="1" onchange="GetCC()"> steps per tick, <option value="1">Primary Color Only</option>
from <input type="checkbox" onchange="GetCC()" name="SC"> start and <input type="checkbox" onchange="GetCC()" name="EC"> end. <option value="2">Based on Primary</option>
<option value="3">Set Colors Only</option>
<option value="4">Based on Set Colors</option>
<option value="5">Party Colors</option>
<option value="6">Cloud Colors</option>
<option value="7">Lava Colors</option>
<option value="8">Ocean Colors</option>
<option value="9">Forest Colors</option>
<option value="10">Rainbow</option>
<option value="11">Rainbow Stripe</option>
</select>
</div> </div>
<div id="slX" class="sl"> <div id="slX" class="sl">
<input type="range" title="Effect Speed" class="sds" name="SX" value="0" min="0" max="255" step="1" onchange="GX()"></div> <input type="range" title="Effect Speed" class="sds" name="SX" value="0" min="0" max="255" step="1" onchange="GX()"></div>

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -110,7 +110,6 @@ Use Gamma correction for color: <input type="checkbox" name="GC"><br>
Brightness factor: <input name="BF" type="number" min="0" max="255" required> % Brightness factor: <input name="BF" type="number" min="0" max="255" required> %
<h3>Transitions</h3> <h3>Transitions</h3>
Fade: <input type="checkbox" name="TF"><br> Fade: <input type="checkbox" name="TF"><br>
Sweep: <input type="checkbox" name="TS"> Invert direction: <input type="checkbox" name="TI"><br>
Transition Time: <input name="TD" maxlength="5" size="2"> ms<br> Transition Time: <input name="TD" maxlength="5" size="2"> ms<br>
Enable transition for secondary color: <input type="checkbox" name="T2"><br> Enable transition for secondary color: <input type="checkbox" name="T2"><br>
<h3>Timed light</h3> <h3>Timed light</h3>
@ -278,10 +277,9 @@ Current local time is <span class="times">unknown</span>.
Clock Overlay: Clock Overlay:
<select name="OL" onchange="Cs()"> <select name="OL" onchange="Cs()">
<option value="0" id="cn" selected>None</option> <option value="0" id="cn" selected>None</option>
<option value="1">Static color</option> <option value="1" id="ca">Analog Clock</option>
<option value="2" id="ca">Analog Clock</option> <option value="2">Single Digit Clock</option>
<option value="3">Single Digit Clock</option> <option value="3" id="cc">Cronixie Clock</option>
<option value="4" id="cc">Cronixie Clock</option>
</select><br> </select><br>
<div id="coc"> <div id="coc">
First LED: <input name="O1" type="number" min="0" max="255" required> Last LED: <input name="O2" type="number" min="0" max="255" required><br> First LED: <input name="O1" type="number" min="0" max="255" required> Last LED: <input name="O2" type="number" min="0" max="255" required><br>
@ -358,7 +356,7 @@ HTTP traffic is unencrypted. An attacker in the same network can intercept form
<button type="button" onclick="U()">Manual OTA Update</button><br> <button type="button" onclick="U()">Manual OTA Update</button><br>
Enable ArduinoOTA: <input type="checkbox" name="AO"><br> Enable ArduinoOTA: <input type="checkbox" name="AO"><br>
<h3>About</h3> <h3>About</h3>
<a href="https://github.com/Aircoookie/WLED" target="_blank">WLED</a> version 0.7.1<br><br> <a href="https://github.com/Aircoookie/WLED" target="_blank">WLED</a> version 0.8.0-a<br><br>
<b>Contributors:</b><br> <b>Contributors:</b><br>
StormPie <i>(Mobile HTML UI)</i><br><br> StormPie <i>(Mobile HTML UI)</i><br><br>
Thank you so much!<br><br> Thank you so much!<br><br>

View File

@ -3,7 +3,7 @@
*/ */
/* /*
* @title WLED project sketch * @title WLED project sketch
* @version 0.7.1 * @version 0.8.0-a
* @author Christian Schwinne * @author Christian Schwinne
*/ */
@ -39,8 +39,8 @@
#include "src/dependencies/e131/E131.h" #include "src/dependencies/e131/E131.h"
//version in format yymmddb (b = daily build) //version in format yymmddb (b = daily build)
#define VERSION 1808111 #define VERSION 1809041
char versionString[] = "0.7.1"; char versionString[] = "0.8.0-a";
//AP and OTA default passwords (change them!) //AP and OTA default passwords (change them!)
char apPass[65] = "wled1234"; char apPass[65] = "wled1234";
@ -53,7 +53,7 @@ char otaPass[33] = "wledota";
//#define DEBUG //#define DEBUG
//Hardware-settings (only changeble via code) //Hardware-settings (only changeble via code)
#define PIN 2 //strip pin. Only change for ESP32 //strip pin changeable in NpbWrapper.h. Only change for ESP32
byte buttonPin = 0; //needs pull-up byte buttonPin = 0; //needs pull-up
byte auxPin = 15; //use e.g. for external relay byte auxPin = 15; //use e.g. for external relay
byte auxDefaultState = 0; //0: input 1: high 2: low byte auxDefaultState = 0; //0: input 1: high 2: low
@ -87,7 +87,6 @@ byte whiteSecS = 0;
byte briS = 127; byte briS = 127;
byte nightlightTargetBri = 0; byte nightlightTargetBri = 0;
bool fadeTransition = true; bool fadeTransition = true;
bool sweepTransition = false, sweepDirection = true;
bool disableSecTransition = true; bool disableSecTransition = true;
uint16_t transitionDelay = 1200, transitionDelayDefault = transitionDelay; uint16_t transitionDelay = 1200, transitionDelayDefault = transitionDelay;
bool reverseMode = false; bool reverseMode = false;
@ -103,17 +102,10 @@ uint16_t udpPort = 21324, udpRgbPort = 19446;
byte effectDefault = 0; byte effectDefault = 0;
byte effectSpeedDefault = 75; byte effectSpeedDefault = 75;
byte effectIntensityDefault = 128; byte effectIntensityDefault = 128;
byte effectPaletteDefault = 0;
//NTP stuff //NTP stuff
bool ntpEnabled = false; bool ntpEnabled = false;
char ntpServerName[] = "0.wled.pool.ntp.org"; char ntpServerName[] = "0.wled.pool.ntp.org";
//custom chase
byte ccNumPrimary = 2;
byte ccNumSecondary = 4;
byte ccIndex1 = 0;
uint16_t ccIndex2 = ledCount -1;
bool ccFromStart = true, ccFromEnd = false;
byte ccStep = 1;
byte ccStart = 0;
//alexa //alexa
bool alexaEnabled = true; bool alexaEnabled = true;
@ -170,6 +162,7 @@ byte briNlT = 0;
byte effectCurrent = 0; byte effectCurrent = 0;
byte effectSpeed = 75; byte effectSpeed = 75;
byte effectIntensity = 128; byte effectIntensity = 128;
byte effectPalette = 0;
bool onlyAP = false; bool onlyAP = false;
bool udpConnected = false, udpRgbConnected = false; bool udpConnected = false, udpRgbConnected = false;
char cssCol[9][5]={"","","","","",""}; char cssCol[9][5]={"","","","","",""};

View File

@ -15,6 +15,7 @@
//5 -> 0.5.1 and up //5 -> 0.5.1 and up
//6 -> 0.6.0 and up //6 -> 0.6.0 and up
//7 -> 0.7.1 and up //7 -> 0.7.1 and up
//8 -> 0.8.0 and up
/* /*
* Erase all configuration data * Erase all configuration data
@ -119,8 +120,7 @@ void saveSettingsToEEPROM()
EEPROM.write(370, useHSBDefault); EEPROM.write(370, useHSBDefault);
EEPROM.write(371, whiteS); EEPROM.write(371, whiteS);
EEPROM.write(372, useRGBW); EEPROM.write(372, useRGBW);
EEPROM.write(373, sweepTransition);
EEPROM.write(374, sweepDirection);
EEPROM.write(375, apWaitTimeSecs); EEPROM.write(375, apWaitTimeSecs);
EEPROM.write(376, recoveryAPDisabled); EEPROM.write(376, recoveryAPDisabled);
EEPROM.write(377, EEPVER); //eeprom was updated to latest EEPROM.write(377, EEPVER); //eeprom was updated to latest
@ -128,13 +128,7 @@ void saveSettingsToEEPROM()
EEPROM.write(379, colSecS[1]); EEPROM.write(379, colSecS[1]);
EEPROM.write(380, colSecS[2]); EEPROM.write(380, colSecS[2]);
EEPROM.write(381, whiteSecS); EEPROM.write(381, whiteSecS);
EEPROM.write(382, ccIndex1);
EEPROM.write(383, ccIndex2);
EEPROM.write(384, ccNumPrimary);
EEPROM.write(385, ccNumSecondary);
EEPROM.write(386, ccFromStart);
EEPROM.write(387, ccFromEnd);
EEPROM.write(388, ccStep);
EEPROM.write(389, bootPreset); EEPROM.write(389, bootPreset);
EEPROM.write(390, aOtaEnabled); EEPROM.write(390, aOtaEnabled);
EEPROM.write(391, receiveNotificationColor); EEPROM.write(391, receiveNotificationColor);
@ -344,6 +338,8 @@ void loadSettingsFromEEPROM(bool first)
useGammaCorrectionBri = EEPROM.read(330); useGammaCorrectionBri = EEPROM.read(330);
useGammaCorrectionRGB = EEPROM.read(331); useGammaCorrectionRGB = EEPROM.read(331);
overlayDefault = EEPROM.read(332); overlayDefault = EEPROM.read(332);
if (lastEEPROMversion < 8 && overlayDefault > 0) overlayDefault--; //overlay mode 1 (solid) was removed
alexaEnabled = EEPROM.read(333); alexaEnabled = EEPROM.read(333);
for (int i = 334; i < 366; ++i) for (int i = 334; i < 366; ++i)
@ -358,8 +354,7 @@ void loadSettingsFromEEPROM(bool first)
useHSBDefault = EEPROM.read(370); useHSBDefault = EEPROM.read(370);
whiteS = EEPROM.read(371); white = whiteS; whiteS = EEPROM.read(371); white = whiteS;
useRGBW = EEPROM.read(372); useRGBW = EEPROM.read(372);
sweepTransition = EEPROM.read(373);
sweepDirection = EEPROM.read(374);
if (lastEEPROMversion > 0) { if (lastEEPROMversion > 0) {
apWaitTimeSecs = EEPROM.read(375); apWaitTimeSecs = EEPROM.read(375);
recoveryAPDisabled = EEPROM.read(376); recoveryAPDisabled = EEPROM.read(376);
@ -369,15 +364,7 @@ void loadSettingsFromEEPROM(bool first)
colSecS[0] = EEPROM.read(378); colSec[0] = colSecS[0]; colSecS[0] = EEPROM.read(378); colSec[0] = colSecS[0];
colSecS[1] = EEPROM.read(379); colSec[1] = colSecS[1]; colSecS[1] = EEPROM.read(379); colSec[1] = colSecS[1];
colSecS[2] = EEPROM.read(380); colSec[2] = colSecS[2]; colSecS[2] = EEPROM.read(380); colSec[2] = colSecS[2];
whiteSecS = EEPROM.read(381); whiteSec = whiteSecS; whiteSecS = EEPROM.read(381); whiteSec = whiteSecS;
ccIndex1 = EEPROM.read(382);
ccIndex2 = EEPROM.read(383);
ccNumPrimary = EEPROM.read(384);
ccNumSecondary = EEPROM.read(385);
ccFromStart = EEPROM.read(386);
ccFromEnd = EEPROM.read(387);
ccStep = EEPROM.read(388);
strip.setCustomChase(ccIndex1, ccIndex2, ccStart, ccNumPrimary, ccNumSecondary, ccStep, ccFromStart, ccFromEnd);
} }
if (lastEEPROMversion > 3) { if (lastEEPROMversion > 3) {
effectIntensityDefault = EEPROM.read(326); effectIntensity = effectIntensityDefault; effectIntensityDefault = EEPROM.read(326); effectIntensity = effectIntensityDefault;
@ -545,12 +532,6 @@ void applyPreset(byte index, bool loadBri, bool loadCol, bool loadFX)
effectCurrent = EEPROM.read(i+10); effectCurrent = EEPROM.read(i+10);
effectSpeed = EEPROM.read(i+11); effectSpeed = EEPROM.read(i+11);
effectIntensity = EEPROM.read(i+16); effectIntensity = EEPROM.read(i+16);
ccNumPrimary = EEPROM.read(i+12);
ccNumSecondary = EEPROM.read(i+13);
ccFromEnd = EEPROM.read(i+14);
ccFromStart = (EEPROM.read(i+14)<2);
ccStep = EEPROM.read(i+15);
strip.setCustomChase(ccIndex1, ccIndex2, ccStart, ccNumPrimary, ccNumSecondary, ccStep, ccFromStart, ccFromEnd);
if (lastfx != effectCurrent) strip.setMode(effectCurrent); if (lastfx != effectCurrent) strip.setMode(effectCurrent);
strip.setSpeed(effectSpeed); strip.setSpeed(effectSpeed);
strip.setIntensity(effectIntensity); strip.setIntensity(effectIntensity);
@ -574,13 +555,7 @@ void savePreset(byte index)
EEPROM.write(i+9, whiteSec); EEPROM.write(i+9, whiteSec);
EEPROM.write(i+10, effectCurrent); EEPROM.write(i+10, effectCurrent);
EEPROM.write(i+11, effectSpeed); EEPROM.write(i+11, effectSpeed);
EEPROM.write(i+12, ccNumPrimary);
EEPROM.write(i+13, ccNumSecondary);
byte m = 1;
if (!ccFromStart) m = 2;
if (!ccFromEnd) m = 0;
EEPROM.write(i+14, m);
EEPROM.write(i+15, ccStep);
EEPROM.write(i+16, effectIntensity); EEPROM.write(i+16, effectIntensity);
EEPROM.commit(); EEPROM.commit();
} }

View File

@ -188,8 +188,6 @@ void getSettingsJS(byte subPage) //get values for settings form in javascript
sappend('c',"GB",useGammaCorrectionBri); sappend('c',"GB",useGammaCorrectionBri);
sappend('c',"GC",useGammaCorrectionRGB); sappend('c',"GC",useGammaCorrectionRGB);
sappend('c',"TF",fadeTransition); sappend('c',"TF",fadeTransition);
sappend('c',"TS",sweepTransition);
sappend('c',"TI",!sweepDirection);
sappend('v',"TD",transitionDelay); sappend('v',"TD",transitionDelay);
sappend('c',"T2",!disableSecTransition); sappend('c',"T2",!disableSecTransition);
sappend('v',"BF",briMultiplier); sappend('v',"BF",briMultiplier);

View File

@ -74,7 +74,6 @@ void handleSettingsSet(byte subPage)
if (ledCount > 600) ledCount = 600; if (ledCount > 600) ledCount = 600;
#endif #endif
} }
ccIndex2 = ledCount -1;
useRGBW = server.hasArg("EW"); useRGBW = server.hasArg("EW");
autoRGBtoRGBW = server.hasArg("AW"); autoRGBtoRGBW = server.hasArg("AW");
if (server.hasArg("IS")) //ignore settings and save current brightness, colors and fx as default if (server.hasArg("IS")) //ignore settings and save current brightness, colors and fx as default
@ -158,8 +157,6 @@ void handleSettingsSet(byte subPage)
useGammaCorrectionBri = server.hasArg("GB"); useGammaCorrectionBri = server.hasArg("GB");
useGammaCorrectionRGB = server.hasArg("GC"); useGammaCorrectionRGB = server.hasArg("GC");
fadeTransition = server.hasArg("TF"); fadeTransition = server.hasArg("TF");
sweepTransition = server.hasArg("TS");
sweepDirection = !server.hasArg("TI");
if (server.hasArg("TD")) if (server.hasArg("TD"))
{ {
int i = server.arg("TD").toInt(); int i = server.arg("TD").toInt();
@ -288,7 +285,7 @@ void handleSettingsSet(byte subPage)
if (server.hasArg("OL")){ if (server.hasArg("OL")){
overlayDefault = server.arg("OL").toInt(); overlayDefault = server.arg("OL").toInt();
overlayCurrent = overlayDefault; overlayCurrent = overlayDefault;
strip.unlockAll(); ;
} }
if (server.hasArg("O1")) overlayMin = server.arg("O1").toInt(); if (server.hasArg("O1")) overlayMin = server.arg("O1").toInt();
if (server.hasArg("O2")) overlayMax = server.arg("O2").toInt(); if (server.hasArg("O2")) overlayMax = server.arg("O2").toInt();
@ -357,7 +354,7 @@ void handleSettingsSet(byte subPage)
} }
} }
saveSettingsToEEPROM(); saveSettingsToEEPROM();
if (subPage == 2) strip.init(useRGBW,ledCount,PIN,skipFirstLed); if (subPage == 2) strip.init(useRGBW,ledCount,skipFirstLed);
} }
bool handleSet(String req) bool handleSet(String req)
@ -462,6 +459,7 @@ bool handleSet(String req)
colSec[2] = 255; colSec[2] = 255;
} }
} }
//set 2nd to black //set 2nd to black
pos = req.indexOf("SB"); pos = req.indexOf("SB");
if (pos > 0) { if (pos > 0) {
@ -470,6 +468,7 @@ bool handleSet(String req)
colSec[1] = 0; colSec[1] = 0;
colSec[2] = 0; colSec[2] = 0;
} }
//set to random hue SR=0->1st SR=1->2nd //set to random hue SR=0->1st SR=1->2nd
pos = req.indexOf("SR"); pos = req.indexOf("SR");
if (pos > 0) { if (pos > 0) {
@ -553,19 +552,6 @@ bool handleSet(String req)
overlayCurrent = req.substring(pos + 3).toInt(); overlayCurrent = req.substring(pos + 3).toInt();
strip.unlockAll(); strip.unlockAll();
} }
//set individual pixel (range) to current color
pos = req.indexOf("&I=");
if (pos > 0){
int index = req.substring(pos + 3).toInt();
pos = req.indexOf("I2=");
if (pos > 0){
int index2 = req.substring(pos + 3).toInt();
strip.setRange(index, index2);
} else
{
strip.setIndividual(index);
}
}
//(un)lock pixel (ranges) //(un)lock pixel (ranges)
pos = req.indexOf("&L="); pos = req.indexOf("&L=");
if (pos > 0){ if (pos > 0){
@ -591,6 +577,7 @@ bool handleSet(String req)
} }
} }
} }
//apply macro //apply macro
pos = req.indexOf("&M="); pos = req.indexOf("&M=");
if (pos > 0) { if (pos > 0) {
@ -605,6 +592,7 @@ bool handleSet(String req)
notifyDirect = false; notifyDirect = false;
} }
} }
//toggle receive UDP direct notifications //toggle receive UDP direct notifications
if (req.indexOf("RN=") > 0) if (req.indexOf("RN=") > 0)
{ {
@ -614,6 +602,7 @@ bool handleSet(String req)
receiveNotifications = false; receiveNotifications = false;
} }
} }
//toggle nightlight mode //toggle nightlight mode
bool aNlDef = false; bool aNlDef = false;
if (req.indexOf("&ND") > 0) aNlDef = true; if (req.indexOf("&ND") > 0) aNlDef = true;
@ -634,12 +623,14 @@ bool handleSet(String req)
nightlightActive = true; nightlightActive = true;
nightlightStartTime = millis(); nightlightStartTime = millis();
} }
//set nightlight target brightness //set nightlight target brightness
pos = req.indexOf("NT="); pos = req.indexOf("NT=");
if (pos > 0) { if (pos > 0) {
nightlightTargetBri = req.substring(pos + 3).toInt(); nightlightTargetBri = req.substring(pos + 3).toInt();
nightlightActiveOld = false; //re-init nightlightActiveOld = false; //re-init
} }
//toggle nightlight fade //toggle nightlight fade
if (req.indexOf("NF=") > 0) if (req.indexOf("NF=") > 0)
{ {
@ -651,6 +642,7 @@ bool handleSet(String req)
} }
nightlightActiveOld = false; //re-init nightlightActiveOld = false; //re-init
} }
//toggle general purpose output //toggle general purpose output
pos = req.indexOf("AX="); pos = req.indexOf("AX=");
if (pos > 0) { if (pos > 0) {
@ -662,6 +654,7 @@ bool handleSet(String req)
if (pos > 0) { if (pos > 0) {
transitionDelay = req.substring(pos + 3).toInt(); transitionDelay = req.substring(pos + 3).toInt();
} }
//main toggle on/off //main toggle on/off
pos = req.indexOf("&T="); pos = req.indexOf("&T=");
if (pos > 0) { if (pos > 0) {
@ -679,6 +672,7 @@ bool handleSet(String req)
} }
} }
} }
//deactivate nightlight if target brightness is reached //deactivate nightlight if target brightness is reached
if (bri == nightlightTargetBri) nightlightActive = false; if (bri == nightlightTargetBri) nightlightActive = false;
//set time (unix timestamp) //set time (unix timestamp)
@ -686,6 +680,7 @@ bool handleSet(String req)
if (pos > 0) { if (pos > 0) {
setTime(req.substring(pos+3).toInt()); setTime(req.substring(pos+3).toInt());
} }
//set countdown goal (unix timestamp) //set countdown goal (unix timestamp)
pos = req.indexOf("CT="); pos = req.indexOf("CT=");
if (pos > 0) { if (pos > 0) {
@ -693,19 +688,6 @@ bool handleSet(String req)
if (countdownTime - now() > 0) countdownOverTriggered = false; if (countdownTime - now() > 0) countdownOverTriggered = false;
} }
//set custom chase data
bool _cc_updated = false;
pos = req.indexOf("C0="); if (pos > 0) {ccStart = (req.substring(pos + 3).toInt()); _cc_updated = true;}
pos = req.indexOf("C1="); if (pos > 0) {ccIndex1 = (req.substring(pos + 3).toInt()); _cc_updated = true;}
pos = req.indexOf("C2="); if (pos > 0) {ccIndex2 = (req.substring(pos + 3).toInt()); _cc_updated = true;}
pos = req.indexOf("CP="); if (pos > 0) {ccNumPrimary = (req.substring(pos + 3).toInt()); _cc_updated = true;}
pos = req.indexOf("CS="); if (pos > 0) {ccNumSecondary = (req.substring(pos + 3).toInt()); _cc_updated = true;}
pos = req.indexOf("CM="); if (pos > 0) {ccStep = (req.substring(pos + 3).toInt()); _cc_updated = true;}
pos = req.indexOf("CF="); if (pos > 0) {ccFromStart = (req.substring(pos + 3).toInt()); _cc_updated = true;}
pos = req.indexOf("CE="); if (pos > 0) {ccFromEnd = (req.substring(pos + 3).toInt()); _cc_updated = true;}
if (ccIndex2 == 255) ccIndex2 = ledCount-1;
if (_cc_updated) strip.setCustomChase(ccIndex1, ccIndex2, ccStart, ccNumPrimary, ccNumSecondary, ccStep, ccFromStart, ccFromEnd);
//set presets //set presets
pos = req.indexOf("P1="); //sets first preset for cycle pos = req.indexOf("P1="); //sets first preset for cycle
if (pos > 0) presetCycleMin = req.substring(pos + 3).toInt(); if (pos > 0) presetCycleMin = req.substring(pos + 3).toInt();

View File

@ -11,7 +11,7 @@ void wledInit()
#ifdef ARDUINO_ARCH_ESP32 #ifdef ARDUINO_ARCH_ESP32
if (ledCount > 600) ledCount = 600; if (ledCount > 600) ledCount = 600;
#endif #endif
if (!EEPROM.read(397)) strip.init(EEPROM.read(372),ledCount,PIN,EEPROM.read(2204)); //quick init if (!EEPROM.read(397)) strip.init(EEPROM.read(372),ledCount,EEPROM.read(2204)); //quick init
Serial.begin(115200); Serial.begin(115200);
Serial.setTimeout(50); Serial.setTimeout(50);
@ -273,11 +273,10 @@ void wledInit()
void initStrip() void initStrip()
{ {
// Initialize NeoPixel Strip and button // Initialize NeoPixel Strip and button
if (initLedsLast) strip.init(useRGBW,ledCount,PIN,skipFirstLed); if (initLedsLast) strip.init(useRGBW,ledCount,skipFirstLed);
strip.setReverseMode(reverseMode); strip.setReverseMode(reverseMode);
strip.setColor(0); strip.setColor(0);
strip.setBrightness(255); strip.setBrightness(255);
strip.start();
pinMode(buttonPin, INPUT_PULLUP); pinMode(buttonPin, INPUT_PULLUP);
pinMode(4,OUTPUT); //this is only needed in special cases pinMode(4,OUTPUT); //this is only needed in special cases
@ -572,11 +571,11 @@ void getBuildInfo()
oappend("\r\n"); oappend("\r\n");
#ifdef ARDUINO_ARCH_ESP32 #ifdef ARDUINO_ARCH_ESP32
oappend("strip-pin: gpio"); oappend("strip-pin: gpio");
oappendi(PIN); oappendi(LEDPIN);
#else #else
oappend("strip-pin: gpio2"); oappend("strip-pin: gpio2");
#endif #endif
oappend("\r\nbuild-type: src\r\n"); oappend("\r\nbuild-type: dev\r\n");
} }
bool checkClientIsMobile(String useragent) bool checkClientIsMobile(String useragent)

View File

@ -93,7 +93,7 @@ void colorUpdated(int callMode)
briIT = bri; briIT = bri;
if (bri > 0) briLast = bri; if (bri > 0) briLast = bri;
notify(callMode); notify(callMode);
if (fadeTransition || sweepTransition) if (fadeTransition)
{ {
//set correct delay if not using notification delay //set correct delay if not using notification delay
if (callMode != 3) transitionDelayTemp = transitionDelay; if (callMode != 3) transitionDelayTemp = transitionDelay;
@ -114,7 +114,6 @@ void colorUpdated(int callMode)
} }
transitionActive = true; transitionActive = true;
transitionStartTime = millis(); transitionStartTime = millis();
strip.setFastUpdateMode(true);
} else } else
{ {
setLedsStandard(); setLedsStandard();
@ -132,9 +131,7 @@ void handleTransitions()
{ {
transitionActive = false; transitionActive = false;
tperLast = 0; tperLast = 0;
if (sweepTransition) strip.unlockAll();
setLedsStandard(); setLedsStandard();
strip.setFastUpdateMode(false);
return; return;
} }
if (tper - tperLast < 0.004) if (tper - tperLast < 0.004)
@ -153,21 +150,7 @@ void handleTransitions()
whiteSecT = whiteSecOld +((whiteSec - whiteSecOld )*tper); whiteSecT = whiteSecOld +((whiteSec - whiteSecOld )*tper);
briT = briOld +((bri - briOld )*tper); briT = briOld +((bri - briOld )*tper);
} }
if (sweepTransition) //TODO: properly remove sweep transition
{
strip.lockAll();
if (sweepDirection)
{
strip.unlockRange(0, (int)(tper*(double)ledCount));
} else
{
strip.unlockRange(ledCount - (int)(tper*(double)ledCount), ledCount);
}
if (!fadeTransition)
{
setLedsStandard();
}
}
if (fadeTransition) setAllLeds(); if (fadeTransition) setAllLeds();
} }
} }

View File

@ -125,24 +125,15 @@ void handleOverlays()
switch (overlayCurrent) switch (overlayCurrent)
{ {
case 0: break;//no overlay case 0: break;//no overlay
case 1: _overlaySolid(); break;//solid secondary color case 1: _overlayAnalogClock(); break;//2 analog clock
case 2: _overlayAnalogClock(); break;//2 analog clock case 2: _overlayNixieClock(); break;//nixie 1-digit
case 3: _overlayNixieClock(); break;//nixie 1-digit case 3: _overlayCronixie();//Diamex cronixie clock kit
case 4: _overlayCronixie();//Diamex cronixie clock kit
} }
if (!countdownMode || overlayCurrent < 2) checkCountdown(); //countdown macro activation must work if (!countdownMode || overlayCurrent < 2) checkCountdown(); //countdown macro activation must work
overlayRefreshedTime = millis(); overlayRefreshedTime = millis();
} }
} }
void _overlaySolid()
{
strip.unlockAll();
uint32_t cls = (useGammaCorrectionRGB)? gamma8[whiteSec*16777216] + gamma8[colSec[0]]*65536 + gamma8[colSec[1]]*256 + gamma8[colSec[2]]:whiteSec*16777216 + colSec[0]*65536 + colSec[1]*256 + colSec[2];
strip.setRange(overlayMin,overlayMax,cls);
overlayRefreshMs = 1902;
}
void _overlayAnalogClock() void _overlayAnalogClock()
{ {
int overlaySize = overlayMax - overlayMin +1; int overlaySize = overlayMax - overlayMin +1;
@ -151,7 +142,6 @@ void _overlayAnalogClock()
{ {
_overlayAnalogCountdown(); return; _overlayAnalogCountdown(); return;
} }
_overlaySolid();
double hourP = ((double)(hour(local)%12))/12; double hourP = ((double)(hour(local)%12))/12;
double minuteP = ((double)minute(local))/60; double minuteP = ((double)minute(local))/60;
hourP = hourP + minuteP/12; hourP = hourP + minuteP/12;

View File

@ -58,18 +58,21 @@ BLYNK_WRITE(V3)
BLYNK_WRITE(V4) BLYNK_WRITE(V4)
{ {
effectCurrent = param.asInt()-1;//fx effectCurrent = param.asInt()-1;//fx
colorUpdated(9); strip.setMode(effectCurrent);
colorUpdated(6);
} }
BLYNK_WRITE(V5) BLYNK_WRITE(V5)
{ {
effectSpeed = param.asInt();//sx effectSpeed = param.asInt();//sx
strip.setSpeed(effectSpeed);
colorUpdated(6); colorUpdated(6);
} }
BLYNK_WRITE(V6) BLYNK_WRITE(V6)
{ {
effectIntensity = param.asInt();//ix effectIntensity = param.asInt();//ix
strip.setIntensity(effectIntensity);
colorUpdated(6); colorUpdated(6);
} }