Incomplete commit for Nightlight Fixes
Interim state (Reason: Local Working Copy Data Corruption) Affected files: (local changes will be re-implemented in next commit) settings_sync.html (already recovered) html_settings.h (already recovered) wled03_set.ino wled08_led.ino wled09_button.ino wled19_ir.ino
This commit is contained in:
parent
c0816c80ae
commit
54d7a81f16
Binary file not shown.
@ -224,7 +224,9 @@ const char PAGE_settings_sync1[] PROGMEM = R"=====(
|
|||||||
<button type="button" onclick="B()">Back</button><button type="submit">Save</button><hr>
|
<button type="button" onclick="B()">Back</button><button type="submit">Save</button><hr>
|
||||||
<h2>Sync setup</h2>
|
<h2>Sync setup</h2>
|
||||||
<h3>Button setup</h3>
|
<h3>Button setup</h3>
|
||||||
On/Off button enabled: <input type="checkbox" name="BT">
|
On/Off button enabled: <input type="checkbox" name="BT"><br>
|
||||||
|
Infrared receiver enabled: <input type="checkbox" name="IR"><br>
|
||||||
|
<a href="https://github.com/Aircoookie/WLED/wiki/Infrared-Control" target="_blank">IR info</a>
|
||||||
<h3>WLED Broadcast</h3>
|
<h3>WLED Broadcast</h3>
|
||||||
UDP Port: <input name="UP" maxlength="5" size="4"><br>
|
UDP Port: <input name="UP" maxlength="5" size="4"><br>
|
||||||
Receive <input type="checkbox" name="RB">Brightness, <input type="checkbox" name="RC">Color, and <input type="checkbox" name="RX">Effects<br>
|
Receive <input type="checkbox" name="RB">Brightness, <input type="checkbox" name="RC">Color, and <input type="checkbox" name="RX">Effects<br>
|
||||||
|
@ -21,10 +21,12 @@
|
|||||||
//#define WLED_DISABLE_BLYNK
|
//#define WLED_DISABLE_BLYNK
|
||||||
//#define WLED_DISABLE_CRONIXIE
|
//#define WLED_DISABLE_CRONIXIE
|
||||||
//#define WLED_DISABLE_HUESYNC
|
//#define WLED_DISABLE_HUESYNC
|
||||||
|
//#define WLED_DISABLE_INFRARED
|
||||||
//#define WLED_DISABLE_MOBILE_UI
|
//#define WLED_DISABLE_MOBILE_UI
|
||||||
|
|
||||||
//to toggle usb serial debug (un)comment following line(s)
|
//to toggle usb serial debug (un)comment following line(s)
|
||||||
//#define WLED_DEBUG
|
#define WLED_DEBUG
|
||||||
|
|
||||||
|
|
||||||
//library inclusions
|
//library inclusions
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
@ -33,15 +35,19 @@
|
|||||||
#include <ESPmDNS.h>
|
#include <ESPmDNS.h>
|
||||||
#include "src/dependencies/webserver/WebServer.h"
|
#include "src/dependencies/webserver/WebServer.h"
|
||||||
#include <HTTPClient.h>
|
#include <HTTPClient.h>
|
||||||
#include <IRremote.h>
|
/*#ifndef WLED_DISABLE_INFRARED
|
||||||
|
#include <IRremote.h>
|
||||||
|
#endif*/ //there are issues with ESP32 infrared, so it is disabled for now
|
||||||
#else
|
#else
|
||||||
#include <ESP8266WiFi.h>
|
#include <ESP8266WiFi.h>
|
||||||
#include <ESP8266mDNS.h>
|
#include <ESP8266mDNS.h>
|
||||||
#include <ESP8266WebServer.h>
|
#include <ESP8266WebServer.h>
|
||||||
#include <ESP8266HTTPClient.h>
|
#include <ESP8266HTTPClient.h>
|
||||||
#include <IRremoteESP8266.h>
|
#ifndef WLED_DISABLE_INFRARED
|
||||||
#include <IRrecv.h>
|
#include <IRremoteESP8266.h>
|
||||||
#include <IRutils.h>
|
#include <IRrecv.h>
|
||||||
|
#include <IRutils.h>
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <EEPROM.h>
|
#include <EEPROM.h>
|
||||||
@ -68,7 +74,7 @@
|
|||||||
|
|
||||||
|
|
||||||
//version code in format yymmddb (b = daily build)
|
//version code in format yymmddb (b = daily build)
|
||||||
#define VERSION 1811172
|
#define VERSION 1811201
|
||||||
char versionString[] = "0.8.2-dev";
|
char versionString[] = "0.8.2-dev";
|
||||||
|
|
||||||
|
|
||||||
@ -148,8 +154,8 @@ bool useHSBDefault = useHSB;
|
|||||||
|
|
||||||
|
|
||||||
//Sync CONFIG
|
//Sync CONFIG
|
||||||
bool buttonEnabled = true;
|
bool buttonEnabled = true;
|
||||||
bool irEnabled = true; //Infrared receiver
|
bool irEnabled = false; //Infrared receiver
|
||||||
|
|
||||||
uint16_t udpPort = 21324; //WLED notifier default port
|
uint16_t udpPort = 21324; //WLED notifier default port
|
||||||
uint16_t udpRgbPort = 19446; //Hyperion port
|
uint16_t udpRgbPort = 19446; //Hyperion port
|
||||||
@ -158,7 +164,7 @@ bool receiveNotificationBrightness = true; //apply brightness from incoming n
|
|||||||
bool receiveNotificationColor = true; //apply color
|
bool receiveNotificationColor = true; //apply color
|
||||||
bool receiveNotificationEffects = true; //apply effects setup
|
bool receiveNotificationEffects = true; //apply effects setup
|
||||||
bool notifyDirect = true; //send notification if change via UI or HTTP API
|
bool notifyDirect = true; //send notification if change via UI or HTTP API
|
||||||
bool notifyButton = true;
|
bool notifyButton = true; //send if updated by button or infrared remote
|
||||||
bool notifyAlexa = false; //send notification if updated via Alexa
|
bool notifyAlexa = false; //send notification if updated via Alexa
|
||||||
bool notifyMacro = false; //send notification for macro
|
bool notifyMacro = false; //send notification for macro
|
||||||
bool notifyHue = true; //send notification if Hue light changes
|
bool notifyHue = true; //send notification if Hue light changes
|
||||||
@ -259,6 +265,7 @@ float tperLast = 0; //crossfade transition progress, 0
|
|||||||
bool nightlightActive = false;
|
bool nightlightActive = false;
|
||||||
bool nightlightActiveOld = false;
|
bool nightlightActiveOld = false;
|
||||||
uint32_t nightlightDelayMs = 10;
|
uint32_t nightlightDelayMs = 10;
|
||||||
|
uint8_t nightlightDelayMinsDefault = nightlightDelayMins;
|
||||||
unsigned long nightlightStartTime;
|
unsigned long nightlightStartTime;
|
||||||
byte briNlT = 0; //current nightlight brightness
|
byte briNlT = 0; //current nightlight brightness
|
||||||
|
|
||||||
@ -407,7 +414,7 @@ E131* e131;
|
|||||||
WS2812FX strip = WS2812FX();
|
WS2812FX strip = WS2812FX();
|
||||||
|
|
||||||
//debug macros
|
//debug macros
|
||||||
#ifdef DEBUG
|
#ifdef WLED_DEBUG
|
||||||
#define DEBUG_PRINT(x) Serial.print (x)
|
#define DEBUG_PRINT(x) Serial.print (x)
|
||||||
#define DEBUG_PRINTLN(x) Serial.println (x)
|
#define DEBUG_PRINTLN(x) Serial.println (x)
|
||||||
#define DEBUG_PRINTF(x) Serial.printf (x)
|
#define DEBUG_PRINTF(x) Serial.printf (x)
|
||||||
@ -524,7 +531,7 @@ void loop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//DEBUG serial logging
|
//DEBUG serial logging
|
||||||
#ifdef DEBUG
|
#ifdef WLED_DEBUG
|
||||||
if (millis() - debugTime > 5000)
|
if (millis() - debugTime > 5000)
|
||||||
{
|
{
|
||||||
DEBUG_PRINTLN("---MODULE DEBUG INFO---");
|
DEBUG_PRINTLN("---MODULE DEBUG INFO---");
|
||||||
|
@ -66,7 +66,7 @@ void saveSettingsToEEPROM()
|
|||||||
writeStringToEEPROM(128, apSSID, 32);
|
writeStringToEEPROM(128, apSSID, 32);
|
||||||
writeStringToEEPROM(160, apPass, 64);
|
writeStringToEEPROM(160, apPass, 64);
|
||||||
|
|
||||||
EEPROM.write(224, nightlightDelayMins);
|
EEPROM.write(224, nightlightDelayMinsDefault);
|
||||||
EEPROM.write(225, nightlightFade);
|
EEPROM.write(225, nightlightFade);
|
||||||
EEPROM.write(226, notifyDirectDefault);
|
EEPROM.write(226, notifyDirectDefault);
|
||||||
EEPROM.write(227, apChannel);
|
EEPROM.write(227, apChannel);
|
||||||
@ -138,6 +138,8 @@ void saveSettingsToEEPROM()
|
|||||||
EEPROM.write(380, colSecS[2]);
|
EEPROM.write(380, colSecS[2]);
|
||||||
EEPROM.write(381, whiteSecS);
|
EEPROM.write(381, whiteSecS);
|
||||||
EEPROM.write(382, strip.paletteBlend);
|
EEPROM.write(382, strip.paletteBlend);
|
||||||
|
|
||||||
|
EEPROM.write(385, irEnabled);
|
||||||
|
|
||||||
EEPROM.write(389, bootPreset);
|
EEPROM.write(389, bootPreset);
|
||||||
EEPROM.write(390, aOtaEnabled);
|
EEPROM.write(390, aOtaEnabled);
|
||||||
@ -256,7 +258,9 @@ void loadSettingsFromEEPROM(bool first)
|
|||||||
{
|
{
|
||||||
if (EEPROM.read(233) != 233) //first boot/reset to default
|
if (EEPROM.read(233) != 233) //first boot/reset to default
|
||||||
{
|
{
|
||||||
|
DEBUG_PRINT("Settings invalid, restoring defaults...");
|
||||||
saveSettingsToEEPROM();
|
saveSettingsToEEPROM();
|
||||||
|
DEBUG_PRINTLN("done");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int lastEEPROMversion = EEPROM.read(377); //last EEPROM version before update
|
int lastEEPROMversion = EEPROM.read(377); //last EEPROM version before update
|
||||||
@ -268,7 +272,8 @@ void loadSettingsFromEEPROM(bool first)
|
|||||||
readStringFromEEPROM(128, apSSID, 32);
|
readStringFromEEPROM(128, apSSID, 32);
|
||||||
readStringFromEEPROM(160, apPass, 64);
|
readStringFromEEPROM(160, apPass, 64);
|
||||||
|
|
||||||
nightlightDelayMins = EEPROM.read(224);
|
nightlightDelayMinsDefault = EEPROM.read(224);
|
||||||
|
nightlightDelayMins = nightlightDelayMinsDefault;
|
||||||
nightlightFade = EEPROM.read(225);
|
nightlightFade = EEPROM.read(225);
|
||||||
notifyDirectDefault = EEPROM.read(226);
|
notifyDirectDefault = EEPROM.read(226);
|
||||||
notifyDirect = notifyDirectDefault;
|
notifyDirect = notifyDirectDefault;
|
||||||
@ -343,6 +348,8 @@ void loadSettingsFromEEPROM(bool first)
|
|||||||
effectPaletteDefault = EEPROM.read(373); effectPalette = effectPaletteDefault;
|
effectPaletteDefault = EEPROM.read(373); effectPalette = effectPaletteDefault;
|
||||||
//374 - strip.paletteFade
|
//374 - strip.paletteFade
|
||||||
|
|
||||||
|
irEnabled = EEPROM.read(385);
|
||||||
|
|
||||||
if (lastEEPROMversion > 0) {
|
if (lastEEPROMversion > 0) {
|
||||||
apWaitTimeSecs = EEPROM.read(375);
|
apWaitTimeSecs = EEPROM.read(375);
|
||||||
recoveryAPDisabled = EEPROM.read(376);
|
recoveryAPDisabled = EEPROM.read(376);
|
||||||
@ -607,14 +614,16 @@ void saveMacro(byte index, String mc, bool sing=true) //only commit on single sa
|
|||||||
|
|
||||||
void commit()
|
void commit()
|
||||||
{
|
{
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
DEBUG_PRINT("s");
|
||||||
delay(1);
|
/*#ifdef ARDUINO_ARCH_ESP32
|
||||||
portDISABLE_INTERRUPTS();
|
portMUX_TYPE mMux = portMUX_INITIALIZER_UNLOCKED;
|
||||||
#endif
|
portENTER_CRITICAL(&mMux);
|
||||||
|
#endif*/
|
||||||
EEPROM.commit();
|
|
||||||
|
EEPROM.commit();
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
|
||||||
portENABLE_INTERRUPTS();
|
/*#ifdef ARDUINO_ARCH_ESP32
|
||||||
#endif
|
portEXIT_CRITICAL(&mMux);
|
||||||
|
#endif*/
|
||||||
|
DEBUG_PRINT(".");
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,7 @@ void getSettingsJS(byte subPage)
|
|||||||
sappend('c',"T2",enableSecTransition);
|
sappend('c',"T2",enableSecTransition);
|
||||||
sappend('v',"BF",briMultiplier);
|
sappend('v',"BF",briMultiplier);
|
||||||
sappend('v',"TB",nightlightTargetBri);
|
sappend('v',"TB",nightlightTargetBri);
|
||||||
sappend('v',"TL",nightlightDelayMins);
|
sappend('v',"TL",nightlightDelayMinsDefault);
|
||||||
sappend('c',"TW",nightlightFade);
|
sappend('c',"TW",nightlightFade);
|
||||||
sappend('i',"PB",strip.paletteBlend);
|
sappend('i',"PB",strip.paletteBlend);
|
||||||
sappend('c',"RV",reverseMode);
|
sappend('c',"RV",reverseMode);
|
||||||
@ -242,6 +242,7 @@ void getSettingsJS(byte subPage)
|
|||||||
if (subPage == 4)
|
if (subPage == 4)
|
||||||
{
|
{
|
||||||
sappend('c',"BT",buttonEnabled);
|
sappend('c',"BT",buttonEnabled);
|
||||||
|
sappend('c',"IR",irEnabled);
|
||||||
sappend('v',"UP",udpPort);
|
sappend('v',"UP",udpPort);
|
||||||
sappend('c',"RB",receiveNotificationBrightness);
|
sappend('c',"RB",receiveNotificationBrightness);
|
||||||
sappend('c',"RC",receiveNotificationColor);
|
sappend('c',"RC",receiveNotificationColor);
|
||||||
|
@ -251,7 +251,7 @@ void getBuildInfo()
|
|||||||
#else
|
#else
|
||||||
oappend("\r\nspiffs: false\r\n");
|
oappend("\r\nspiffs: false\r\n");
|
||||||
#endif
|
#endif
|
||||||
#ifdef DEBUG
|
#ifdef WLED_DEBUG
|
||||||
oappend("debug: true\r\n");
|
oappend("debug: true\r\n");
|
||||||
#else
|
#else
|
||||||
oappend("debug: false\r\n");
|
oappend("debug: false\r\n");
|
||||||
@ -260,8 +260,8 @@ void getBuildInfo()
|
|||||||
oappendi(BTNPIN);
|
oappendi(BTNPIN);
|
||||||
oappend("\r\nstrip-pin: gpio");
|
oappend("\r\nstrip-pin: gpio");
|
||||||
oappendi(LEDPIN);
|
oappendi(LEDPIN);
|
||||||
oappend("\r\nbrand: wled\r\n");
|
oappend("\r\nbrand: wled");
|
||||||
oappend("\r\nbuild-type: src\r\n");
|
oappend("\r\nbuild-type: dev\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -150,56 +150,65 @@ void handleNotifications()
|
|||||||
olen = 0;
|
olen = 0;
|
||||||
notifierUdp.read(obuf, packetSize);
|
notifierUdp.read(obuf, packetSize);
|
||||||
char* udpIn = obuf;
|
char* udpIn = obuf;
|
||||||
|
|
||||||
if (udpIn[0] == 0 && !realtimeActive && receiveNotifications) //wled notifier, block if realtime packets active
|
//wled notifier, block if realtime packets active
|
||||||
|
if (udpIn[0] == 0 && !realtimeActive && receiveNotifications)
|
||||||
{
|
{
|
||||||
|
//apply colors from notification
|
||||||
if (receiveNotificationColor)
|
if (receiveNotificationColor)
|
||||||
{
|
{
|
||||||
col[0] = udpIn[3];
|
col[0] = udpIn[3];
|
||||||
col[1] = udpIn[4];
|
col[1] = udpIn[4];
|
||||||
col[2] = udpIn[5];
|
col[2] = udpIn[5];
|
||||||
}
|
if (udpIn[11] > 0) //check if sending modules white val is inteded
|
||||||
if (udpIn[11] > 0 && receiveNotificationColor) //check if sending modules white val is inteded
|
|
||||||
{
|
|
||||||
white = udpIn[10];
|
|
||||||
if (udpIn[11] > 1 )
|
|
||||||
{
|
{
|
||||||
colSec[0] = udpIn[12];
|
white = udpIn[10];
|
||||||
colSec[1] = udpIn[13];
|
if (udpIn[11] > 1)
|
||||||
colSec[2] = udpIn[14];
|
{
|
||||||
whiteSec = udpIn[15];
|
colSec[0] = udpIn[12];
|
||||||
|
colSec[1] = udpIn[13];
|
||||||
|
colSec[2] = udpIn[14];
|
||||||
|
whiteSec = udpIn[15];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (udpIn[8] != effectCurrent && receiveNotificationEffects)
|
|
||||||
|
//apply effects from notification
|
||||||
|
if (receiveNotificationEffects)
|
||||||
{
|
{
|
||||||
effectCurrent = udpIn[8];
|
if (udpIn[8] != effectCurrent)
|
||||||
strip.setMode(effectCurrent);
|
{
|
||||||
}
|
effectCurrent = udpIn[8];
|
||||||
if (udpIn[9] != effectSpeed && receiveNotificationEffects)
|
strip.setMode(effectCurrent);
|
||||||
{
|
}
|
||||||
effectSpeed = udpIn[9];
|
if (udpIn[9] != effectSpeed)
|
||||||
strip.setSpeed(effectSpeed);
|
{
|
||||||
}
|
effectSpeed = udpIn[9];
|
||||||
if (udpIn[11] > 2 && udpIn[16] != effectIntensity && receiveNotificationEffects)
|
strip.setSpeed(effectSpeed);
|
||||||
{
|
}
|
||||||
effectIntensity = udpIn[16];
|
if (udpIn[11] > 2 && udpIn[16] != effectIntensity)
|
||||||
strip.setIntensity(effectIntensity);
|
{
|
||||||
|
effectIntensity = udpIn[16];
|
||||||
|
strip.setIntensity(effectIntensity);
|
||||||
|
}
|
||||||
|
if (udpIn[11] > 4 && udpIn[19] != effectPalette)
|
||||||
|
{
|
||||||
|
effectPalette = udpIn[19];
|
||||||
|
strip.setPalette(effectPalette);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (udpIn[11] > 3)
|
if (udpIn[11] > 3)
|
||||||
{
|
{
|
||||||
transitionDelayTemp = ((udpIn[17] << 0) & 0xFF) + ((udpIn[18] << 8) & 0xFF00);
|
transitionDelayTemp = ((udpIn[17] << 0) & 0xFF) + ((udpIn[18] << 8) & 0xFF00);
|
||||||
}
|
}
|
||||||
if (udpIn[11] > 4 && udpIn[19] != effectPalette && receiveNotificationEffects)
|
|
||||||
{
|
|
||||||
effectPalette = udpIn[19];
|
|
||||||
strip.setPalette(effectPalette);
|
|
||||||
}
|
|
||||||
nightlightActive = udpIn[6];
|
nightlightActive = udpIn[6];
|
||||||
if (!nightlightActive)
|
if (nightlightActive) nightlightDelayMins = udpIn[7];
|
||||||
{
|
|
||||||
if (receiveNotificationBrightness) bri = udpIn[2];
|
if (receiveNotificationBrightness) bri = udpIn[2];
|
||||||
colorUpdated(3);
|
colorUpdated(3);
|
||||||
}
|
|
||||||
} else if (udpIn[0] > 0 && udpIn[0] < 4 && receiveDirect) //1 warls //2 drgb //3 drgbw
|
} else if (udpIn[0] > 0 && udpIn[0] < 4 && receiveDirect) //1 warls //2 drgb //3 drgbw
|
||||||
{
|
{
|
||||||
realtimeIP = notifierUdp.remoteIP();
|
realtimeIP = notifierUdp.remoteIP();
|
||||||
|
Loading…
Reference in New Issue
Block a user