Fixed bug that would cause white value off on startup in RGBW mode
Dynamically lowered refresh rate in standard mode in an attempt to minimize random flashing issue Added L= and UL= HTTP in vars to lock/unlock pixels and ranges
This commit is contained in:
parent
2f7e0ef672
commit
a33386c672
@ -228,7 +228,7 @@ void WS2812FX::mode_static(void) {
|
||||
setPixelColor(i, _color);
|
||||
}
|
||||
show();
|
||||
_mode_delay = 25;
|
||||
_mode_delay = (_fastStandard) ? 25 : 500;
|
||||
}
|
||||
|
||||
|
||||
@ -1683,6 +1683,12 @@ void WS2812FX::setLedCount(uint16_t i)
|
||||
_led_count = i;
|
||||
}
|
||||
|
||||
void WS2812FX::setFastUpdateMode(bool y)
|
||||
{
|
||||
_fastStandard = y;
|
||||
if (_mode_index == 0) _mode_delay = 20;
|
||||
}
|
||||
|
||||
//Added for quick NeoPixelBus compatibility with Adafruit syntax
|
||||
|
||||
void WS2812FX::setPixelColor(uint16_t i, uint32_t c)
|
||||
|
@ -1,4 +1,4 @@
|
||||
//#define RGBW
|
||||
#define RGBW
|
||||
|
||||
/*
|
||||
WS2812FX.h - Library for WS2812 LED effects.
|
||||
@ -237,6 +237,7 @@ class WS2812FX : public NeoPixelBrightnessBus<NeoGrbFeature, NeoEsp8266Uart800Kb
|
||||
_mode_color = DEFAULT_COLOR;
|
||||
_counter_mode_call = 0;
|
||||
_counter_mode_step = 0;
|
||||
_fastStandard = false;
|
||||
_locked = new boolean[n];
|
||||
}
|
||||
|
||||
@ -265,6 +266,7 @@ class WS2812FX : public NeoPixelBrightnessBus<NeoGrbFeature, NeoEsp8266Uart800Kb
|
||||
unlock(int i),
|
||||
unlockRange(int i, int i2),
|
||||
unlockAll(void),
|
||||
setFastUpdateMode(bool b),
|
||||
trigger(void),
|
||||
setLedCount(uint16_t i),
|
||||
setFade(int sp);
|
||||
@ -354,6 +356,7 @@ class WS2812FX : public NeoPixelBrightnessBus<NeoGrbFeature, NeoEsp8266Uart800Kb
|
||||
|
||||
boolean
|
||||
_triggered,
|
||||
_fastStandard,
|
||||
_running;
|
||||
|
||||
boolean*
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "CallbackFunction.h"
|
||||
|
||||
//version in format yymmddb (b = daily build)
|
||||
#define VERSION 1710284
|
||||
#define VERSION 1711191
|
||||
|
||||
//If you have an RGBW strip, uncomment first line in WS2812FX.h!
|
||||
|
||||
|
@ -216,7 +216,7 @@ void loadSettingsFromEEPROM()
|
||||
if (!arlsSign) arlsOffset = -arlsOffset;
|
||||
turnOnAtBoot = EEPROM.read(369);
|
||||
useHSBDefault = EEPROM.read(370);
|
||||
white_s = EEPROM.read(371);
|
||||
white_s = EEPROM.read(371); white = white_s;
|
||||
useRGBW = EEPROM.read(372);
|
||||
sweepTransition = EEPROM.read(373);
|
||||
sweepDirection = EEPROM.read(374);
|
||||
|
@ -246,26 +246,32 @@ boolean handleSet(String req)
|
||||
return false;
|
||||
}
|
||||
int pos = 0;
|
||||
//set brigthness
|
||||
pos = req.indexOf("A=");
|
||||
if (pos > 0) {
|
||||
bri = req.substring(pos + 2).toInt();
|
||||
}
|
||||
//set red value
|
||||
pos = req.indexOf("R=");
|
||||
if (pos > 0) {
|
||||
col[0] = req.substring(pos + 2).toInt();
|
||||
}
|
||||
//set green value
|
||||
pos = req.indexOf("G=");
|
||||
if (pos > 0) {
|
||||
col[1] = req.substring(pos + 2).toInt();
|
||||
}
|
||||
//set blue value
|
||||
pos = req.indexOf("B=");
|
||||
if (pos > 0) {
|
||||
col[2] = req.substring(pos + 2).toInt();
|
||||
}
|
||||
//set white value
|
||||
pos = req.indexOf("W=");
|
||||
if (pos > 0) {
|
||||
white = req.substring(pos + 2).toInt();
|
||||
}
|
||||
//set current effect index
|
||||
pos = req.indexOf("FX=");
|
||||
if (pos > 0) {
|
||||
if (effectCurrent != req.substring(pos + 3).toInt())
|
||||
@ -275,6 +281,7 @@ boolean handleSet(String req)
|
||||
effectUpdated = true;
|
||||
}
|
||||
}
|
||||
//set effect speed
|
||||
pos = req.indexOf("SX=");
|
||||
if (pos > 0) {
|
||||
if (effectSpeed != req.substring(pos + 3).toInt())
|
||||
@ -284,15 +291,18 @@ boolean handleSet(String req)
|
||||
effectUpdated = true;
|
||||
}
|
||||
}
|
||||
//set default control mode (0 - RGB, 1 - HSB)
|
||||
pos = req.indexOf("MD=");
|
||||
if (pos > 0) {
|
||||
useHSB = req.substring(pos + 3).toInt();
|
||||
}
|
||||
//set advanced overlay
|
||||
pos = req.indexOf("OL=");
|
||||
if (pos > 0) {
|
||||
overlayCurrent = req.substring(pos + 3).toInt();
|
||||
strip.unlockAll();
|
||||
}
|
||||
//set individual pixel (range) to current color
|
||||
pos = req.indexOf("I=");
|
||||
if (pos > 0){
|
||||
int index = req.substring(pos + 2).toInt();
|
||||
@ -305,6 +315,32 @@ boolean handleSet(String req)
|
||||
strip.setIndividual(index);
|
||||
}
|
||||
}
|
||||
//(un)lock pixel (ranges)
|
||||
pos = req.indexOf("L=");
|
||||
if (pos > 0){
|
||||
int index = req.substring(pos + 2).toInt();
|
||||
pos = req.indexOf("L2=");
|
||||
if (pos > 0){
|
||||
int index2 = req.substring(pos + 3).toInt();
|
||||
if (req.indexOf("UL=") > 0)
|
||||
{
|
||||
strip.unlockRange(index, index2);
|
||||
} else
|
||||
{
|
||||
strip.lockRange(index, index2);
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (req.indexOf("UL=") > 0)
|
||||
{
|
||||
strip.unlock(index);
|
||||
} else
|
||||
{
|
||||
strip.lock(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
//toggle send UDP direct notifications
|
||||
if (req.indexOf("SN=") > 0)
|
||||
{
|
||||
notifyDirect = true;
|
||||
@ -313,6 +349,7 @@ boolean handleSet(String req)
|
||||
notifyDirect = false;
|
||||
}
|
||||
}
|
||||
//toggle receive UDP direct notifications
|
||||
if (req.indexOf("RN=") > 0)
|
||||
{
|
||||
receiveNotifications = true;
|
||||
@ -321,6 +358,7 @@ boolean handleSet(String req)
|
||||
receiveNotifications = false;
|
||||
}
|
||||
}
|
||||
//toggle nightlight mode
|
||||
if (req.indexOf("NL=") > 0)
|
||||
{
|
||||
if (req.indexOf("NL=0") > 0)
|
||||
@ -332,12 +370,14 @@ boolean handleSet(String req)
|
||||
nightlightStartTime = millis();
|
||||
}
|
||||
}
|
||||
//toggle general purpose output
|
||||
pos = req.indexOf("AX=");
|
||||
if (pos > 0) {
|
||||
auxTime = req.substring(pos + 3).toInt();
|
||||
auxActive = true;
|
||||
if (auxTime == 0) auxActive = false;
|
||||
}
|
||||
//main toggle on/off
|
||||
pos = req.indexOf("T=");
|
||||
if (pos > 0) {
|
||||
switch (req.substring(pos + 2).toInt())
|
||||
@ -354,11 +394,13 @@ boolean handleSet(String req)
|
||||
}
|
||||
}
|
||||
}
|
||||
//internal call, does not send XML response
|
||||
pos = req.indexOf("IN");
|
||||
if (pos < 1)
|
||||
{
|
||||
XML_response();
|
||||
}
|
||||
//do not send UDP notifications this time
|
||||
pos = req.indexOf("NN");
|
||||
if (pos > 0)
|
||||
{
|
||||
|
@ -69,9 +69,11 @@ void colorUpdated(int callMode)
|
||||
}
|
||||
transitionActive = true;
|
||||
transitionStartTime = millis();
|
||||
strip.setFastUpdateMode(true);
|
||||
} else
|
||||
{
|
||||
setLedsStandard();
|
||||
strip.trigger();
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,6 +88,7 @@ void handleTransitions()
|
||||
tper_last = 0;
|
||||
if (sweepTransition) strip.unlockAll();
|
||||
setLedsStandard();
|
||||
strip.setFastUpdateMode(false);
|
||||
return;
|
||||
}
|
||||
if (tper - tper_last < transitionResolution)
|
||||
|
Loading…
Reference in New Issue
Block a user