Fixed JSON API on bug

Fixed RN=1 not having an effect if default off
This commit is contained in:
cschwinne 2019-03-11 00:20:17 +01:00
parent b72e6f16ca
commit 898702346e
5 changed files with 14 additions and 14 deletions

View File

@ -44,7 +44,7 @@ void WS2812FX::init(bool supportWhite, uint16_t countPixels, bool skipFirst)
if (_skipFirstMode) lengthRaw += LED_SKIP_AMOUNT;
bus->Begin((NeoPixelType)ty, lengthRaw);
if (_locked != NULL) delete _locked;
delete[] _locked;
_locked = new byte[_length];
_segments[0].start = 0;

View File

@ -18,7 +18,7 @@ const char PAGE_msg[] PROGMEM = R"=====(<!DOCTYPE html>
//firmware update page
const char PAGE_update[] PROGMEM = R"=====(<!DOCTYPE html>
<html><head><meta content='width=device-width' name='viewport'><title>WLED Message</title><script>function B(){window.history.back()}</script>
<html><head><meta content='width=device-width' name='viewport'><title>WLED Update</title><script>function B(){window.history.back()}</script>
%CSS%.bt{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),sans-serif;border:.3ch solid var(--bCol);display:inline-block;filter:drop-shadow(-5px -5px 5px var(--sCol));font-size:20px;margin:8px;margin-top:12px}input[type=file]{font-size:16px}body{font-family:var(--cFn),sans-serif;text-align:center;background:var(--cCol);color:var(--tCol);line-height:200%%}</style></head>
<body><h2>WLED Software Update</h2>Installed version: 0.8.4-dev<br>Download the latest binary: <a href="https://github.com/Aircoookie/WLED/releases"><img src="https://img.shields.io/github/release/Aircoookie/WLED.svg?style=flat-square"></a><br><form method='POST' action='/update' enctype='multipart/form-data'><input type='file' class="bt" name='update' required><br><input type='submit' class="bt" value='Update!'></form><button type="button" class="bt" onclick="B()">Back</button></body></html>)=====";

View File

@ -89,7 +89,7 @@
//version code in format yymmddb (b = daily build)
#define VERSION 1903092
#define VERSION 1903111
char versionString[] = "0.8.4-dev";
@ -114,7 +114,7 @@ char ntpServerName[] = "0.wled.pool.ntp.org"; //NTP server to use
char clientSSID[33] = "Your_Network";
char clientPass[65] = "";
char cmDNS[33] = "x"; //mDNS address (placeholder, will be replaced by wledXXXXXXXXXXXX.local)
char apSSID[65] = ""; //AP off by default (unless setup)
char apSSID[33] = ""; //AP off by default (unless setup)
byte apChannel = 1; //2.4GHz WiFi AP channel (1-13)
byte apHide = 0; //hidden AP SSID
byte apWaitTimeSecs = 32; //time to wait for connection before opening AP

View File

@ -59,11 +59,11 @@ void notify(byte callMode, bool followUp=false)
void arlsLock(uint32_t timeoutMs)
{
if (!realtimeActive){
for (uint16_t i = 0; i < ledCount; i++)
{
strip.setPixelColor(i,0,0,0,0);
}
strip.unlockAll();
for (uint16_t i = 0; i < ledCount; i++)
{
strip.setPixelColor(i,0,0,0,0);
}
strip.unlockAll();
}
realtimeActive = true;
realtimeTimeout = millis() + timeoutMs;
@ -160,8 +160,9 @@ void handleNotifications()
//wled notifier, block if realtime packets active
if (udpIn[0] == 0 && !realtimeActive && receiveNotifications)
{
bool someSel = (receiveNotificationBrightness || receiveNotificationColor || receiveNotificationEffects);
//apply colors from notification
if (receiveNotificationColor)
if (receiveNotificationColor || !someSel)
{
col[0] = udpIn[3];
col[1] = udpIn[4];
@ -180,7 +181,7 @@ void handleNotifications()
}
//apply effects from notification
if (receiveNotificationEffects)
if (receiveNotificationEffects || !someSel)
{
if (udpIn[8] < strip.getModeCount()) effectCurrent = udpIn[8];
effectSpeed = udpIn[9];
@ -196,7 +197,7 @@ void handleNotifications()
nightlightActive = udpIn[6];
if (nightlightActive) nightlightDelayMins = udpIn[7];
if (receiveNotificationBrightness) bri = udpIn[2];
if (receiveNotificationBrightness || !someSel) bri = udpIn[2];
colorUpdated(3);
} else if (udpIn[0] > 0 && udpIn[0] < 4 && receiveDirect) //1 warls //2 drgb //3 drgbw

View File

@ -4,7 +4,7 @@
void deserializeState(JsonObject& root)
{
bri = root["bri"] | briLast;
bri = root["bri"] | bri;
bool on = root["on"] | (bri > 0);
if (!on != !bri) toggleOnOff();
@ -60,7 +60,6 @@ void deserializeState(JsonObject& root)
if (sz > 0 && sz < 5)
{
int rgbw[] = {0,0,0,0};
memset(rgbw, 0, 4);
byte cp = colX.copyTo(rgbw);
seg.colors[i] = ((rgbw[3] << 24) | ((rgbw[0]&0xFF) << 16) | ((rgbw[1]&0xFF) << 8) | ((rgbw[2]&0xFF)));
if (cp == 1 && rgbw[0] == 0) seg.colors[i] = 0;