commit
640188f4e2
@ -1,11 +1,11 @@
|
||||
![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)
|
||||
|
||||
A fast and feature-rich implementation of an ESP8266/ESP32 webserver to control NeoPixel (WS2812B) LEDs!
|
||||
|
||||
### Features:
|
||||
- WS2812FX library integrated for over 70 special effects
|
||||
- WS2812FX library integrated for 75 special effects
|
||||
- FastLED noise effects and palettes
|
||||
- Customizable Mobile and desktop UI with color and effect controls
|
||||
- Settings page - configuration over network
|
||||
|
@ -2,25 +2,32 @@
|
||||
#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
|
||||
|
||||
#define LEDPIN 2 //strip pin. Only effective for ESP32, ESP8266 must use gpio2
|
||||
#define LEDPIN 2 //strip pin. Any for ESP32, gpio2 is recommended for ESP8266
|
||||
|
||||
//uncomment this if red and green are swapped
|
||||
//#define SWAPRG
|
||||
|
||||
//automatically uses the right driver method for each platform
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
#ifdef WORKAROUND_ESP32_BITBANG
|
||||
#define PIXELMETHOD NeoEsp32BitBangWs2813Method
|
||||
#else
|
||||
#define PIXELMETHOD NeoEsp32RmtWS2813_V3Method
|
||||
#endif
|
||||
#ifdef WORKAROUND_ESP32_BITBANG
|
||||
#define PIXELMETHOD NeoEsp32BitBangWs2813Method
|
||||
#pragma message "Software BitBang is used because of your NeoPixelBus version. Look in NpbWrapper.h for instructions on how to mitigate flickering."
|
||||
#else
|
||||
#define PIXELMETHOD NeoEsp32RmtWS2813_V3Method
|
||||
#endif
|
||||
#else //esp8266
|
||||
//you may change to DMA method on pin GPIO3 here
|
||||
#define PIXELMETHOD NeoEsp8266Uart800KbpsMethod
|
||||
//#define PIXELMETHOD NeoEsp8266Dma800KbpsMethod
|
||||
//autoselect the right method depending on strip pin
|
||||
#if LEDPIN == 2
|
||||
#define PIXELMETHOD NeoEsp8266Uart800KbpsMethod
|
||||
#elif LEDPIN == 3
|
||||
#define PIXELMETHOD NeoEsp8266Dma800KbpsMethod
|
||||
#else
|
||||
#define PIXELMETHOD NeoEsp8266BitBang800KbpsMethod
|
||||
#pragma message "Software BitBang will be used because of your selected LED pin. This may cause flicker. Use GPIO 2 or 3 for best results."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//handle swapping Red and Green automatically
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -40,6 +40,7 @@
|
||||
#define WS2812FX_h
|
||||
|
||||
#include "NpbWrapper.h"
|
||||
#include "FastLED.h"
|
||||
|
||||
#define DEFAULT_BRIGHTNESS (uint8_t)50
|
||||
#define DEFAULT_MODE (uint8_t)0
|
||||
@ -82,7 +83,7 @@
|
||||
#define REVERSE (uint8_t)0x80
|
||||
#define IS_REVERSE ((SEGMENT.options & REVERSE) == REVERSE)
|
||||
|
||||
#define MODE_COUNT 74
|
||||
#define MODE_COUNT 76
|
||||
|
||||
#define FX_MODE_STATIC 0
|
||||
#define FX_MODE_BLINK 1
|
||||
@ -159,6 +160,8 @@
|
||||
#define FX_MODE_NOISE16_2 71
|
||||
#define FX_MODE_NOISE16_3 72
|
||||
#define FX_MODE_NOISE16_4 73
|
||||
#define FX_MODE_COLORTWINKLE 74
|
||||
#define FX_MODE_LAKE 75
|
||||
|
||||
class WS2812FX {
|
||||
typedef uint16_t (WS2812FX::*mode_ptr)(void);
|
||||
@ -261,6 +264,8 @@ class WS2812FX {
|
||||
_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[FX_MODE_COLORTWINKLE] = &WS2812FX::mode_colortwinkle;
|
||||
_mode[FX_MODE_LAKE] = &WS2812FX::mode_lake;
|
||||
|
||||
_brightness = DEFAULT_BRIGHTNESS;
|
||||
_running = false;
|
||||
@ -327,6 +332,7 @@ class WS2812FX {
|
||||
|
||||
uint32_t
|
||||
color_wheel(uint8_t),
|
||||
color_from_palette(uint16_t, bool, bool, uint8_t, uint8_t pbri = 255),
|
||||
color_blend(uint32_t,uint32_t,uint8_t),
|
||||
getPixelColor(uint16_t),
|
||||
getColor(void);
|
||||
@ -346,12 +352,13 @@ class WS2812FX {
|
||||
|
||||
// mode helper functions
|
||||
uint16_t
|
||||
blink(uint32_t, uint32_t, bool strobe),
|
||||
color_wipe(uint32_t, uint32_t, bool),
|
||||
theater_chase(uint32_t, uint32_t),
|
||||
blink(uint32_t, uint32_t, bool strobe, bool),
|
||||
color_wipe(uint32_t, uint32_t, bool , bool),
|
||||
scan(bool),
|
||||
theater_chase(uint32_t, uint32_t, bool),
|
||||
twinkle(uint32_t),
|
||||
twinkle_fade(uint32_t),
|
||||
chase(uint32_t, uint32_t, uint32_t),
|
||||
chase(uint32_t, uint32_t, uint32_t, uint8_t),
|
||||
running(uint32_t, uint32_t),
|
||||
fireworks(uint32_t),
|
||||
tricolor_chase(uint32_t, uint32_t, uint32_t);
|
||||
@ -432,16 +439,21 @@ class WS2812FX {
|
||||
mode_noise16_2(void),
|
||||
mode_noise16_3(void),
|
||||
mode_noise16_4(void),
|
||||
mode_colortwinkle(void),
|
||||
mode_lake(void),
|
||||
mode_lightning(void);
|
||||
|
||||
private:
|
||||
NeoPixelWrapper *bus;
|
||||
|
||||
CRGB fastled_from_col(uint32_t);
|
||||
|
||||
uint16_t _length;
|
||||
uint16_t _rand16seed;
|
||||
uint8_t _brightness;
|
||||
|
||||
void handle_palette(void);
|
||||
bool modeUsesLock(uint8_t);
|
||||
|
||||
double
|
||||
_cronixieSecMultiplier;
|
||||
|
@ -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"));
|
||||
@ -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;
|
||||
}
|
||||
@ -192,10 +192,10 @@
|
||||
function SwFX(s)
|
||||
{
|
||||
var n=Cf.TX.selectedIndex+s;
|
||||
if (n==-1||n==74) return;
|
||||
if (n==-1||n==76) return;
|
||||
Cf.TX.selectedIndex =n;
|
||||
if (n < 0) Cf.TX.selectedIndex = 0;
|
||||
if (n > 73) Cf.TX.selectedIndex = 65;
|
||||
if (n > 75) Cf.TX.selectedIndex = 65;
|
||||
GX();
|
||||
}
|
||||
function TgHSB()
|
||||
@ -660,6 +660,8 @@
|
||||
<option value="71">Noise 16 2 (71)</option>
|
||||
<option value="72">Noise 16 3 (72)</option>
|
||||
<option value="73">Noise 16 4 (73)</option>
|
||||
<option value="74">Colortwinkle (74)</option>
|
||||
<option value="75">Lake (75)</option>
|
||||
</select><br><br>
|
||||
Set secondary color to
|
||||
<button type="button" onclick="CS(0)">White</button>
|
||||
@ -716,6 +718,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">
|
||||
|
@ -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 {
|
||||
@ -432,7 +432,9 @@
|
||||
<li onclick="X(70)">Noise 16 1</li>
|
||||
<li onclick="X(71)">Noise 16 2</li>
|
||||
<li onclick="X(72)">Noise 16 3</li>
|
||||
<li onclick="X(73)">Noise 16 4</li>
|
||||
<li onclick="X(73)">Noise 16 4</li>
|
||||
<li onclick="X(74)">Colortwinkle</li>
|
||||
<li onclick="X(75)">Colortwinkle</li>
|
||||
<li><a href="#">Go to top</a></li>
|
||||
<p style="margin-left:-37px">FastLED Palette (Effects 56-73)</p>
|
||||
<li onclick="P(0)">Default</li>
|
||||
@ -480,6 +482,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>
|
||||
|
||||
<li><a href="#">Go to top</a></li></div>
|
||||
<iframe id="stf" onload="feedback();" style="display:none;"></iframe>
|
||||
|
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -237,7 +237,7 @@ Send notifications twice: <input type="checkbox" name="S2"><br>
|
||||
Receive UDP realtime: <input type="checkbox" name="RD"><br><br>
|
||||
<i>E1.31 (sACN)</i><br>
|
||||
Use E1.31 multicast: <input type="checkbox" name="EM"><br>
|
||||
E1.31 universe: <input name="EU" type="number" min="1" max="63999" required><br>
|
||||
E1.31 start universe: <input name="EU" type="number" min="1" max="63999" required><br>
|
||||
<i>Reboot required.</i> Check out <a href="https://github.com/ahodges9/LedFx" target="_blank">LedFx</a>!<br><br>
|
||||
Timeout: <input name="ET" type="number" min="1" max="65000" required> ms<br>
|
||||
Force max brightness: <input type="checkbox" name="FB"><br>
|
||||
@ -411,7 +411,7 @@ HTTP traffic is unencrypted. An attacker in the same network can intercept form
|
||||
<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.8.0<br><br>
|
||||
<a href="https://github.com/Aircoookie/WLED" target="_blank">WLED</a> version 0.8.1<br><br>
|
||||
<b>Contributors:</b><br>
|
||||
StormPie <i>(Mobile HTML UI)</i><br><br>
|
||||
Thank you so much!<br><br>
|
||||
|
@ -24,7 +24,7 @@ button{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),sans-seri
|
||||
|
||||
|
||||
//new user welcome page
|
||||
#ifndef WLED_FLASH_512K_MODE
|
||||
#ifndef WLED_DISABLE_MOBILE_UI
|
||||
const char PAGE_welcome0[] PROGMEM = R"=====(
|
||||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
|
@ -500,6 +500,42 @@ DEFINE_GRADIENT_PALETTE( Orange_Teal_gp ) {
|
||||
200, 255, 72, 0,
|
||||
255, 255, 72, 0};
|
||||
|
||||
//Custom palette by Aircoookie
|
||||
|
||||
DEFINE_GRADIENT_PALETTE( Tiamat_gp ) {
|
||||
0, 1, 2, 14, //gc
|
||||
33, 2, 5, 35, //gc from 47, 61,126
|
||||
100, 13,135, 92, //gc from 88,242,247
|
||||
120, 43,255,193, //gc from 135,255,253
|
||||
140, 247, 7,249, //gc from 252, 69,253
|
||||
160, 193, 17,208, //gc from 231, 96,237
|
||||
180, 39,255,154, //gc from 130, 77,213
|
||||
200, 4,213,236, //gc from 57,122,248
|
||||
220, 39,252,135, //gc from 177,254,255
|
||||
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
|
||||
@ -543,8 +579,10 @@ const TProgmemRGBGradientPalettePtr gGradientPalettes[] = {
|
||||
BlacK_Magenta_Red_gp, //41-28 Magred
|
||||
BlacK_Red_Magenta_Yellow_gp, //42-29 Yelmag
|
||||
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
|
||||
April_Night_gp //46-33 April Night
|
||||
};
|
||||
|
||||
|
||||
// Count of how many cpt-city gradients are defined:
|
||||
@ -552,4 +590,3 @@ const uint8_t gGradientPaletteCount =
|
||||
sizeof( gGradientPalettes) / sizeof( TProgmemRGBGradientPalettePtr );
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -3,15 +3,29 @@
|
||||
*/
|
||||
/*
|
||||
* @title WLED project sketch
|
||||
* @version 0.8.0
|
||||
* @version 0.8.1
|
||||
* @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 some of the following lines to disable features to compile for ESP8266-01 (max flash size 434kB):
|
||||
|
||||
//You are required to disable these two features:
|
||||
//#define WLED_DISABLE_MOBILE_UI
|
||||
//#define WLED_DISABLE_OTA
|
||||
|
||||
//You need to choose 1-2 of these features to disable:
|
||||
//#define WLED_DISABLE_ALEXA
|
||||
//#define WLED_DISABLE_BLYNK
|
||||
//#define WLED_DISABLE_CRONIXIE
|
||||
//#define WLED_DISABLE_HUESYNC
|
||||
|
||||
//to toggle usb serial debug (un)comment following line(s)
|
||||
//#define DEBUG
|
||||
|
||||
//library inclusions
|
||||
#include <Arduino.h>
|
||||
@ -28,14 +42,18 @@
|
||||
#endif
|
||||
|
||||
#include <EEPROM.h>
|
||||
#include <ArduinoOTA.h>
|
||||
#include <WiFiUDP.h>
|
||||
#include <DNSServer.h>
|
||||
#ifndef WLED_DISABLE_OTA
|
||||
#include <ArduinoOTA.h>
|
||||
#include "src/dependencies/webserver/ESP8266HTTPUpdateServer.h"
|
||||
#endif
|
||||
#include "src/dependencies/time/Time.h"
|
||||
#include "src/dependencies/time/TimeLib.h"
|
||||
#include "src/dependencies/timezone/Timezone.h"
|
||||
#ifndef WLED_DISABLE_BLYNK
|
||||
#include "src/dependencies/blynk/BlynkSimpleEsp.h"
|
||||
#endif
|
||||
#include "src/dependencies/e131/E131.h"
|
||||
#include "src/dependencies/pubsubclient/PubSubClient.h"
|
||||
#include "htmls00.h"
|
||||
@ -45,8 +63,8 @@
|
||||
|
||||
|
||||
//version code in format yymmddb (b = daily build)
|
||||
#define VERSION 1810151
|
||||
char versionString[] = "0.8.0";
|
||||
#define VERSION 1811071
|
||||
char versionString[] = "0.8.1";
|
||||
|
||||
|
||||
//AP and OTA default passwords (for maximum change them!)
|
||||
@ -54,10 +72,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
|
||||
|
||||
@ -375,7 +389,9 @@ HTTPClient* hueClient = NULL;
|
||||
WiFiClient* mqttTCPClient = NULL;
|
||||
PubSubClient* mqtt = NULL;
|
||||
|
||||
#ifndef WLED_DISABLE_OTA
|
||||
ESP8266HTTPUpdateServer httpUpdater;
|
||||
#endif
|
||||
|
||||
//udp interface objects
|
||||
WiFiUDP notifierUdp, rgbUdp;
|
||||
@ -491,7 +507,9 @@ void loop() {
|
||||
if (!realtimeActive) //block stuff if WARLS/Adalight is enabled
|
||||
{
|
||||
if (dnsActive) dnsServer.processNextRequest();
|
||||
#ifndef WLED_DISABLE_OTA
|
||||
if (aOtaEnabled) ArduinoOTA.handle();
|
||||
#endif
|
||||
handleNightlight();
|
||||
if (!onlyAP) {
|
||||
handleHue();
|
||||
@ -521,5 +539,3 @@ void loop() {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -446,7 +446,7 @@ void loadSettingsFromEEPROM(bool first)
|
||||
enableRealtimeUI = EEPROM.read(2201);
|
||||
uiConfiguration = EEPROM.read(2202);
|
||||
|
||||
#ifdef WLED_FLASH_512K_MODE
|
||||
#ifdef WLED_DISABLE_MOBILE_UI
|
||||
uiConfiguration = 1;
|
||||
//force default UI since mobile is unavailable
|
||||
#endif
|
||||
@ -567,7 +567,6 @@ String loadMacro(byte index)
|
||||
if (EEPROM.read(i) == 0) break;
|
||||
m += char(EEPROM.read(i));
|
||||
}
|
||||
if (m.charAt(0) < 65 || m.charAt(0) > 90) return ""; //do simple check if macro is valid (capital first letter)
|
||||
return m;
|
||||
}
|
||||
|
||||
@ -600,4 +599,3 @@ void saveMacro(byte index, String mc, bool sing=true) //only commit on single sa
|
||||
}
|
||||
if (sing) EEPROM.commit();
|
||||
}
|
||||
|
||||
|
@ -213,6 +213,7 @@ void handleSettingsSet(byte subPage)
|
||||
|
||||
if (server.hasArg("OL")){
|
||||
overlayDefault = server.arg("OL").toInt();
|
||||
if (overlayCurrent != overlayDefault) strip.unlockAll();
|
||||
overlayCurrent = overlayDefault;
|
||||
}
|
||||
|
||||
|
@ -86,6 +86,7 @@ void wledInit()
|
||||
|
||||
//init ArduinoOTA
|
||||
if (!onlyAP) {
|
||||
#ifndef WLED_DISABLE_OTA
|
||||
if (aOtaEnabled)
|
||||
{
|
||||
ArduinoOTA.onStart([]() {
|
||||
@ -97,6 +98,7 @@ void wledInit()
|
||||
if (strlen(cmDNS) > 0) ArduinoOTA.setHostname(cmDNS);
|
||||
ArduinoOTA.begin();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!initLedsLast) strip.service();
|
||||
// Set up mDNS responder:
|
||||
@ -138,6 +140,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(){
|
||||
@ -224,6 +227,25 @@ void getBuildInfo()
|
||||
oappendi(VERSION);
|
||||
oappend("\r\neepver: ");
|
||||
oappendi(EEPVER);
|
||||
oappend("\r\nopt: ");
|
||||
#ifndef WLED_DISABLE_ALEXA
|
||||
oappend("alexa ");
|
||||
#endif
|
||||
#ifndef WLED_DISABLE_BLYNK
|
||||
oappend("blynk ");
|
||||
#endif
|
||||
#ifndef WLED_DISABLE_CRONIXIE
|
||||
oappend("cronixie ");
|
||||
#endif
|
||||
#ifndef WLED_DISABLE_HUESYNC
|
||||
oappend("huesync ");
|
||||
#endif
|
||||
#ifndef WLED_DISABLE_MOBILE_UI
|
||||
oappend("mobile-ui ");
|
||||
#endif
|
||||
#ifndef WLED_DISABLE_OTA
|
||||
oappend("ota");
|
||||
#endif
|
||||
#ifdef USEFS
|
||||
oappend("\r\nspiffs: true\r\n");
|
||||
#else
|
||||
@ -236,13 +258,9 @@ void getBuildInfo()
|
||||
#endif
|
||||
oappend("button-pin: gpio");
|
||||
oappendi(buttonPin);
|
||||
oappend("\r\n");
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
oappend("strip-pin: gpio");
|
||||
oappend("\r\nstrip-pin: gpio");
|
||||
oappendi(LEDPIN);
|
||||
#else
|
||||
oappend("strip-pin: gpio2");
|
||||
#endif
|
||||
oappend("\r\nbrand: wled\r\n");
|
||||
oappend("\r\nbuild-type: src\r\n");
|
||||
}
|
||||
|
||||
@ -255,6 +273,3 @@ bool checkClientIsMobile(String useragent)
|
||||
if (useragent.indexOf("iPod") >= 0) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
*/
|
||||
|
||||
#define WLEDPACKETSIZE 24
|
||||
#define UDP_IN_MAXSIZE 1472
|
||||
|
||||
void notify(byte callMode, bool followUp=false)
|
||||
{
|
||||
@ -76,6 +77,27 @@ void initE131(){
|
||||
}
|
||||
}
|
||||
|
||||
void handleE131(){
|
||||
//E1.31 protocol support
|
||||
if(e131Enabled) {
|
||||
uint16_t len = e131->parsePacket();
|
||||
if (!len || e131->universe < e131Universe || e131->universe > e131Universe +4) return;
|
||||
len /= 3; //one LED is 3 DMX channels
|
||||
|
||||
uint16_t multipacketOffset = (e131->universe - e131Universe)*170; //if more than 170 LEDs (510 channels), client will send in next higher universe
|
||||
if (ledCount <= multipacketOffset) return;
|
||||
|
||||
arlsLock(realtimeTimeoutMs);
|
||||
if (len + multipacketOffset > ledCount) len = ledCount - multipacketOffset;
|
||||
|
||||
for (uint16_t i = 0; i < len; i++) {
|
||||
int j = i * 3;
|
||||
setRealtimePixel(i + multipacketOffset, e131->data[j], e131->data[j+1], e131->data[j+2], 0);
|
||||
}
|
||||
strip.show();
|
||||
}
|
||||
}
|
||||
|
||||
void handleNotifications()
|
||||
{
|
||||
//send second notification if enabled
|
||||
@ -83,20 +105,7 @@ void handleNotifications()
|
||||
notify(notificationSentCallMode,true);
|
||||
}
|
||||
|
||||
//E1.31 protocol support
|
||||
if(e131Enabled) {
|
||||
uint16_t len = e131->parsePacket();
|
||||
if (len && e131->universe == e131Universe) {
|
||||
arlsLock(realtimeTimeoutMs);
|
||||
if (len > ledCount) len = ledCount;
|
||||
for (uint16_t i = 0; i < len; i++) {
|
||||
int j = i * 3;
|
||||
|
||||
setRealtimePixel(i, e131->data[j], e131->data[j+1], e131->data[j+2], 0);
|
||||
}
|
||||
strip.show();
|
||||
}
|
||||
}
|
||||
handleE131();
|
||||
|
||||
//unlock strip when realtime UDP times out
|
||||
if (realtimeActive && millis() > realtimeTimeout)
|
||||
@ -116,16 +125,16 @@ void handleNotifications()
|
||||
if (!packetSize && udpRgbConnected) {
|
||||
packetSize = rgbUdp.parsePacket();
|
||||
if (!receiveDirect) return;
|
||||
if (packetSize > 1026 || packetSize < 3) return;
|
||||
if (packetSize > UDP_IN_MAXSIZE || packetSize < 3) return;
|
||||
realtimeIP = rgbUdp.remoteIP();
|
||||
DEBUG_PRINTLN(rgbUdp.remoteIP());
|
||||
byte udpIn[packetSize];
|
||||
rgbUdp.read(udpIn, packetSize);
|
||||
olen = 0;
|
||||
rgbUdp.read(obuf, packetSize);
|
||||
arlsLock(realtimeTimeoutMs);
|
||||
uint16_t id = 0;
|
||||
for (uint16_t i = 0; i < packetSize -2; i += 3)
|
||||
{
|
||||
setRealtimePixel(id, udpIn[i], udpIn[i+1], udpIn[i+2], 0);
|
||||
setRealtimePixel(id, obuf[i], obuf[i+1], obuf[i+2], 0);
|
||||
|
||||
id++; if (id >= ledCount) break;
|
||||
}
|
||||
@ -133,11 +142,13 @@ void handleNotifications()
|
||||
return;
|
||||
}
|
||||
|
||||
if (packetSize > 1026) return;
|
||||
if (packetSize > UDP_IN_MAXSIZE) return;
|
||||
if(packetSize && notifierUdp.remoteIP() != WiFi.localIP()) //don't process broadcasts we send ourselves
|
||||
{
|
||||
byte udpIn[packetSize];
|
||||
notifierUdp.read(udpIn, packetSize);
|
||||
olen = 0;
|
||||
notifierUdp.read(obuf, packetSize);
|
||||
char* udpIn = obuf;
|
||||
|
||||
if (udpIn[0] == 0 && !realtimeActive && receiveNotifications) //wled notifier, block if realtime packets active
|
||||
{
|
||||
if (receiveNotificationColor)
|
||||
@ -195,6 +206,7 @@ void handleNotifications()
|
||||
if (udpIn[1] == 0)
|
||||
{
|
||||
realtimeActive = false;
|
||||
return;
|
||||
} else {
|
||||
arlsLock(udpIn[1]*1000);
|
||||
}
|
||||
@ -222,6 +234,15 @@ void handleNotifications()
|
||||
|
||||
id++; if (id >= ledCount) break;
|
||||
}
|
||||
} else if (udpIn[0] == 4) //dnrgb
|
||||
{
|
||||
uint16_t id = ((udpIn[3] << 0) & 0xFF) + ((udpIn[2] << 8) & 0xFF00);
|
||||
for (uint16_t i = 4; i < packetSize -2; i += 3)
|
||||
{
|
||||
if (id >= ledCount) break;
|
||||
setRealtimePixel(id, udpIn[i], udpIn[i+1], udpIn[i+2], udpIn[i+3]);
|
||||
id++;
|
||||
}
|
||||
}
|
||||
strip.show();
|
||||
}
|
||||
@ -243,5 +264,3 @@ void setRealtimePixel(uint16_t i, byte r, byte g, byte b, byte w)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -171,9 +171,9 @@ void _overlayAnalogClock()
|
||||
int pix;
|
||||
for (int i = 0; i <= 12; i++)
|
||||
{
|
||||
pix = overlayMin + analogClock12pixel + (overlaySize/12)*i;
|
||||
if (pix > overlayMax) pix = pix - overlayMax;
|
||||
strip.setIndividual(pix,0x00FFAA);
|
||||
pix = analogClock12pixel + round((overlaySize / 12.0) *i);
|
||||
if (pix > overlayMax) pix -= overlaySize;
|
||||
strip.setIndividual(pix, 0x00FFAA);
|
||||
}
|
||||
}
|
||||
if (!analogClockSecondsTrail) strip.setIndividual(secondPixel, 0xFF0000);
|
||||
@ -184,7 +184,7 @@ void _overlayAnalogClock()
|
||||
|
||||
void _overlayNixieClock()
|
||||
{
|
||||
#ifdef WLED_FLASH_512K_MODE
|
||||
#ifdef WLED_DISABLE_CRONIXIE
|
||||
if (countdownMode) checkCountdown();
|
||||
#else
|
||||
|
||||
|
@ -5,7 +5,13 @@
|
||||
* https://github.com/kakopappa/arduino-esp8266-alexa-wemo-switch
|
||||
* https://github.com/probonopd/ESP8266HueEmulator
|
||||
*/
|
||||
void prepareIds() {
|
||||
escapedMac = WiFi.macAddress();
|
||||
escapedMac.replace(":", "");
|
||||
escapedMac.toLowerCase();
|
||||
}
|
||||
|
||||
#ifndef WLED_DISABLE_ALEXA
|
||||
void alexaInit()
|
||||
{
|
||||
if (alexaEnabled && WiFi.status() == WL_CONNECTED)
|
||||
@ -87,12 +93,6 @@ void alexaDim(byte briL)
|
||||
handleSet(ct);
|
||||
}
|
||||
|
||||
void prepareIds() {
|
||||
escapedMac = WiFi.macAddress();
|
||||
escapedMac.replace(":", "");
|
||||
escapedMac.toLowerCase();
|
||||
}
|
||||
|
||||
void respondToSearch() {
|
||||
DEBUG_PRINTLN("");
|
||||
DEBUG_PRINT("Send resp to ");
|
||||
@ -288,3 +288,9 @@ bool connectUDP(){
|
||||
|
||||
return state;
|
||||
}
|
||||
#else
|
||||
void alexaInit(){}
|
||||
void handleAlexa(){}
|
||||
void alexaInitPages(){}
|
||||
bool handleAlexaApiCall(String req, String body){return false;}
|
||||
#endif
|
||||
|
@ -19,7 +19,7 @@ byte getSameCodeLength(char code, int index, char const cronixieDisplay[])
|
||||
|
||||
void setCronixie()
|
||||
{
|
||||
#ifndef WLED_FLASH_512K_MODE
|
||||
#ifndef WLED_DISABLE_CRONIXIE
|
||||
/*
|
||||
* digit purpose index
|
||||
* 0-9 | 0-9 (incl. random)
|
||||
@ -146,7 +146,7 @@ void setCronixie()
|
||||
void _overlayCronixie()
|
||||
{
|
||||
if (countdownMode) checkCountdown();
|
||||
#ifndef WLED_FLASH_512K_MODE
|
||||
#ifndef WLED_DISABLE_CRONIXIE
|
||||
|
||||
byte h = hour(local);
|
||||
byte h0 = h;
|
||||
@ -214,4 +214,3 @@ void _overlayCronixie()
|
||||
//strip.trigger(); //this has a drawback, no effects slower than RefreshMs. advantage: Quick update, not dependant on effect time
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,27 @@
|
||||
/*
|
||||
* Color conversion methods
|
||||
*/
|
||||
|
||||
void colorHStoRGB(uint16_t hue, byte sat, byte* rgb) //hue, sat to rgb
|
||||
{
|
||||
float h = ((float)hue)/65535.0;
|
||||
float s = ((float)sat)/255.0;
|
||||
byte i = floor(h*6);
|
||||
float f = h * 6-i;
|
||||
float p = 255 * (1-s);
|
||||
float q = 255 * (1-f*s);
|
||||
float t = 255 * (1-(1-f)*s);
|
||||
switch (i%6) {
|
||||
case 0: rgb[0]=255,rgb[1]=t,rgb[2]=p;break;
|
||||
case 1: rgb[0]=q,rgb[1]=255,rgb[2]=p;break;
|
||||
case 2: rgb[0]=p,rgb[1]=255,rgb[2]=t;break;
|
||||
case 3: rgb[0]=p,rgb[1]=q,rgb[2]=255;break;
|
||||
case 4: rgb[0]=t,rgb[1]=p,rgb[2]=255;break;
|
||||
case 5: rgb[0]=255,rgb[1]=p,rgb[2]=q;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef WLED_DISABLE_HUESYNC
|
||||
void colorCTtoRGB(uint16_t mired, byte* rgb) //white spectrum to rgb
|
||||
{
|
||||
//this is only an approximation using WS2812B with gamma correction enabled
|
||||
@ -31,25 +52,6 @@ void colorCTtoRGB(uint16_t mired, byte* rgb) //white spectrum to rgb
|
||||
}
|
||||
}
|
||||
|
||||
void colorHStoRGB(uint16_t hue, byte sat, byte* rgb) //hue, sat to rgb
|
||||
{
|
||||
float h = ((float)hue)/65535.0;
|
||||
float s = ((float)sat)/255.0;
|
||||
byte i = floor(h*6);
|
||||
float f = h * 6-i;
|
||||
float p = 255 * (1-s);
|
||||
float q = 255 * (1-f*s);
|
||||
float t = 255 * (1-(1-f)*s);
|
||||
switch (i%6) {
|
||||
case 0: rgb[0]=255,rgb[1]=t,rgb[2]=p;break;
|
||||
case 1: rgb[0]=q,rgb[1]=255,rgb[2]=p;break;
|
||||
case 2: rgb[0]=p,rgb[1]=255,rgb[2]=t;break;
|
||||
case 3: rgb[0]=p,rgb[1]=q,rgb[2]=255;break;
|
||||
case 4: rgb[0]=t,rgb[1]=p,rgb[2]=255;break;
|
||||
case 5: rgb[0]=255,rgb[1]=p,rgb[2]=q;
|
||||
}
|
||||
}
|
||||
|
||||
void colorXYtoRGB(float x, float y, byte* rgb) //coordinates to rgb (https://www.developers.meethue.com/documentation/color-conversions-rgb-xy)
|
||||
{
|
||||
float z = 1.0f - x - y;
|
||||
@ -106,6 +108,16 @@ void colorXYtoRGB(float x, float y, byte* rgb) //coordinates to rgb (https://www
|
||||
rgb[2] = 255.0*b;
|
||||
}
|
||||
|
||||
void colorRGBtoXY(byte* rgb, float* xy) //rgb to coordinates (https://www.developers.meethue.com/documentation/color-conversions-rgb-xy)
|
||||
{
|
||||
float X = rgb[0] * 0.664511f + rgb[1] * 0.154324f + rgb[2] * 0.162028f;
|
||||
float Y = rgb[0] * 0.283881f + rgb[1] * 0.668433f + rgb[2] * 0.047685f;
|
||||
float Z = rgb[0] * 0.000088f + rgb[1] * 0.072310f + rgb[2] * 0.986039f;
|
||||
xy[0] = X / (X + Y + Z);
|
||||
xy[1] = Y / (X + Y + Z);
|
||||
}
|
||||
#endif
|
||||
|
||||
void colorFromDecOrHexString(byte* rgb, byte* wht, char* in)
|
||||
{
|
||||
if (in[0] == 0) return;
|
||||
@ -126,15 +138,6 @@ void colorFromDecOrHexString(byte* rgb, byte* wht, char* in)
|
||||
rgb[2] = c & 0xFF;
|
||||
}
|
||||
|
||||
void colorRGBtoXY(byte* rgb, float* xy) //rgb to coordinates (https://www.developers.meethue.com/documentation/color-conversions-rgb-xy)
|
||||
{
|
||||
float X = rgb[0] * 0.664511f + rgb[1] * 0.154324f + rgb[2] * 0.162028f;
|
||||
float Y = rgb[0] * 0.283881f + rgb[1] * 0.668433f + rgb[2] * 0.047685f;
|
||||
float Z = rgb[0] * 0.000088f + rgb[1] * 0.072310f + rgb[2] * 0.986039f;
|
||||
xy[0] = X / (X + Y + Z);
|
||||
xy[1] = Y / (X + Y + Z);
|
||||
}
|
||||
|
||||
float minf (float v, float w)
|
||||
{
|
||||
if (w > v) return v;
|
||||
@ -155,4 +158,3 @@ void colorRGBtoRGBW(byte* rgb, byte* wht) //rgb to rgbw (http://codewelt.com/rgb
|
||||
float sat = 255.0f * ((high - low) / high);
|
||||
*wht = (byte)((255.0f - sat) / 255.0f * (rgb[0] + rgb[1] + rgb[2]) / 3);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Sync to Philips hue lights
|
||||
*/
|
||||
|
||||
#ifndef WLED_DISABLE_HUESYNC
|
||||
void handleHue()
|
||||
{
|
||||
if (huePollingEnabled && WiFi.status() == WL_CONNECTED && hueClient != NULL)
|
||||
@ -206,4 +206,7 @@ String getJsonValue(String* req, String key)
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
#else
|
||||
void handleHue(){}
|
||||
bool setupHue(){return false;}
|
||||
#endif
|
||||
|
@ -7,19 +7,24 @@ byte blSat = 255;
|
||||
|
||||
void initBlynk(const char* auth)
|
||||
{
|
||||
#ifndef WLED_DISABLE_BLYNK
|
||||
if (WiFi.status() != WL_CONNECTED) return;
|
||||
blynkEnabled = (auth[0] != 0);
|
||||
if (blynkEnabled) Blynk.config(auth);
|
||||
#endif
|
||||
}
|
||||
|
||||
void handleBlynk()
|
||||
{
|
||||
#ifndef WLED_DISABLE_BLYNK
|
||||
if (WiFi.status() == WL_CONNECTED && blynkEnabled)
|
||||
Blynk.run();
|
||||
#endif
|
||||
}
|
||||
|
||||
void updateBlynk()
|
||||
{
|
||||
#ifndef WLED_DISABLE_BLYNK
|
||||
if (onlyAP) return;
|
||||
Blynk.virtualWrite(V0, bri);
|
||||
//we need a RGB -> HSB convert here
|
||||
@ -29,8 +34,10 @@ void updateBlynk()
|
||||
Blynk.virtualWrite(V6, effectIntensity);
|
||||
Blynk.virtualWrite(V7, nightlightActive);
|
||||
Blynk.virtualWrite(V8, notifyDirect);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef WLED_DISABLE_BLYNK
|
||||
BLYNK_WRITE(V0)
|
||||
{
|
||||
bri = param.asInt();//bri
|
||||
@ -86,4 +93,4 @@ BLYNK_WRITE(V8)
|
||||
{
|
||||
notifyDirect = (param.asInt()>0); //send notifications
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -93,6 +93,8 @@ bool reconnectMQTT()
|
||||
strcat(subuf, "/api");
|
||||
mqtt->subscribe(subuf);
|
||||
}
|
||||
|
||||
publishMQTT();
|
||||
}
|
||||
return mqtt->connected();
|
||||
}
|
||||
|
@ -132,7 +132,13 @@ void initServer()
|
||||
server.on("/list", HTTP_GET, handleFileList);
|
||||
#endif
|
||||
//init ota page
|
||||
#ifndef WLED_DISABLE_OTA
|
||||
httpUpdater.setup(&server);
|
||||
#else
|
||||
server.on("/update", HTTP_GET, [](){
|
||||
serveMessage(500, "Not implemented", "OTA updates are not supported in this build.", 254);
|
||||
});
|
||||
#endif
|
||||
} else
|
||||
{
|
||||
server.on("/edit", HTTP_GET, [](){
|
||||
@ -311,7 +317,7 @@ void serveSettings(byte subPage)
|
||||
//0: menu 1: wifi 2: leds 3: ui 4: sync 5: time 6: sec 255: welcomepage
|
||||
if (!realtimeActive || enableRealtimeUI) //do not serve while receiving realtime
|
||||
{
|
||||
#ifdef WLED_FLASH_512K_MODE //disable welcome page if not enough storage
|
||||
#ifdef WLED_DISABLE_MOBILE_UI //disable welcome page if not enough storage
|
||||
if (subPage == 255) {serveIndex(); return;}
|
||||
#endif
|
||||
|
||||
@ -363,4 +369,3 @@ void serveSettings(byte subPage)
|
||||
serveRealtimeError(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user