mirror of
https://github.com/wled/WLED.git
synced 2025-07-25 11:46:34 +00:00
Add udpNotifier2 (JSON+HTTP, closes #1205 )
Added Loxone defines Fix missing timezones (#1201)
This commit is contained in:
parent
b10ab358da
commit
8d3ff16037
@ -62,7 +62,31 @@ void colorHStoRGB(uint16_t hue, byte sat, byte* rgb) //hue, sat to rgb
|
|||||||
if (useRGBW && strip.rgbwMode == RGBW_MODE_LEGACY) colorRGBtoRGBW(col);
|
if (useRGBW && strip.rgbwMode == RGBW_MODE_LEGACY) colorRGBtoRGBW(col);
|
||||||
}
|
}
|
||||||
|
|
||||||
void colorCTtoRGB(uint16_t mired, byte* rgb) //white spectrum to rgb
|
void colorKtoRGB(uint16_t kelvin, byte* rgb) //white spectrum to rgb, calc
|
||||||
|
{
|
||||||
|
float r = 0, g = 0, b = 0;
|
||||||
|
float temp = kelvin / 100;
|
||||||
|
if (temp <= 66) {
|
||||||
|
r = 255;
|
||||||
|
g = round(99.4708025861 * log(temp) - 161.1195681661);
|
||||||
|
if (temp <= 19) {
|
||||||
|
b = 0;
|
||||||
|
} else {
|
||||||
|
b = round(138.5177312231 * log((temp - 10)) - 305.0447927307);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
r = round(329.698727446 * pow((temp - 60), -0.1332047592));
|
||||||
|
g = round(288.1221695283 * pow((temp - 60), -0.0755148492));
|
||||||
|
b = 255;
|
||||||
|
}
|
||||||
|
g += 15; //mod by Aircoookie, a bit less accurate but visibly less pinkish
|
||||||
|
rgb[0] = (uint8_t) constrain(r, 0, 255);
|
||||||
|
rgb[1] = (uint8_t) constrain(g, 0, 255);
|
||||||
|
rgb[2] = (uint8_t) constrain(b, 0, 255);
|
||||||
|
rgb[3] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void colorCTtoRGB(uint16_t mired, byte* rgb) //white spectrum to rgb, bins
|
||||||
{
|
{
|
||||||
//this is only an approximation using WS2812B with gamma correction enabled
|
//this is only an approximation using WS2812B with gamma correction enabled
|
||||||
if (mired > 475) {
|
if (mired > 475) {
|
||||||
|
@ -31,16 +31,14 @@ Infrared remote:
|
|||||||
<a href="https://github.com/Aircoookie/WLED/wiki/Infrared-Control" target="_blank">IR info</a>
|
<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" type="number" min="1" max="65535" class="d5" required><br>
|
UDP Port: <input name="UP" type="number" min="1" max="65535" class="d5" required><br>
|
||||||
|
2nd Port: <input name="U2" type="number" min="1" max="65535" class="d5" required><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>
|
||||||
Send notifications on direct change: <input type="checkbox" name="SD"><br>
|
Send notifications on direct change: <input type="checkbox" name="SD"><br>
|
||||||
Send notifications on button press: <input type="checkbox" name="SB"><br>
|
Send notifications on button press: <input type="checkbox" name="SB"><br>
|
||||||
Send Alexa notifications: <input type="checkbox" name="SA"><br>
|
Send Alexa notifications: <input type="checkbox" name="SA"><br>
|
||||||
Send Philips Hue change notifications: <input type="checkbox" name="SH"><br>
|
Send Philips Hue change notifications: <input type="checkbox" name="SH"><br>
|
||||||
Send Macro notifications: <input type="checkbox" name="SM"><br>
|
Send Macro notifications: <input type="checkbox" name="SM"><br>
|
||||||
Send notifications twice: <input type="checkbox" name="S2">
|
Send notifications twice: <input type="checkbox" name="S2"><br>
|
||||||
<h3>UDP Api</h3>
|
|
||||||
Enable UDP Api: <input type="checkbox" name="UAE"><br>
|
|
||||||
Port: <input name="UAP" type="number" min="1" max="65535" class="d5"><br>
|
|
||||||
<i>Reboot required to apply changes. </i>
|
<i>Reboot required to apply changes. </i>
|
||||||
<h3>Realtime</h3>
|
<h3>Realtime</h3>
|
||||||
Receive UDP realtime: <input type="checkbox" name="RD"><br><br>
|
Receive UDP realtime: <input type="checkbox" name="RD"><br><br>
|
||||||
|
@ -103,7 +103,11 @@
|
|||||||
<option value="10">JST(KST)</option>
|
<option value="10">JST(KST)</option>
|
||||||
<option value="11">AEST/AEDT</option>
|
<option value="11">AEST/AEDT</option>
|
||||||
<option value="12">NZST/NZDT</option>
|
<option value="12">NZST/NZDT</option>
|
||||||
<option value="13">North Korea</option>
|
<option value="13">North Korea</option>
|
||||||
|
<option value="14">IST (India)</option>
|
||||||
|
<option value="15">CA-Saskatchewan</option>
|
||||||
|
<option value="16">ACST</option>
|
||||||
|
<option value="17">ACST/ACDT</option>
|
||||||
</select><br>
|
</select><br>
|
||||||
UTC offset: <input name="UO" type="number" min="-65500" max="65500" required> seconds (max. 18 hours)<br>
|
UTC offset: <input name="UO" type="number" min="-65500" max="65500" required> seconds (max. 18 hours)<br>
|
||||||
Current local time is <span class="times">unknown</span>.
|
Current local time is <span class="times">unknown</span>.
|
||||||
|
@ -30,6 +30,7 @@ void colorFromUint32(uint32_t in, bool secondary = false);
|
|||||||
void colorFromUint24(uint32_t in, bool secondary = false);
|
void colorFromUint24(uint32_t in, bool secondary = false);
|
||||||
void relativeChangeWhite(int8_t amount, byte lowerBoundary = 0);
|
void relativeChangeWhite(int8_t amount, byte lowerBoundary = 0);
|
||||||
void colorHStoRGB(uint16_t hue, byte sat, byte* rgb); //hue, sat to rgb
|
void colorHStoRGB(uint16_t hue, byte sat, byte* rgb); //hue, sat to rgb
|
||||||
|
void colorKtoRGB(uint16_t kelvin, byte* rgb);
|
||||||
void colorCTtoRGB(uint16_t mired, byte* rgb); //white spectrum to rgb
|
void colorCTtoRGB(uint16_t mired, byte* rgb); //white spectrum to rgb
|
||||||
|
|
||||||
void colorXYtoRGB(float x, float y, byte* rgb); // only defined if huesync disabled TODO
|
void colorXYtoRGB(float x, float y, byte* rgb); // only defined if huesync disabled TODO
|
||||||
@ -102,6 +103,10 @@ void updateInterfaces(uint8_t callMode);
|
|||||||
void handleTransitions();
|
void handleTransitions();
|
||||||
void handleNightlight();
|
void handleNightlight();
|
||||||
|
|
||||||
|
//lx_parser.cpp
|
||||||
|
bool parseLx(int lxValue, byte* rgbw);
|
||||||
|
void parseLxJson(int lxValue, byte segId, bool secondary);
|
||||||
|
|
||||||
//mqtt.cpp
|
//mqtt.cpp
|
||||||
bool initMqtt();
|
bool initMqtt();
|
||||||
void publishMqtt();
|
void publishMqtt();
|
||||||
@ -223,7 +228,4 @@ void sappend(char stype, const char* key, int val);
|
|||||||
void sappends(char stype, const char* key, char* val);
|
void sappends(char stype, const char* key, char* val);
|
||||||
void getSettingsJS(byte subPage, char* dest);
|
void getSettingsJS(byte subPage, char* dest);
|
||||||
|
|
||||||
//lx_parser.cpp
|
|
||||||
bool parseLx(int lxValue, int rgbw[4]);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -167,163 +167,163 @@ const char PAGE_settings_dmx[] PROGMEM = R"=====()=====";
|
|||||||
// Autogenerated from wled00/data/settings_ui.htm, do not edit!!
|
// Autogenerated from wled00/data/settings_ui.htm, do not edit!!
|
||||||
const char PAGE_settings_ui[] PROGMEM = R"=====(<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport"
|
const char PAGE_settings_ui[] PROGMEM = R"=====(<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport"
|
||||||
content="width=500"><title>UI Settings</title><script>var d = document;
|
content="width=500"><title>UI Settings</title><script>var d = document;
|
||||||
var initial_ds, initial_st;
|
var initial_ds, initial_st;
|
||||||
var sett = null;
|
var sett = null;
|
||||||
var l = {
|
var l = {
|
||||||
"comp":{
|
"comp":{
|
||||||
"labels":"Show button labels",
|
"labels":"Show button labels",
|
||||||
"colors":{
|
"colors":{
|
||||||
"LABEL":"Color selection methods",
|
"LABEL":"Color selection methods",
|
||||||
"picker": "Color Wheel",
|
"picker": "Color Wheel",
|
||||||
"rgb": "RGB sliders",
|
"rgb": "RGB sliders",
|
||||||
"quick": "Quick color selectors",
|
"quick": "Quick color selectors",
|
||||||
"hex": "HEX color input"
|
"hex": "HEX color input"
|
||||||
},
|
},
|
||||||
"pcmbot": "Show bottom tab bar in PC mode"
|
"pcmbot": "Show bottom tab bar in PC mode"
|
||||||
},
|
},
|
||||||
"theme":{
|
"theme":{
|
||||||
"alpha": {
|
"alpha": {
|
||||||
"bg":"Background opacity",
|
"bg":"Background opacity",
|
||||||
"tab":"Button opacity"
|
"tab":"Button opacity"
|
||||||
},
|
},
|
||||||
"bg":{
|
"bg":{
|
||||||
"url":"BG image URL"
|
"url":"BG image URL"
|
||||||
},
|
},
|
||||||
"color":{
|
"color":{
|
||||||
"bg":"BG HEX color"
|
"bg":"BG HEX color"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
|
||||||
function gId(s)
|
|
||||||
{
|
|
||||||
return d.getElementById(s);
|
|
||||||
}
|
|
||||||
function isObject(item) {
|
|
||||||
return (item && typeof item === 'object' && !Array.isArray(item));
|
|
||||||
}
|
|
||||||
function set(path, obj, val) {
|
|
||||||
var tar = obj;
|
|
||||||
var pList = path.split('_');
|
|
||||||
var len = pList.length;
|
|
||||||
for(var i = 0; i < len-1; i++) {
|
|
||||||
var elem = pList[i];
|
|
||||||
if( !tar[elem] ) tar[elem] = {}
|
|
||||||
tar = tar[elem];
|
|
||||||
}
|
|
||||||
|
|
||||||
tar[pList[len-1]] = val;
|
};
|
||||||
}
|
function gId(s)
|
||||||
|
{
|
||||||
|
return d.getElementById(s);
|
||||||
|
}
|
||||||
|
function isObject(item) {
|
||||||
|
return (item && typeof item === 'object' && !Array.isArray(item));
|
||||||
|
}
|
||||||
|
function set(path, obj, val) {
|
||||||
|
var tar = obj;
|
||||||
|
var pList = path.split('_');
|
||||||
|
var len = pList.length;
|
||||||
|
for(var i = 0; i < len-1; i++) {
|
||||||
|
var elem = pList[i];
|
||||||
|
if( !tar[elem] ) tar[elem] = {}
|
||||||
|
tar = tar[elem];
|
||||||
|
}
|
||||||
|
|
||||||
function addRec(s, path = "", label = null)
|
tar[pList[len-1]] = val;
|
||||||
{
|
}
|
||||||
var str = "";
|
|
||||||
for (i in s)
|
|
||||||
{
|
|
||||||
var fk = path + (path?'_':'') + i;
|
|
||||||
if (isObject(s[i])) {
|
|
||||||
if (label && label[i] && label[i]["LABEL"]) str += `<h3>${label[i]["LABEL"]}</h3>`;
|
|
||||||
str += addRec(s[i], fk, label? label[i] : null);
|
|
||||||
} else {
|
|
||||||
var lb = fk;
|
|
||||||
if (label && label[i]) lb = label[i];
|
|
||||||
else if (s[i+'LABEL']) lb = s[i+'LABEL'];
|
|
||||||
if (i.indexOf('LABEL') > 0) continue;
|
|
||||||
var t = typeof s[i];
|
|
||||||
if (gId(fk)) { //already exists
|
|
||||||
if(t === 'boolean')
|
|
||||||
{
|
|
||||||
gId(fk).checked = s[i];
|
|
||||||
} else {
|
|
||||||
gId(fk).value = s[i];
|
|
||||||
}
|
|
||||||
if (gId(fk).previousElementSibling.matches('.l')) {
|
|
||||||
gId(fk).previousElementSibling.innerHTML = lb;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if(t === 'boolean')
|
|
||||||
{
|
|
||||||
str += `${lb}: <input class="agi cb" type="checkbox" id=${fk} ${s[i]?"checked":""}><br>`;
|
|
||||||
} else if (t === 'number')
|
|
||||||
{
|
|
||||||
str += `${lb}: <input class="agi" type="number" id=${fk} value=${s[i]}><br>`;
|
|
||||||
} else if (t === 'string')
|
|
||||||
{
|
|
||||||
str += `${lb}:<br><input class="agi" id=${fk} value=${s[i]}><br>`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
function genForm(s) {
|
function addRec(s, path = "", label = null)
|
||||||
var str = "";
|
{
|
||||||
str = addRec(s,"",l);
|
var str = "";
|
||||||
|
for (i in s)
|
||||||
gId('gen').innerHTML = str;
|
{
|
||||||
}
|
var fk = path + (path?'_':'') + i;
|
||||||
function GetLS()
|
if (isObject(s[i])) {
|
||||||
{
|
if (label && label[i] && label[i]["LABEL"]) str += `<h3>${label[i]["LABEL"]}</h3>`;
|
||||||
sett = localStorage.getItem('wledUiCfg');
|
str += addRec(s[i], fk, label? label[i] : null);
|
||||||
if (!sett) gId('lserr').style.display = "inline";
|
} else {
|
||||||
try {
|
var lb = fk;
|
||||||
sett = JSON.parse(sett);
|
if (label && label[i]) lb = label[i];
|
||||||
} catch (e) {
|
else if (s[i+'LABEL']) lb = s[i+'LABEL'];
|
||||||
sett = {};
|
if (i.indexOf('LABEL') > 0) continue;
|
||||||
gId('lserr').style.display = "inline";
|
var t = typeof s[i];
|
||||||
gId('lserr').innerHTML = "⚠ Settings JSON parsing failed. (" + e + ")";
|
if (gId(fk)) { //already exists
|
||||||
}
|
if(t === 'boolean')
|
||||||
genForm(sett);
|
{
|
||||||
gId('dm').checked = (gId('theme_base').value === 'light');
|
gId(fk).checked = s[i];
|
||||||
}
|
} else {
|
||||||
|
gId(fk).value = s[i];
|
||||||
function SetLS()
|
}
|
||||||
{
|
if (gId(fk).previousElementSibling.matches('.l')) {
|
||||||
var l = d.querySelectorAll('.agi');
|
gId(fk).previousElementSibling.innerHTML = lb;
|
||||||
for (var i = 0; i < l.length; i++) {
|
}
|
||||||
var e = l[i];
|
} else {
|
||||||
var val = e.classList.contains('cb') ? e.checked : e.value;
|
if(t === 'boolean')
|
||||||
set(e.id, sett, val);
|
{
|
||||||
console.log(`${e.id} set to ${val}`);
|
str += `${lb}: <input class="agi cb" type="checkbox" id=${fk} ${s[i]?"checked":""}><br>`;
|
||||||
}
|
} else if (t === 'number')
|
||||||
try {
|
{
|
||||||
localStorage.setItem('wledUiCfg', JSON.stringify(sett));
|
str += `${lb}: <input class="agi" type="number" id=${fk} value=${s[i]}><br>`;
|
||||||
gId('lssuc').style.display = "inline";
|
} else if (t === 'string')
|
||||||
} catch (e) {
|
{
|
||||||
gId('lssuc').style.display = "none";
|
str += `${lb}:<br><input class="agi" id=${fk} value=${s[i]}><br>`;
|
||||||
gId('lserr').style.display = "inline";
|
}
|
||||||
gId('lserr').innerHTML = "⚠ Settings JSON saving failed. (" + e + ")";
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return str;
|
||||||
function Save() {
|
}
|
||||||
SetLS();
|
|
||||||
if (d.Sf.DS.value != initial_ds || d.Sf.ST.checked != initial_st) d.Sf.submit();
|
function genForm(s) {
|
||||||
}
|
var str = "";
|
||||||
|
str = addRec(s,"",l);
|
||||||
function S()
|
|
||||||
{
|
gId('gen').innerHTML = str;
|
||||||
GetV();
|
}
|
||||||
initial_ds = d.Sf.DS.value;
|
function GetLS()
|
||||||
initial_st = d.Sf.ST.checked;
|
{
|
||||||
GetLS();
|
sett = localStorage.getItem('wledUiCfg');
|
||||||
}
|
if (!sett) gId('lserr').style.display = "inline";
|
||||||
function H()
|
try {
|
||||||
{
|
sett = JSON.parse(sett);
|
||||||
window.open("https://github.com/Aircoookie/WLED/wiki/Settings#user-interface-settings");
|
} catch (e) {
|
||||||
}
|
sett = {};
|
||||||
function B()
|
gId('lserr').style.display = "inline";
|
||||||
{
|
gId('lserr').innerHTML = "⚠ Settings JSON parsing failed. (" + e + ")";
|
||||||
window.open("/settings","_self");
|
}
|
||||||
}
|
genForm(sett);
|
||||||
function UI()
|
gId('dm').checked = (gId('theme_base').value === 'light');
|
||||||
{
|
}
|
||||||
gId('idonthateyou').style.display = (gId('dm').checked) ? 'inline':'none';
|
|
||||||
var f = gId('theme_base');
|
function SetLS()
|
||||||
if (f) f.value = (gId('dm').checked) ? 'light':'dark';
|
{
|
||||||
}
|
var l = d.querySelectorAll('.agi');
|
||||||
function GetV() {var d=document;
|
for (var i = 0; i < l.length; i++) {
|
||||||
|
var e = l[i];
|
||||||
|
var val = e.classList.contains('cb') ? e.checked : e.value;
|
||||||
|
set(e.id, sett, val);
|
||||||
|
console.log(`${e.id} set to ${val}`);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
localStorage.setItem('wledUiCfg', JSON.stringify(sett));
|
||||||
|
gId('lssuc').style.display = "inline";
|
||||||
|
} catch (e) {
|
||||||
|
gId('lssuc').style.display = "none";
|
||||||
|
gId('lserr').style.display = "inline";
|
||||||
|
gId('lserr').innerHTML = "⚠ Settings JSON saving failed. (" + e + ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Save() {
|
||||||
|
SetLS();
|
||||||
|
if (d.Sf.DS.value != initial_ds || d.Sf.ST.checked != initial_st) d.Sf.submit();
|
||||||
|
}
|
||||||
|
|
||||||
|
function S()
|
||||||
|
{
|
||||||
|
GetV();
|
||||||
|
initial_ds = d.Sf.DS.value;
|
||||||
|
initial_st = d.Sf.ST.checked;
|
||||||
|
GetLS();
|
||||||
|
}
|
||||||
|
function H()
|
||||||
|
{
|
||||||
|
window.open("https://github.com/Aircoookie/WLED/wiki/Settings#user-interface-settings");
|
||||||
|
}
|
||||||
|
function B()
|
||||||
|
{
|
||||||
|
window.open("/settings","_self");
|
||||||
|
}
|
||||||
|
function UI()
|
||||||
|
{
|
||||||
|
gId('idonthateyou').style.display = (gId('dm').checked) ? 'inline':'none';
|
||||||
|
var f = gId('theme_base');
|
||||||
|
if (f) f.value = (gId('dm').checked) ? 'light':'dark';
|
||||||
|
}
|
||||||
|
function GetV() {var d=document;
|
||||||
%CSS%%SCSS%</head><body onload="S()">
|
%CSS%%SCSS%</head><body onload="S()">
|
||||||
<form id="form_s" name="Sf" method="post"><div
|
<form id="form_s" name="Sf" method="post"><div
|
||||||
style="position:sticky;top:0;background-color:#222"><div class="helpB"><button
|
style="position:sticky;top:0;background-color:#222"><div class="helpB"><button
|
||||||
@ -370,16 +370,16 @@ On/Off button enabled: <input type="checkbox" name="BT"><br>Infrared remote:
|
|||||||
9-key red</option></select><br><a
|
9-key red</option></select><br><a
|
||||||
href="https://github.com/Aircoookie/WLED/wiki/Infrared-Control" target="_blank">
|
href="https://github.com/Aircoookie/WLED/wiki/Infrared-Control" target="_blank">
|
||||||
IR info</a><h3>WLED Broadcast</h3>UDP Port: <input name="UP" type="number"
|
IR info</a><h3>WLED Broadcast</h3>UDP Port: <input name="UP" type="number"
|
||||||
min="1" max="65535" class="d5" required><br>Receive <input type="checkbox"
|
min="1" max="65535" class="d5" required><br>2nd Port: <input name="U2"
|
||||||
name="RB">Brightness, <input type="checkbox" name="RC">Color, and <input
|
type="number" min="1" max="65535" class="d5" required><br>Receive <input
|
||||||
type="checkbox" name="RX">Effects<br>Send notifications on direct change: <input
|
type="checkbox" name="RB">Brightness, <input type="checkbox" name="RC">
|
||||||
type="checkbox" name="SD"><br>Send notifications on button press: <input
|
Color, and <input type="checkbox" name="RX">Effects<br>
|
||||||
type="checkbox" name="SB"><br>Send Alexa notifications: <input type="checkbox"
|
Send notifications on direct change: <input type="checkbox" name="SD"><br>
|
||||||
name="SA"><br>Send Philips Hue change notifications: <input type="checkbox"
|
Send notifications on button press: <input type="checkbox" name="SB"><br>
|
||||||
name="SH"><br>Send Macro notifications: <input type="checkbox" name="SM"><br>
|
Send Alexa notifications: <input type="checkbox" name="SA"><br>
|
||||||
Send notifications twice: <input type="checkbox" name="S2"><h3>UDP Api</h3>
|
Send Philips Hue change notifications: <input type="checkbox" name="SH"><br>
|
||||||
Enable UDP Api: <input type="checkbox" name="UAE"><br>Port: <input name="UAP"
|
Send Macro notifications: <input type="checkbox" name="SM"><br>
|
||||||
type="number" min="1" max="65535" class="d5"><br><i>
|
Send notifications twice: <input type="checkbox" name="S2"><br><i>
|
||||||
Reboot required to apply changes.</i><h3>Realtime</h3>Receive UDP realtime:
|
Reboot required to apply changes.</i><h3>Realtime</h3>Receive UDP realtime:
|
||||||
<input type="checkbox" name="RD"><br><br><i>Network DMX input</i><br>Type:
|
<input type="checkbox" name="RD"><br><br><i>Network DMX input</i><br>Type:
|
||||||
<select name="DI" onchange="SP(),adj()"><option value="5568">E1.31 (sACN)
|
<select name="DI" onchange="SP(),adj()"><option value="5568">E1.31 (sACN)
|
||||||
@ -453,7 +453,9 @@ value="5">US-CST/CDT</option><option value="6">US-MST/MDT</option><option
|
|||||||
value="7">US-AZ</option><option value="8">US-PST/PDT</option><option value="9">
|
value="7">US-AZ</option><option value="8">US-PST/PDT</option><option value="9">
|
||||||
CST(AWST)</option><option value="10">JST(KST)</option><option value="11">
|
CST(AWST)</option><option value="10">JST(KST)</option><option value="11">
|
||||||
AEST/AEDT</option><option value="12">NZST/NZDT</option><option value="13">
|
AEST/AEDT</option><option value="12">NZST/NZDT</option><option value="13">
|
||||||
North Korea</option></select><br>UTC offset: <input name="UO" type="number"
|
North Korea</option><option value="14">IST (India)</option><option value="15">
|
||||||
|
CA-Saskatchewan</option><option value="16">ACST</option><option value="17">
|
||||||
|
ACST/ACDT</option></select><br>UTC offset: <input name="UO" type="number"
|
||||||
min="-65500" max="65500" required> seconds (max. 18 hours)<br>
|
min="-65500" max="65500" required> seconds (max. 18 hours)<br>
|
||||||
Current local time is <span class="times">unknown</span>.<h3>Clock</h3>
|
Current local time is <span class="times">unknown</span>.<h3>Clock</h3>
|
||||||
Clock Overlay: <select name="OL" onchange="Cs()"><option value="0" id="cn"
|
Clock Overlay: <select name="OL" onchange="Cs()"><option value="0" id="cn"
|
||||||
|
@ -44,7 +44,14 @@ void deserializeSegment(JsonObject elem, byte it)
|
|||||||
int rgbw[] = {0,0,0,0};
|
int rgbw[] = {0,0,0,0};
|
||||||
byte cp = copyArray(colX, rgbw);
|
byte cp = copyArray(colX, rgbw);
|
||||||
|
|
||||||
if (cp == 1 && rgbw[0] == 0) seg.colors[i] = 0;
|
if (cp == 1) {
|
||||||
|
if (rgbw[0] == 0) seg.colors[i] = 0;
|
||||||
|
else {
|
||||||
|
byte ctrgb[] = {0,0,0,0};
|
||||||
|
colorKtoRGB(rgbw[0], ctrgb);
|
||||||
|
for (uint8_t c = 0; c < 3; c++) rgbw[c] = ctrgb[c];
|
||||||
|
}
|
||||||
|
}
|
||||||
if (id == strip.getMainSegmentId() && i < 2) //temporary, to make transition work on main segment
|
if (id == strip.getMainSegmentId() && i < 2) //temporary, to make transition work on main segment
|
||||||
{
|
{
|
||||||
if (i == 0) {col[0] = rgbw[0]; col[1] = rgbw[1]; col[2] = rgbw[2]; col[3] = rgbw[3];}
|
if (i == 0) {col[0] = rgbw[0]; col[1] = rgbw[1]; col[2] = rgbw[2]; col[3] = rgbw[3];}
|
||||||
@ -57,56 +64,16 @@ void deserializeSegment(JsonObject elem, byte it)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// lx parser
|
// lx parser
|
||||||
|
#ifdef WLED_ENABLE_LOXONE
|
||||||
int lx = elem[F("lx")] | -1;
|
int lx = elem[F("lx")] | -1;
|
||||||
if (lx > 0) {
|
if (lx > 0) {
|
||||||
DEBUG_PRINT(F("LX: Lox primary = "));
|
parseLxJson(lx, id, false);
|
||||||
DEBUG_PRINTLN(lx);
|
|
||||||
int rgbw[] = {0,0,0,0};
|
|
||||||
if (parseLx(lx, rgbw)) {
|
|
||||||
if (bri == 0) {
|
|
||||||
DEBUG_PRINTLN(F("LX: turn on"));
|
|
||||||
toggleOnOff();
|
|
||||||
}
|
|
||||||
bri = 255;
|
|
||||||
nightlightActive = false; //always disable nightlight when toggling
|
|
||||||
if (id == strip.getMainSegmentId()) {
|
|
||||||
DEBUG_PRINTLN(F("LX: main segment"));
|
|
||||||
col[0] = rgbw[0];
|
|
||||||
col[1] = rgbw[1];
|
|
||||||
col[2] = rgbw[2];
|
|
||||||
col[3] = rgbw[3];
|
|
||||||
} else {
|
|
||||||
DEBUG_PRINT(F("LX: segment "));
|
|
||||||
DEBUG_PRINTLN(id);
|
|
||||||
seg.colors[0] = ((rgbw[3] << 24) | ((rgbw[0]&0xFF) << 16) | ((rgbw[1]&0xFF) << 8) | ((rgbw[2]&0xFF)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
int ly = elem[F("ly")] | -1;
|
int ly = elem[F("ly")] | -1;
|
||||||
if (ly > 0) {
|
if (ly > 0) {
|
||||||
DEBUG_PRINT(F("LY: Lox secondary = "));
|
parseLxJson(ly, id, true);
|
||||||
Serial.println(ly);
|
|
||||||
int rgbw[] = {0,0,0,0};
|
|
||||||
if (parseLx(ly, rgbw)) {
|
|
||||||
if (bri == 0) {
|
|
||||||
DEBUG_PRINTLN(F("LY: turn on"));
|
|
||||||
toggleOnOff();
|
|
||||||
}
|
|
||||||
bri = 255;
|
|
||||||
nightlightActive = false; //always disable nightlight when toggling
|
|
||||||
if (id == strip.getMainSegmentId()) {
|
|
||||||
DEBUG_PRINTLN(F("LY: main segment"));
|
|
||||||
colSec[0] = rgbw[0];
|
|
||||||
colSec[1] = rgbw[1];
|
|
||||||
colSec[2] = rgbw[2];
|
|
||||||
colSec[3] = rgbw[3];
|
|
||||||
} else {
|
|
||||||
DEBUG_PRINT(F("LY: segment "));
|
|
||||||
DEBUG_PRINTLN(id);
|
|
||||||
seg.colors[1] = ((rgbw[3] << 24) | ((rgbw[0]&0xFF) << 16) | ((rgbw[1]&0xFF) << 8) | ((rgbw[2]&0xFF)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//if (pal != seg.palette && pal < strip.getPaletteCount()) strip.setPalette(pal);
|
//if (pal != seg.palette && pal < strip.getPaletteCount()) strip.setPalette(pal);
|
||||||
seg.setOption(SEG_OPTION_SELECTED, elem[F("sel")] | seg.getOption(SEG_OPTION_SELECTED));
|
seg.setOption(SEG_OPTION_SELECTED, elem[F("sel")] | seg.getOption(SEG_OPTION_SELECTED));
|
||||||
@ -507,7 +474,7 @@ void serializeInfo(JsonObject root)
|
|||||||
|
|
||||||
root[F("brand")] = "WLED";
|
root[F("brand")] = "WLED";
|
||||||
root[F("product")] = F("FOSS");
|
root[F("product")] = F("FOSS");
|
||||||
root[F("mac")] = escapedMac;
|
root["mac"] = escapedMac;
|
||||||
}
|
}
|
||||||
|
|
||||||
void serveJson(AsyncWebServerRequest* request)
|
void serveJson(AsyncWebServerRequest* request)
|
||||||
|
@ -1,11 +1,16 @@
|
|||||||
#include "wled.h"
|
#include "wled.h"
|
||||||
|
|
||||||
bool parseLx(int lxValue, int rgbw[4])
|
/*
|
||||||
|
* Parser for Loxone formats
|
||||||
|
*/
|
||||||
|
bool parseLx(int lxValue, byte rgbw[4])
|
||||||
{
|
{
|
||||||
|
#ifdef WLED_ENABLE_LOXONE
|
||||||
|
DEBUG_PRINT(F("LX: Lox = "));
|
||||||
|
DEBUG_PRINTLN(lxValue);
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
float lxRed = 0;
|
float lxRed = 0, lxGreen = 0, lxBlue = 0;
|
||||||
float lxGreen = 0;
|
|
||||||
float lxBlue = 0;
|
|
||||||
|
|
||||||
if (lxValue < 200000000) {
|
if (lxValue < 200000000) {
|
||||||
// Loxone RGB
|
// Loxone RGB
|
||||||
@ -21,58 +26,52 @@ bool parseLx(int lxValue, int rgbw[4])
|
|||||||
float temp = 0;
|
float temp = 0;
|
||||||
|
|
||||||
tmpBri *= 2.55;
|
tmpBri *= 2.55;
|
||||||
if (tmpBri < 0) {
|
constrain(tmpBri, 0, 255);
|
||||||
tmpBri = 0;
|
|
||||||
} else if (tmpBri > 255) {
|
colorKtoRGB(ct, rgbw);
|
||||||
tmpBri = 255;
|
lxRed = rgbw[0]; lxGreen = rgbw[1]; lxBlue = rgbw[2];
|
||||||
}
|
|
||||||
if (ct < 2700) {
|
|
||||||
ct = 2700;
|
|
||||||
} else if (ct > 6500) {
|
|
||||||
ct = 6500;
|
|
||||||
}
|
|
||||||
|
|
||||||
temp = ct / 100;
|
|
||||||
if (temp <= 66) {
|
|
||||||
lxRed = 255;
|
|
||||||
lxGreen = round(99.4708025861 * log(temp) - 161.1195681661);
|
|
||||||
if (temp <= 19) {
|
|
||||||
lxBlue = 0;
|
|
||||||
} else {
|
|
||||||
lxBlue = round(138.5177312231 * log((temp - 10)) - 305.0447927307);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
lxRed = round(329.698727446 * pow((temp - 60), -0.1332047592));
|
|
||||||
lxGreen = round(288.1221695283 * pow((temp - 60), -0.0755148492));
|
|
||||||
lxBlue = 255;
|
|
||||||
}
|
|
||||||
lxRed *= (tmpBri/255);
|
lxRed *= (tmpBri/255);
|
||||||
lxGreen *= (tmpBri/255);
|
lxGreen *= (tmpBri/255);
|
||||||
lxBlue *= (tmpBri/255);
|
lxBlue *= (tmpBri/255);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ok) {
|
if (ok) {
|
||||||
if (lxRed > 255) {
|
rgbw[0] = (uint8_t) constrain(lxRed, 0, 255);
|
||||||
lxRed = 255;
|
rgbw[1] = (uint8_t) constrain(lxGreen, 0, 255);
|
||||||
} else if (lxRed < 0) {
|
rgbw[2] = (uint8_t) constrain(lxBlue, 0, 255);
|
||||||
lxRed = 0;
|
|
||||||
}
|
|
||||||
if (lxGreen > 255) {
|
|
||||||
lxGreen = 255;
|
|
||||||
} else if (lxGreen < 0) {
|
|
||||||
lxGreen = 0;
|
|
||||||
}
|
|
||||||
if (lxBlue > 255) {
|
|
||||||
lxBlue = 255;
|
|
||||||
} else if (lxBlue < 0) {
|
|
||||||
lxBlue = 0;
|
|
||||||
}
|
|
||||||
rgbw[0] = (uint8_t)lxRed;
|
|
||||||
rgbw[1] = (uint8_t)lxGreen;
|
|
||||||
rgbw[2] = (uint8_t)lxBlue;
|
|
||||||
rgbw[3] = 0;
|
rgbw[3] = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void parseLxJson(int lxValue, byte segId, bool secondary)
|
||||||
|
{
|
||||||
|
if (secondary) {
|
||||||
|
DEBUG_PRINT(F("LY: Lox secondary = "));
|
||||||
|
} else {
|
||||||
|
DEBUG_PRINT(F("LX: Lox primary = "));
|
||||||
|
}
|
||||||
|
DEBUG_PRINTLN(lxValue);
|
||||||
|
byte rgbw[] = {0,0,0,0};
|
||||||
|
if (parseLx(lxValue, rgbw)) {
|
||||||
|
if (bri == 0) {
|
||||||
|
DEBUG_PRINTLN(F("LX: turn on"));
|
||||||
|
toggleOnOff();
|
||||||
|
}
|
||||||
|
bri = 255;
|
||||||
|
nightlightActive = false; //always disable nightlight when toggling
|
||||||
|
if (segId == strip.getMainSegmentId()) {
|
||||||
|
DEBUG_PRINTLN(F("LX: main segment"));
|
||||||
|
if (secondary) for (byte i = 0; i < 4; i++) colSec[i] = rgbw[i];
|
||||||
|
else for (byte i = 0; i < 4; i++) col[i] = rgbw[i];
|
||||||
|
} else {
|
||||||
|
DEBUG_PRINT(F("LX: segment "));
|
||||||
|
DEBUG_PRINTLN(segId);
|
||||||
|
strip.getSegment(segId).colors[secondary] = ((rgbw[3] << 24) | ((rgbw[0]&0xFF) << 16) | ((rgbw[1]&0xFF) << 8) | ((rgbw[2]&0xFF)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -129,6 +129,8 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
|||||||
irEnabled = request->arg(F("IR")).toInt();
|
irEnabled = request->arg(F("IR")).toInt();
|
||||||
int t = request->arg(F("UP")).toInt();
|
int t = request->arg(F("UP")).toInt();
|
||||||
if (t > 0) udpPort = t;
|
if (t > 0) udpPort = t;
|
||||||
|
t = request->arg(F("U2")).toInt();
|
||||||
|
if (t > 0) udpPort2 = t;
|
||||||
receiveNotificationBrightness = request->hasArg(F("RB"));
|
receiveNotificationBrightness = request->hasArg(F("RB"));
|
||||||
receiveNotificationColor = request->hasArg(F("RC"));
|
receiveNotificationColor = request->hasArg(F("RC"));
|
||||||
receiveNotificationEffects = request->hasArg(F("RX"));
|
receiveNotificationEffects = request->hasArg(F("RX"));
|
||||||
@ -197,11 +199,6 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
|||||||
hueStoreAllowed = true;
|
hueStoreAllowed = true;
|
||||||
reconnectHue();
|
reconnectHue();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// UDP Api
|
|
||||||
udpApiEnabled = request->hasArg("UAE");
|
|
||||||
t = request->arg("UAP").toInt();
|
|
||||||
if (t > 0) udpApiPort = t;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//TIME
|
//TIME
|
||||||
@ -514,35 +511,27 @@ bool handleSet(AsyncWebServerRequest *request, const String& req)
|
|||||||
updateVal(&req, "B2=", &colSec[2]);
|
updateVal(&req, "B2=", &colSec[2]);
|
||||||
updateVal(&req, "W2=", &colSec[3]);
|
updateVal(&req, "W2=", &colSec[3]);
|
||||||
|
|
||||||
|
#ifdef WLED_ENABLE_LOXONE
|
||||||
//lox parser
|
//lox parser
|
||||||
int rgbw[4] = {0,0,0,0};
|
|
||||||
pos = req.indexOf(F("LX=")); // Lox primary color
|
pos = req.indexOf(F("LX=")); // Lox primary color
|
||||||
if (pos > 0) {
|
if (pos > 0) {
|
||||||
int lxValue = getNumVal(&req, pos);
|
int lxValue = getNumVal(&req, pos);
|
||||||
if (parseLx(lxValue, rgbw)) {
|
if (parseLx(lxValue, col)) {
|
||||||
col[0] = rgbw[0];
|
|
||||||
col[1] = rgbw[1];
|
|
||||||
col[2] = rgbw[2];
|
|
||||||
bri = 255;
|
bri = 255;
|
||||||
nightlightActive = false; //always disable nightlight when toggling
|
nightlightActive = false; //always disable nightlight when toggling
|
||||||
DEBUG_PRINT(F("LX: Lox primary = "));
|
|
||||||
DEBUG_PRINTLN(lxValue);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pos = req.indexOf(F("LY")); // Lox secondary color
|
pos = req.indexOf(F("LY=")); // Lox secondary color
|
||||||
if (pos > 0) {
|
if (pos > 0) {
|
||||||
int lxValue = getNumVal(&req, pos);
|
int lxValue = getNumVal(&req, pos);
|
||||||
if(parseLx(lxValue, rgbw)) {
|
if(parseLx(lxValue, colSec)) {
|
||||||
colSec[0] = rgbw[0];
|
|
||||||
colSec[1] = rgbw[1];
|
|
||||||
colSec[2] = rgbw[2];
|
|
||||||
bri = 255;
|
bri = 255;
|
||||||
nightlightActive = false; //always disable nightlight when toggling
|
nightlightActive = false; //always disable nightlight when toggling
|
||||||
DEBUG_PRINT(F("LY: Lox secondary = "));
|
|
||||||
DEBUG_PRINTLN(lxValue);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
//set hue
|
//set hue
|
||||||
pos = req.indexOf(F("HU="));
|
pos = req.indexOf(F("HU="));
|
||||||
if (pos > 0) {
|
if (pos > 0) {
|
||||||
@ -555,6 +544,12 @@ bool handleSet(AsyncWebServerRequest *request, const String& req)
|
|||||||
colorHStoRGB(temphue,tempsat,(req.indexOf(F("H2"))>0)? colSec:col);
|
colorHStoRGB(temphue,tempsat,(req.indexOf(F("H2"))>0)? colSec:col);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//set white spectrum (kelvin)
|
||||||
|
pos = req.indexOf(F("&K="));
|
||||||
|
if (pos > 0) {
|
||||||
|
colorKtoRGB(getNumVal(&req, pos),(req.indexOf(F("K2"))>0)? colSec:col);
|
||||||
|
}
|
||||||
|
|
||||||
//set color from HEX or 32bit DEC
|
//set color from HEX or 32bit DEC
|
||||||
pos = req.indexOf(F("CL="));
|
pos = req.indexOf(F("CL="));
|
||||||
if (pos > 0) {
|
if (pos > 0) {
|
||||||
|
@ -124,7 +124,12 @@ void handleNotifications()
|
|||||||
//receive UDP notifications
|
//receive UDP notifications
|
||||||
if (!udpConnected || !(receiveNotifications || receiveDirect)) return;
|
if (!udpConnected || !(receiveNotifications || receiveDirect)) return;
|
||||||
|
|
||||||
|
bool isSupp = false;
|
||||||
uint16_t packetSize = notifierUdp.parsePacket();
|
uint16_t packetSize = notifierUdp.parsePacket();
|
||||||
|
if (!packetSize && udp2Connected) {
|
||||||
|
packetSize = notifier2Udp.parsePacket();
|
||||||
|
isSupp = true;
|
||||||
|
}
|
||||||
|
|
||||||
//hyperion / raw RGB
|
//hyperion / raw RGB
|
||||||
if (!packetSize && udpRgbConnected) {
|
if (!packetSize && udpRgbConnected) {
|
||||||
@ -150,28 +155,13 @@ void handleNotifications()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// udp api
|
|
||||||
if (udpApiEnabled && !packetSize && udpApiConnected) {
|
|
||||||
packetSize = apiUdp.parsePacket();
|
|
||||||
if (packetSize) {
|
|
||||||
if (!receiveDirect) return;
|
|
||||||
if (packetSize > UDP_IN_MAXSIZE || packetSize < 3) return;
|
|
||||||
uint8_t lbuf[packetSize];
|
|
||||||
apiUdp.read(lbuf, packetSize);
|
|
||||||
lbuf[packetSize] = '\0';
|
|
||||||
String apireq = "win&";
|
|
||||||
apireq += (char*)lbuf;
|
|
||||||
handleSet(nullptr, apireq);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//notifier and UDP realtime
|
//notifier and UDP realtime
|
||||||
if (!packetSize || packetSize > UDP_IN_MAXSIZE) return;
|
if (!packetSize || packetSize > UDP_IN_MAXSIZE) return;
|
||||||
if (notifierUdp.remoteIP() == WiFi.localIP()) return; //don't process broadcasts we send ourselves
|
if (!isSupp && notifierUdp.remoteIP() == WiFi.localIP()) return; //don't process broadcasts we send ourselves
|
||||||
|
|
||||||
uint8_t udpIn[packetSize];
|
uint8_t udpIn[packetSize +1];
|
||||||
notifierUdp.read(udpIn, packetSize);
|
if (isSupp) notifier2Udp.read(udpIn, packetSize);
|
||||||
|
else notifierUdp.read(udpIn, packetSize);
|
||||||
|
|
||||||
//wled notifier, block if realtime packets active
|
//wled notifier, block if realtime packets active
|
||||||
if (udpIn[0] == 0 && !realtimeMode && receiveNotifications)
|
if (udpIn[0] == 0 && !realtimeMode && receiveNotifications)
|
||||||
@ -230,7 +220,7 @@ void handleNotifications()
|
|||||||
|
|
||||||
if (receiveNotificationBrightness || !someSel) bri = udpIn[2];
|
if (receiveNotificationBrightness || !someSel) bri = udpIn[2];
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_NOTIFICATION);
|
colorUpdated(NOTIFIER_CALL_MODE_NOTIFICATION);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (!receiveDirect) return;
|
if (!receiveDirect) return;
|
||||||
|
|
||||||
@ -245,7 +235,7 @@ void handleNotifications()
|
|||||||
}
|
}
|
||||||
if (tpmType != 0xda) return; //return if notTPM2.NET data
|
if (tpmType != 0xda) return; //return if notTPM2.NET data
|
||||||
|
|
||||||
realtimeIP = notifierUdp.remoteIP();
|
realtimeIP = (isSupp) ? notifier2Udp.remoteIP() : notifierUdp.remoteIP();
|
||||||
realtimeLock(realtimeTimeoutMs, REALTIME_MODE_TPM2NET);
|
realtimeLock(realtimeTimeoutMs, REALTIME_MODE_TPM2NET);
|
||||||
if (realtimeOverride) return;
|
if (realtimeOverride) return;
|
||||||
|
|
||||||
@ -269,13 +259,14 @@ void handleNotifications()
|
|||||||
tpmPacketCount = 0;
|
tpmPacketCount = 0;
|
||||||
strip.show();
|
strip.show();
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//UDP realtime: 1 warls 2 drgb 3 drgbw
|
//UDP realtime: 1 warls 2 drgb 3 drgbw
|
||||||
if (udpIn[0] > 0 && udpIn[0] < 5)
|
if (udpIn[0] > 0 && udpIn[0] < 5)
|
||||||
{
|
{
|
||||||
realtimeIP = notifierUdp.remoteIP();
|
realtimeIP = (isSupp) ? notifier2Udp.remoteIP() : notifierUdp.remoteIP();
|
||||||
DEBUG_PRINTLN(notifierUdp.remoteIP());
|
DEBUG_PRINTLN(realtimeIP);
|
||||||
if (packetSize < 2) return;
|
if (packetSize < 2) return;
|
||||||
|
|
||||||
if (udpIn[1] == 0)
|
if (udpIn[1] == 0)
|
||||||
@ -322,6 +313,21 @@ void handleNotifications()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
strip.show();
|
strip.show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// API over UDP
|
||||||
|
udpIn[packetSize] = '\0';
|
||||||
|
|
||||||
|
if (udpIn[0] >= 'A' && udpIn[0] <= 'Z') { //HTTP API
|
||||||
|
String apireq = "win&";
|
||||||
|
apireq += (char*)udpIn;
|
||||||
|
handleSet(nullptr, apireq);
|
||||||
|
} else if (udpIn[0] == '{') { //JSON API
|
||||||
|
DynamicJsonDocument jsonBuffer(2048);
|
||||||
|
DeserializationError error = deserializeJson(jsonBuffer, udpIn);
|
||||||
|
JsonObject root = jsonBuffer.as<JsonObject>();
|
||||||
|
if (!error && !root.isNull()) deserializeState(root);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,15 +264,15 @@ void WLED::initAP(bool resetAP)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (!apSSID[0] || resetAP)
|
if (!apSSID[0] || resetAP)
|
||||||
strcpy(apSSID, (const char*)F("WLED-AP"));
|
strcpy_P(apSSID, PSTR("WLED-AP"));
|
||||||
if (resetAP)
|
if (resetAP)
|
||||||
strcpy(apPass, DEFAULT_AP_PASS);
|
strcpy_P(apPass, PSTR(DEFAULT_AP_PASS));
|
||||||
DEBUG_PRINT(F("Opening access point "));
|
DEBUG_PRINT(F("Opening access point "));
|
||||||
DEBUG_PRINTLN(apSSID);
|
DEBUG_PRINTLN(apSSID);
|
||||||
WiFi.softAPConfig(IPAddress(4, 3, 2, 1), IPAddress(4, 3, 2, 1), IPAddress(255, 255, 255, 0));
|
WiFi.softAPConfig(IPAddress(4, 3, 2, 1), IPAddress(4, 3, 2, 1), IPAddress(255, 255, 255, 0));
|
||||||
WiFi.softAP(apSSID, apPass, apChannel, apHide);
|
WiFi.softAP(apSSID, apPass, apChannel, apHide);
|
||||||
|
|
||||||
if (!apActive) // start captive portal if AP active
|
if (!apActive) // start captive portal if AP active
|
||||||
{
|
{
|
||||||
DEBUG_PRINTLN(F("Init AP interfaces"));
|
DEBUG_PRINTLN(F("Init AP interfaces"));
|
||||||
server.begin();
|
server.begin();
|
||||||
@ -282,8 +282,8 @@ void WLED::initAP(bool resetAP)
|
|||||||
if (udpRgbPort > 0 && udpRgbPort != ntpLocalPort && udpRgbPort != udpPort) {
|
if (udpRgbPort > 0 && udpRgbPort != ntpLocalPort && udpRgbPort != udpPort) {
|
||||||
udpRgbConnected = rgbUdp.begin(udpRgbPort);
|
udpRgbConnected = rgbUdp.begin(udpRgbPort);
|
||||||
}
|
}
|
||||||
if (udpApiEnabled && udpApiPort > 0 && udpApiPort != ntpLocalPort && udpApiPort != udpPort && udpApiPort != udpRgbPort) {
|
if (udpPort2 > 0 && udpPort2 != ntpLocalPort && udpPort2 != udpPort && udpPort2 != udpRgbPort) {
|
||||||
udpApiConnected = apiUdp.begin(udpApiPort);
|
udp2Connected = notifier2Udp.begin(udpPort2);
|
||||||
}
|
}
|
||||||
|
|
||||||
dnsServer.setErrorReplyCode(DNSReplyCode::NoError);
|
dnsServer.setErrorReplyCode(DNSReplyCode::NoError);
|
||||||
@ -411,8 +411,8 @@ void WLED::initInterfaces()
|
|||||||
udpConnected = notifierUdp.begin(udpPort);
|
udpConnected = notifierUdp.begin(udpPort);
|
||||||
if (udpConnected && udpRgbPort != udpPort)
|
if (udpConnected && udpRgbPort != udpPort)
|
||||||
udpRgbConnected = rgbUdp.begin(udpRgbPort);
|
udpRgbConnected = rgbUdp.begin(udpRgbPort);
|
||||||
if (udpApiEnabled && udpConnected && udpApiPort != udpPort && udpApiPort != udpRgbPort)
|
if (udpConnected && udpPort2 != udpPort && udpPort2 != udpRgbPort)
|
||||||
udpApiConnected = apiUdp.begin(udpApiPort);
|
udp2Connected = notifier2Udp.begin(udpPort2);
|
||||||
}
|
}
|
||||||
if (ntpEnabled)
|
if (ntpEnabled)
|
||||||
ntpConnected = ntpUdp.begin(ntpLocalPort);
|
ntpConnected = ntpUdp.begin(ntpLocalPort);
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// version code in format yymmddb (b = daily build)
|
// version code in format yymmddb (b = daily build)
|
||||||
#define VERSION 2009202
|
#define VERSION 2009260
|
||||||
|
|
||||||
// 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.4.2 and the setting 512K(No SPIFFS).
|
// 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.4.2 and the setting 512K(No SPIFFS).
|
||||||
|
|
||||||
@ -30,11 +30,12 @@
|
|||||||
#endif
|
#endif
|
||||||
#define WLED_ENABLE_ADALIGHT // saves 500b only
|
#define WLED_ENABLE_ADALIGHT // saves 500b only
|
||||||
//#define WLED_ENABLE_DMX // uses 3.5kb (use LEDPIN other than 2)
|
//#define WLED_ENABLE_DMX // uses 3.5kb (use LEDPIN other than 2)
|
||||||
|
#define WLED_ENABLE_LOXONE // uses 1.2kb
|
||||||
#ifndef WLED_DISABLE_WEBSOCKETS
|
#ifndef WLED_DISABLE_WEBSOCKETS
|
||||||
#define WLED_ENABLE_WEBSOCKETS
|
#define WLED_ENABLE_WEBSOCKETS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define WLED_DISABLE_FILESYSTEM // SPIFFS is not used by any WLED feature yet
|
#define WLED_DISABLE_FILESYSTEM // SPIFFS is not used by any WLED feature yet
|
||||||
//#define WLED_ENABLE_FS_SERVING // Enable sending html file from SPIFFS before serving progmem version
|
//#define WLED_ENABLE_FS_SERVING // Enable sending html file from SPIFFS before serving progmem version
|
||||||
//#define WLED_ENABLE_FS_EDITOR // enable /edit page for editing SPIFFS content. Will also be disabled with OTA lock
|
//#define WLED_ENABLE_FS_EDITOR // enable /edit page for editing SPIFFS content. Will also be disabled with OTA lock
|
||||||
|
|
||||||
@ -214,8 +215,8 @@ WLED_GLOBAL bool buttonEnabled _INIT(true);
|
|||||||
WLED_GLOBAL byte irEnabled _INIT(0); // Infrared receiver
|
WLED_GLOBAL byte irEnabled _INIT(0); // Infrared receiver
|
||||||
|
|
||||||
WLED_GLOBAL uint16_t udpPort _INIT(21324); // WLED notifier default port
|
WLED_GLOBAL uint16_t udpPort _INIT(21324); // WLED notifier default port
|
||||||
|
WLED_GLOBAL uint16_t udpPort2 _INIT(65506); // WLED notifier supplemental port
|
||||||
WLED_GLOBAL uint16_t udpRgbPort _INIT(19446); // Hyperion port
|
WLED_GLOBAL uint16_t udpRgbPort _INIT(19446); // Hyperion port
|
||||||
WLED_GLOBAL uint16_t udpApiPort _INIT(7000); // Udp api port
|
|
||||||
|
|
||||||
WLED_GLOBAL bool receiveNotificationBrightness _INIT(true); // apply brightness from incoming notifications
|
WLED_GLOBAL bool receiveNotificationBrightness _INIT(true); // apply brightness from incoming notifications
|
||||||
WLED_GLOBAL bool receiveNotificationColor _INIT(true); // apply color
|
WLED_GLOBAL bool receiveNotificationColor _INIT(true); // apply color
|
||||||
@ -260,8 +261,6 @@ WLED_GLOBAL char mqttPass[41] _INIT(""); // optional: password
|
|||||||
WLED_GLOBAL char mqttClientID[41] _INIT(""); // override the client ID
|
WLED_GLOBAL char mqttClientID[41] _INIT(""); // override the client ID
|
||||||
WLED_GLOBAL uint16_t mqttPort _INIT(1883);
|
WLED_GLOBAL uint16_t mqttPort _INIT(1883);
|
||||||
|
|
||||||
WLED_GLOBAL bool udpApiEnabled _INIT(true);
|
|
||||||
|
|
||||||
WLED_GLOBAL bool huePollingEnabled _INIT(false); // poll hue bridge for light state
|
WLED_GLOBAL bool huePollingEnabled _INIT(false); // poll hue bridge for light state
|
||||||
WLED_GLOBAL uint16_t huePollIntervalMs _INIT(2500); // low values (< 1sec) may cause lag but offer quicker response
|
WLED_GLOBAL uint16_t huePollIntervalMs _INIT(2500); // low values (< 1sec) may cause lag but offer quicker response
|
||||||
WLED_GLOBAL char hueApiKey[47] _INIT("api"); // key token will be obtained from bridge
|
WLED_GLOBAL char hueApiKey[47] _INIT("api"); // key token will be obtained from bridge
|
||||||
@ -380,7 +379,7 @@ WLED_GLOBAL byte effectIntensity _INIT(128);
|
|||||||
WLED_GLOBAL byte effectPalette _INIT(0);
|
WLED_GLOBAL byte effectPalette _INIT(0);
|
||||||
|
|
||||||
// network
|
// network
|
||||||
WLED_GLOBAL bool udpConnected _INIT(false), udpRgbConnected _INIT(false), udpApiConnected _INIT(false);;
|
WLED_GLOBAL bool udpConnected _INIT(false), udp2Connected _INIT(false), udpRgbConnected _INIT(false);
|
||||||
|
|
||||||
// ui style
|
// ui style
|
||||||
WLED_GLOBAL bool showWelcomePage _INIT(false);
|
WLED_GLOBAL bool showWelcomePage _INIT(false);
|
||||||
@ -496,7 +495,7 @@ WLED_GLOBAL AsyncClient* hueClient _INIT(NULL);
|
|||||||
WLED_GLOBAL AsyncMqttClient* mqtt _INIT(NULL);
|
WLED_GLOBAL AsyncMqttClient* mqtt _INIT(NULL);
|
||||||
|
|
||||||
// udp interface objects
|
// udp interface objects
|
||||||
WLED_GLOBAL WiFiUDP notifierUdp, rgbUdp, apiUdp;
|
WLED_GLOBAL WiFiUDP notifierUdp, rgbUdp, notifier2Udp;
|
||||||
WLED_GLOBAL WiFiUDP ntpUdp;
|
WLED_GLOBAL WiFiUDP ntpUdp;
|
||||||
WLED_GLOBAL ESPAsyncE131 e131 _INIT_N(((handleE131Packet)));
|
WLED_GLOBAL ESPAsyncE131 e131 _INIT_N(((handleE131Packet)));
|
||||||
WLED_GLOBAL bool e131NewData _INIT(false);
|
WLED_GLOBAL bool e131NewData _INIT(false);
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
//eeprom Version code, enables default settings instead of 0 init on update
|
//eeprom Version code, enables default settings instead of 0 init on update
|
||||||
#define EEPVER 21
|
#define EEPVER 22
|
||||||
//0 -> old version, default
|
//0 -> old version, default
|
||||||
//1 -> 0.4p 1711272 and up
|
//1 -> 0.4p 1711272 and up
|
||||||
//2 -> 0.4p 1711302 and up
|
//2 -> 0.4p 1711302 and up
|
||||||
@ -30,6 +30,7 @@
|
|||||||
//19-> 0.9.1n
|
//19-> 0.9.1n
|
||||||
//20-> 0.9.1p
|
//20-> 0.9.1p
|
||||||
//21-> 0.10.1p
|
//21-> 0.10.1p
|
||||||
|
//22-> 2009260
|
||||||
|
|
||||||
void commit()
|
void commit()
|
||||||
{
|
{
|
||||||
@ -146,6 +147,9 @@ void saveSettingsToEEPROM()
|
|||||||
|
|
||||||
EEPROM.write(377, EEPVER); //eeprom was updated to latest
|
EEPROM.write(377, EEPVER); //eeprom was updated to latest
|
||||||
|
|
||||||
|
EEPROM.write(378, udpPort2 & 0xFF);
|
||||||
|
EEPROM.write(379, (udpPort2 >> 8) & 0xFF);
|
||||||
|
|
||||||
EEPROM.write(382, strip.paletteBlend);
|
EEPROM.write(382, strip.paletteBlend);
|
||||||
EEPROM.write(383, strip.colorOrder);
|
EEPROM.write(383, strip.colorOrder);
|
||||||
|
|
||||||
@ -284,10 +288,6 @@ void saveSettingsToEEPROM()
|
|||||||
} // last used: 2549. maybe leave a few bytes for future expansion and go on with 2600 kthxbye.
|
} // last used: 2549. maybe leave a few bytes for future expansion and go on with 2600 kthxbye.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EEPROM.write(2550, udpApiEnabled);
|
|
||||||
EEPROM.write(2551, udpApiPort & 0xFF);
|
|
||||||
EEPROM.write(2552, (udpApiPort >> 8) & 0xFF);
|
|
||||||
|
|
||||||
commit();
|
commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -542,9 +542,8 @@ void loadSettingsFromEEPROM(bool first)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (lastEEPROMversion > 19) {
|
if (lastEEPROMversion > 21) {
|
||||||
udpApiEnabled = EEPROM.read(2550);
|
udpPort2 = EEPROM.read(378) + ((EEPROM.read(379) << 8) & 0xFF00);
|
||||||
udpApiPort = EEPROM.read(2551) + ((EEPROM.read(2552) << 8) & 0xFF00);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
receiveDirect = !EEPROM.read(2200);
|
receiveDirect = !EEPROM.read(2200);
|
||||||
|
@ -292,6 +292,7 @@ void getSettingsJS(byte subPage, char* dest)
|
|||||||
sappend('c',SET_F("BT"),buttonEnabled);
|
sappend('c',SET_F("BT"),buttonEnabled);
|
||||||
sappend('v',SET_F("IR"),irEnabled);
|
sappend('v',SET_F("IR"),irEnabled);
|
||||||
sappend('v',SET_F("UP"),udpPort);
|
sappend('v',SET_F("UP"),udpPort);
|
||||||
|
sappend('v',SET_F("U2"),udpPort2);
|
||||||
sappend('c',SET_F("RB"),receiveNotificationBrightness);
|
sappend('c',SET_F("RB"),receiveNotificationBrightness);
|
||||||
sappend('c',SET_F("RC"),receiveNotificationColor);
|
sappend('c',SET_F("RC"),receiveNotificationColor);
|
||||||
sappend('c',SET_F("RX"),receiveNotificationEffects);
|
sappend('c',SET_F("RX"),receiveNotificationEffects);
|
||||||
@ -316,10 +317,6 @@ void getSettingsJS(byte subPage, char* dest)
|
|||||||
sappend('c',SET_F("SA"),notifyAlexa);
|
sappend('c',SET_F("SA"),notifyAlexa);
|
||||||
sappends('s',SET_F("BK"),(char*)((blynkEnabled)?SET_F("Hidden"):""));
|
sappends('s',SET_F("BK"),(char*)((blynkEnabled)?SET_F("Hidden"):""));
|
||||||
|
|
||||||
// UDP Api
|
|
||||||
sappend('c',"UAE",udpApiEnabled);
|
|
||||||
sappend('v',"UAP",udpApiPort);
|
|
||||||
|
|
||||||
#ifdef WLED_ENABLE_MQTT
|
#ifdef WLED_ENABLE_MQTT
|
||||||
sappend('c',SET_F("MQ"),mqttEnabled);
|
sappend('c',SET_F("MQ"),mqttEnabled);
|
||||||
sappends('s',SET_F("MS"),mqttServer);
|
sappends('s',SET_F("MS"),mqttServer);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user