Merge pull request #1209 from Aircoookie/merge-loxone

Merge loxone support
This commit is contained in:
Aircoookie 2020-09-27 11:49:08 +02:00 committed by GitHub
commit f697f3d7ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 1780 additions and 1538 deletions

View File

@ -375,3 +375,43 @@ build_flags = ${common.build_flags_esp8266} ${common.debug_flags} ${common.build
extends = env:esp32dev
build_type = debug
build_flags = ${common.build_flags_esp32} ${common.debug_flags} ${common.build_flags_all_features}
# ------------------------------------------------------------------------------
# codm pixel controller board configurations
# ------------------------------------------------------------------------------
[env:codm-controller-0.4]
board = esp_wroom_02
platform = ${common.platform_wled_default}
board_build.ldscript = ${common.ldscript_2m1m}
build_flags = ${common.build_flags_esp8266} -D LEDPIN=3
[env:codm-controller-0.4-WS2801]
board = esp_wroom_02
platform = ${common.platform_latest}
board_build.ldscript = ${common.ldscript_2m1m}
build_flags = ${common.build_flags_esp8266} -D USE_WS2801 -D CLKPIN=13 -D DATAPIN=3
[env:codm-controller-0.4-APA102]
board = esp_wroom_02
platform = ${common.platform_latest}
board_build.ldscript = ${common.ldscript_2m1m}
build_flags = ${common.build_flags_esp8266} -D USE_APA102 -D CLKPIN=13 -D DATAPIN=3
[env:codm-controller-0.5]
board = esp_wroom_02
platform = ${common.platform_wled_default}
board_build.ldscript = ${common.ldscript_2m1m}
build_flags = ${common.build_flags_esp8266}
[env:codm-controller-0.5-WS2801]
board = esp_wroom_02
platform = ${common.platform_latest}
board_build.ldscript = ${common.ldscript_2m1m}
build_flags = ${common.build_flags_esp8266} -D USE_WS2801 #-D CLKPIN=0 -D DATAPIN=2
[env:codm-controller-0.5-APA102]
board = esp_wroom_02
platform = ${common.platform_latest}
board_build.ldscript = ${common.ldscript_2m1m}
build_flags = ${common.build_flags_esp8266} -D USE_APA102 #-D CLKPIN=0 -D DATAPIN=2

View File

@ -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);
}
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
if (mired > 475) {

View File

@ -31,13 +31,15 @@ Infrared remote:
<a 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" 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>
Send notifications on direct change: <input type="checkbox" name="SD"><br>
Send notifications on button press: <input type="checkbox" name="SB"><br>
Send Alexa notifications: <input type="checkbox" name="SA"><br>
Send Philips Hue change notifications: <input type="checkbox" name="SH"><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>
<i>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>

View File

@ -103,7 +103,11 @@
<option value="10">JST(KST)</option>
<option value="11">AEST/AEDT</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>
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>.

View File

@ -30,6 +30,7 @@ void colorFromUint32(uint32_t in, bool secondary = false);
void colorFromUint24(uint32_t in, bool secondary = false);
void relativeChangeWhite(int8_t amount, byte lowerBoundary = 0);
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 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 handleNightlight();
//lx_parser.cpp
bool parseLx(int lxValue, byte* rgbw);
void parseLxJson(int lxValue, byte segId, bool secondary);
//mqtt.cpp
bool initMqtt();
void publishMqtt();

View File

@ -233,23 +233,23 @@ var t = typeof s[i];
if (gId(fk)) { //already exists
if(t === 'boolean')
{
gId(fk).checked = s[i];
gId(fk).checked = s[i];
} else {
gId(fk).value = s[i];
gId(fk).value = s[i];
}
if (gId(fk).previousElementSibling.matches('.l')) {
gId(fk).previousElementSibling.innerHTML = lb;
gId(fk).previousElementSibling.innerHTML = lb;
}
} else {
if(t === 'boolean')
{
str += `${lb}: <input class="agi cb" type="checkbox" id=${fk} ${s[i]?"checked":""}><br>`;
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>`;
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>`;
str += `${lb}:<br><input class="agi" id=${fk} value=${s[i]}><br>`;
}
}
}
@ -370,28 +370,31 @@ On/Off button enabled: <input type="checkbox" name="BT"><br>Infrared remote:
9-key red</option></select><br><a
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"
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>Send notifications on direct change: <input
type="checkbox" name="SD"><br>Send notifications on button press: <input
type="checkbox" name="SB"><br>Send Alexa notifications: <input type="checkbox"
name="SA"><br>Send Philips Hue change notifications: <input type="checkbox"
name="SH"><br>Send Macro notifications: <input type="checkbox" name="SM"><br>
Send notifications twice: <input type="checkbox" name="S2"><h3>Realtime</h3>
Receive UDP realtime: <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)</option><option value="6454">Art-Net</option><option
value="0" selected="selected">Custom port</option></select><br><div id="xp">
Port: <input name="EP" type="number" min="1" max="65535" value="5568"
class="d5" required><br></div>Multicast: <input type="checkbox" name="EM"><br>
Start universe: <input name="EU" type="number" min="0" max="63999" required><br>
<i>Reboot required.</i> Check out <a href="https://github.com/ahodges9/LedFx"
target="_blank">LedFx</a>!<br>Skip out-of-sequence packets: <input
type="checkbox" name="ES"><br>DMX start address: <input name="DA" type="number"
min="0" max="510" required><br>DMX mode: <select name="DM"><option value="0">
Disabled</option><option value="1">Single RGB</option><option value="2">
Single DRGB</option><option value="3">Effect</option><option value="4">Multi RGB
</option><option value="5">Dimmer + Multi RGB</option></select><br><a
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>
Send notifications on direct change: <input type="checkbox" name="SD"><br>
Send notifications on button press: <input type="checkbox" name="SB"><br>
Send Alexa notifications: <input type="checkbox" name="SA"><br>
Send Philips Hue change notifications: <input type="checkbox" name="SH"><br>
Send Macro notifications: <input type="checkbox" name="SM"><br>
Send notifications twice: <input type="checkbox" name="S2"><br><i>
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:
<select name="DI" onchange="SP(),adj()"><option value="5568">E1.31 (sACN)
</option><option value="6454">Art-Net</option><option value="0"
selected="selected">Custom port</option></select><br><div id="xp">Port: <input
name="EP" type="number" min="1" max="65535" value="5568" class="d5" required>
<br></div>Multicast: <input type="checkbox" name="EM"><br>Start universe: <input
name="EU" type="number" min="0" max="63999" required><br><i>Reboot required.
</i> Check out <a href="https://github.com/ahodges9/LedFx" target="_blank">LedFx
</a>!<br>Skip out-of-sequence packets: <input type="checkbox" name="ES"><br>
DMX start address: <input name="DA" type="number" min="0" max="510" required>
<br>DMX mode: <select name="DM"><option value="0">Disabled</option><option
value="1">Single RGB</option><option value="2">Single DRGB</option><option
value="3">Effect</option><option value="4">Multi RGB</option><option value="5">
Dimmer + Multi RGB</option></select><br><a
href="https://github.com/Aircoookie/WLED/wiki/E1.31-DMX" target="_blank">
E1.31 info</a><br>Timeout: <input name="ET" type="number" min="1" max="65000"
required> ms<br>Force max brightness: <input type="checkbox" name="FB"><br>
@ -450,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">
CST(AWST)</option><option value="10">JST(KST)</option><option value="11">
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>
Current local time is <span class="times">unknown</span>.<h3>Clock</h3>
Clock Overlay: <select name="OL" onchange="Cs()"><option value="0" id="cn"

File diff suppressed because it is too large Load Diff

View File

@ -44,7 +44,14 @@ void deserializeSegment(JsonObject elem, byte it)
int rgbw[] = {0,0,0,0};
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 (i == 0) {col[0] = rgbw[0]; col[1] = rgbw[1]; col[2] = rgbw[2]; col[3] = rgbw[3];}
@ -55,6 +62,18 @@ void deserializeSegment(JsonObject elem, byte it)
}
}
}
// lx parser
#ifdef WLED_ENABLE_LOXONE
int lx = elem[F("lx")] | -1;
if (lx > 0) {
parseLxJson(lx, id, false);
}
int ly = elem[F("ly")] | -1;
if (ly > 0) {
parseLxJson(ly, id, true);
}
#endif
//if (pal != seg.palette && pal < strip.getPaletteCount()) strip.setPalette(pal);
seg.setOption(SEG_OPTION_SELECTED, elem[F("sel")] | seg.getOption(SEG_OPTION_SELECTED));
@ -455,7 +474,7 @@ void serializeInfo(JsonObject root)
root[F("brand")] = "WLED";
root[F("product")] = F("FOSS");
root[F("mac")] = escapedMac;
root["mac"] = escapedMac;
}
void serveJson(AsyncWebServerRequest* request)

77
wled00/lx_parser.cpp Normal file
View File

@ -0,0 +1,77 @@
#include "wled.h"
/*
* 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;
float lxRed = 0, lxGreen = 0, lxBlue = 0;
if (lxValue < 200000000) {
// Loxone RGB
ok = true;
lxRed = round((lxValue % 1000) * 2.55);
lxGreen = round(((lxValue / 1000) % 1000) * 2.55);
lxBlue = round(((lxValue / 1000000) % 1000) * 2.55);
} else if ((lxValue >= 200000000) && (lxValue <= 201006500)) {
// Loxone Lumitech
ok = true;
float tmpBri = floor((lxValue - 200000000) / 10000); ;
uint16_t ct = (lxValue - 200000000) - (((uint8_t)tmpBri) * 10000);
float temp = 0;
tmpBri *= 2.55;
constrain(tmpBri, 0, 255);
colorKtoRGB(ct, rgbw);
lxRed = rgbw[0]; lxGreen = rgbw[1]; lxBlue = rgbw[2];
lxRed *= (tmpBri/255);
lxGreen *= (tmpBri/255);
lxBlue *= (tmpBri/255);
}
if (ok) {
rgbw[0] = (uint8_t) constrain(lxRed, 0, 255);
rgbw[1] = (uint8_t) constrain(lxGreen, 0, 255);
rgbw[2] = (uint8_t) constrain(lxBlue, 0, 255);
rgbw[3] = 0;
return true;
}
#endif
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)));
}
}
}

View File

@ -1,5 +1,6 @@
#include "wled.h"
/*
* Receives client input
*/
@ -128,6 +129,8 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
irEnabled = request->arg(F("IR")).toInt();
int t = request->arg(F("UP")).toInt();
if (t > 0) udpPort = t;
t = request->arg(F("U2")).toInt();
if (t > 0) udpPort2 = t;
receiveNotificationBrightness = request->hasArg(F("RB"));
receiveNotificationColor = request->hasArg(F("RC"));
receiveNotificationEffects = request->hasArg(F("RX"));
@ -416,6 +419,7 @@ bool handleSet(AsyncWebServerRequest *request, const String& req)
byte main = strip.getMainSegmentId();
if (main != prevMain) setValuesFromMainSeg();
bool segGiven = false;
pos = req.indexOf(F("SS="));
if (pos > 0) {
byte t = getNumVal(&req, pos);
@ -507,6 +511,27 @@ bool handleSet(AsyncWebServerRequest *request, const String& req)
updateVal(&req, "B2=", &colSec[2]);
updateVal(&req, "W2=", &colSec[3]);
#ifdef WLED_ENABLE_LOXONE
//lox parser
pos = req.indexOf(F("LX=")); // Lox primary color
if (pos > 0) {
int lxValue = getNumVal(&req, pos);
if (parseLx(lxValue, col)) {
bri = 255;
nightlightActive = false; //always disable nightlight when toggling
}
}
pos = req.indexOf(F("LY=")); // Lox secondary color
if (pos > 0) {
int lxValue = getNumVal(&req, pos);
if(parseLx(lxValue, colSec)) {
bri = 255;
nightlightActive = false; //always disable nightlight when toggling
}
}
#endif
//set hue
pos = req.indexOf(F("HU="));
if (pos > 0) {
@ -519,6 +544,12 @@ bool handleSet(AsyncWebServerRequest *request, const String& req)
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
pos = req.indexOf(F("CL="));
if (pos > 0) {

View File

@ -105,7 +105,7 @@ void handleNotifications()
if(udpConnected && notificationTwoRequired && millis()-notificationSentTime > 250){
notify(notificationSentCallMode,true);
}
if (e131NewData && millis() - strip.getLastShow() > 15)
{
e131NewData = false;
@ -124,36 +124,44 @@ void handleNotifications()
//receive UDP notifications
if (!udpConnected || !(receiveNotifications || receiveDirect)) return;
bool isSupp = false;
uint16_t packetSize = notifierUdp.parsePacket();
if (!packetSize && udp2Connected) {
packetSize = notifier2Udp.parsePacket();
isSupp = true;
}
//hyperion / raw RGB
if (!packetSize && udpRgbConnected) {
packetSize = rgbUdp.parsePacket();
if (!receiveDirect) return;
if (packetSize > UDP_IN_MAXSIZE || packetSize < 3) return;
realtimeIP = rgbUdp.remoteIP();
DEBUG_PRINTLN(rgbUdp.remoteIP());
uint8_t lbuf[packetSize];
rgbUdp.read(lbuf, packetSize);
realtimeLock(realtimeTimeoutMs, REALTIME_MODE_HYPERION);
if (realtimeOverride) return;
uint16_t id = 0;
for (uint16_t i = 0; i < packetSize -2; i += 3)
{
setRealtimePixel(id, lbuf[i], lbuf[i+1], lbuf[i+2], 0);
id++; if (id >= ledCount) break;
}
strip.show();
return;
if (packetSize) {
if (!receiveDirect) return;
if (packetSize > UDP_IN_MAXSIZE || packetSize < 3) return;
realtimeIP = rgbUdp.remoteIP();
DEBUG_PRINTLN(rgbUdp.remoteIP());
uint8_t lbuf[packetSize];
rgbUdp.read(lbuf, packetSize);
realtimeLock(realtimeTimeoutMs, REALTIME_MODE_HYPERION);
if (realtimeOverride) return;
uint16_t id = 0;
for (uint16_t i = 0; i < packetSize -2; i += 3)
{
setRealtimePixel(id, lbuf[i], lbuf[i+1], lbuf[i+2], 0);
id++; if (id >= ledCount) break;
}
strip.show();
return;
}
}
//notifier and UDP realtime
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];
notifierUdp.read(udpIn, packetSize);
uint8_t udpIn[packetSize +1];
if (isSupp) notifier2Udp.read(udpIn, packetSize);
else notifierUdp.read(udpIn, packetSize);
//wled notifier, block if realtime packets active
if (udpIn[0] == 0 && !realtimeMode && receiveNotifications)
@ -212,7 +220,7 @@ void handleNotifications()
if (receiveNotificationBrightness || !someSel) bri = udpIn[2];
colorUpdated(NOTIFIER_CALL_MODE_NOTIFICATION);
return;
}
if (!receiveDirect) return;
@ -227,7 +235,7 @@ void handleNotifications()
}
if (tpmType != 0xda) return; //return if notTPM2.NET data
realtimeIP = notifierUdp.remoteIP();
realtimeIP = (isSupp) ? notifier2Udp.remoteIP() : notifierUdp.remoteIP();
realtimeLock(realtimeTimeoutMs, REALTIME_MODE_TPM2NET);
if (realtimeOverride) return;
@ -251,13 +259,14 @@ void handleNotifications()
tpmPacketCount = 0;
strip.show();
}
return;
}
//UDP realtime: 1 warls 2 drgb 3 drgbw
if (udpIn[0] > 0 && udpIn[0] < 5)
{
realtimeIP = notifierUdp.remoteIP();
DEBUG_PRINTLN(notifierUdp.remoteIP());
realtimeIP = (isSupp) ? notifier2Udp.remoteIP() : notifierUdp.remoteIP();
DEBUG_PRINTLN(realtimeIP);
if (packetSize < 2) return;
if (udpIn[1] == 0)
@ -304,6 +313,21 @@ void handleNotifications()
}
}
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);
}
}

View File

@ -264,15 +264,15 @@ void WLED::initAP(bool resetAP)
return;
if (!apSSID[0] || resetAP)
strcpy(apSSID, (const char*)F("WLED-AP"));
strcpy_P(apSSID, PSTR("WLED-AP"));
if (resetAP)
strcpy(apPass, DEFAULT_AP_PASS);
strcpy_P(apPass, PSTR(DEFAULT_AP_PASS));
DEBUG_PRINT(F("Opening access point "));
DEBUG_PRINTLN(apSSID);
WiFi.softAPConfig(IPAddress(4, 3, 2, 1), IPAddress(4, 3, 2, 1), IPAddress(255, 255, 255, 0));
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"));
server.begin();
@ -282,7 +282,10 @@ void WLED::initAP(bool resetAP)
if (udpRgbPort > 0 && udpRgbPort != ntpLocalPort && udpRgbPort != udpPort) {
udpRgbConnected = rgbUdp.begin(udpRgbPort);
}
if (udpPort2 > 0 && udpPort2 != ntpLocalPort && udpPort2 != udpPort && udpPort2 != udpRgbPort) {
udp2Connected = notifier2Udp.begin(udpPort2);
}
dnsServer.setErrorReplyCode(DNSReplyCode::NoError);
dnsServer.start(53, "*", WiFi.softAPIP());
}
@ -408,6 +411,8 @@ void WLED::initInterfaces()
udpConnected = notifierUdp.begin(udpPort);
if (udpConnected && udpRgbPort != udpPort)
udpRgbConnected = rgbUdp.begin(udpRgbPort);
if (udpConnected && udpPort2 != udpPort && udpPort2 != udpRgbPort)
udp2Connected = notifier2Udp.begin(udpPort2);
}
if (ntpEnabled)
ntpConnected = ntpUdp.begin(ntpLocalPort);

View File

@ -8,7 +8,7 @@
*/
// 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).
@ -30,11 +30,12 @@
#endif
#define WLED_ENABLE_ADALIGHT // saves 500b only
//#define WLED_ENABLE_DMX // uses 3.5kb (use LEDPIN other than 2)
#define WLED_ENABLE_LOXONE // uses 1.2kb
#ifndef WLED_DISABLE_WEBSOCKETS
#define WLED_ENABLE_WEBSOCKETS
#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_EDITOR // enable /edit page for editing SPIFFS content. Will also be disabled with OTA lock
@ -214,6 +215,7 @@ WLED_GLOBAL bool buttonEnabled _INIT(true);
WLED_GLOBAL byte irEnabled _INIT(0); // Infrared receiver
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 bool receiveNotificationBrightness _INIT(true); // apply brightness from incoming notifications
@ -377,7 +379,7 @@ WLED_GLOBAL byte effectIntensity _INIT(128);
WLED_GLOBAL byte effectPalette _INIT(0);
// network
WLED_GLOBAL bool udpConnected _INIT(false), udpRgbConnected _INIT(false);
WLED_GLOBAL bool udpConnected _INIT(false), udp2Connected _INIT(false), udpRgbConnected _INIT(false);
// ui style
WLED_GLOBAL bool showWelcomePage _INIT(false);
@ -493,7 +495,7 @@ WLED_GLOBAL AsyncClient* hueClient _INIT(NULL);
WLED_GLOBAL AsyncMqttClient* mqtt _INIT(NULL);
// udp interface objects
WLED_GLOBAL WiFiUDP notifierUdp, rgbUdp;
WLED_GLOBAL WiFiUDP notifierUdp, rgbUdp, notifier2Udp;
WLED_GLOBAL WiFiUDP ntpUdp;
WLED_GLOBAL ESPAsyncE131 e131 _INIT_N(((handleE131Packet)));
WLED_GLOBAL bool e131NewData _INIT(false);

View File

@ -7,7 +7,7 @@
*/
//eeprom Version code, enables default settings instead of 0 init on update
#define EEPVER 21
#define EEPVER 22
//0 -> old version, default
//1 -> 0.4p 1711272 and up
//2 -> 0.4p 1711302 and up
@ -30,6 +30,7 @@
//19-> 0.9.1n
//20-> 0.9.1p
//21-> 0.10.1p
//22-> 2009260
void commit()
{
@ -146,6 +147,9 @@ void saveSettingsToEEPROM()
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(383, strip.colorOrder);
@ -538,6 +542,10 @@ void loadSettingsFromEEPROM(bool first)
}
#endif
if (lastEEPROMversion > 21) {
udpPort2 = EEPROM.read(378) + ((EEPROM.read(379) << 8) & 0xFF00);
}
receiveDirect = !EEPROM.read(2200);
notifyMacro = EEPROM.read(2201);

View File

@ -292,6 +292,7 @@ void getSettingsJS(byte subPage, char* dest)
sappend('c',SET_F("BT"),buttonEnabled);
sappend('v',SET_F("IR"),irEnabled);
sappend('v',SET_F("UP"),udpPort);
sappend('v',SET_F("U2"),udpPort2);
sappend('c',SET_F("RB"),receiveNotificationBrightness);
sappend('c',SET_F("RC"),receiveNotificationColor);
sappend('c',SET_F("RX"),receiveNotificationEffects);