Increased max. UDP leds from 341 to 490

MQTT now publishes state on connect
This commit is contained in:
cschwinne 2018-11-01 16:16:38 +01:00
parent 5e6b1e8175
commit 81c810eba4
5 changed files with 14 additions and 9 deletions

Binary file not shown.

View File

@ -237,7 +237,7 @@ Send notifications twice: <input type="checkbox" name="S2"><br>
Receive UDP realtime: <input type="checkbox" name="RD"><br><br> Receive UDP realtime: <input type="checkbox" name="RD"><br><br>
<i>E1.31 (sACN)</i><br> <i>E1.31 (sACN)</i><br>
Use E1.31 multicast: <input type="checkbox" name="EM"><br> Use E1.31 multicast: <input type="checkbox" name="EM"><br>
E1.31 universe: <input name="EU" type="number" min="1" max="63999" required><br> E1.31 start universe: <input name="EU" type="number" min="1" max="63999" required><br>
<i>Reboot required.</i> Check out <a href="https://github.com/ahodges9/LedFx" target="_blank">LedFx</a>!<br><br> <i>Reboot required.</i> Check out <a href="https://github.com/ahodges9/LedFx" target="_blank">LedFx</a>!<br><br>
Timeout: <input name="ET" type="number" min="1" max="65000" required> ms<br> Timeout: <input name="ET" type="number" min="1" max="65000" required> ms<br>
Force max brightness: <input type="checkbox" name="FB"><br> Force max brightness: <input type="checkbox" name="FB"><br>

View File

@ -63,7 +63,7 @@
//version code in format yymmddb (b = daily build) //version code in format yymmddb (b = daily build)
#define VERSION 1811011 #define VERSION 1811012
char versionString[] = "0.8.1"; char versionString[] = "0.8.1";

View File

@ -3,6 +3,7 @@
*/ */
#define WLEDPACKETSIZE 24 #define WLEDPACKETSIZE 24
#define UDP_IN_MAXSIZE 1472
void notify(byte callMode, bool followUp=false) void notify(byte callMode, bool followUp=false)
{ {
@ -124,16 +125,16 @@ void handleNotifications()
if (!packetSize && udpRgbConnected) { if (!packetSize && udpRgbConnected) {
packetSize = rgbUdp.parsePacket(); packetSize = rgbUdp.parsePacket();
if (!receiveDirect) return; if (!receiveDirect) return;
if (packetSize > 1026 || packetSize < 3) return; if (packetSize > UDP_IN_MAXSIZE || packetSize < 3) return;
realtimeIP = rgbUdp.remoteIP(); realtimeIP = rgbUdp.remoteIP();
DEBUG_PRINTLN(rgbUdp.remoteIP()); DEBUG_PRINTLN(rgbUdp.remoteIP());
byte udpIn[packetSize]; olen = 0;
rgbUdp.read(udpIn, packetSize); rgbUdp.read(obuf, packetSize);
arlsLock(realtimeTimeoutMs); arlsLock(realtimeTimeoutMs);
uint16_t id = 0; uint16_t id = 0;
for (uint16_t i = 0; i < packetSize -2; i += 3) for (uint16_t i = 0; i < packetSize -2; i += 3)
{ {
setRealtimePixel(id, udpIn[i], udpIn[i+1], udpIn[i+2], 0); setRealtimePixel(id, obuf[i], obuf[i+1], obuf[i+2], 0);
id++; if (id >= ledCount) break; id++; if (id >= ledCount) break;
} }
@ -141,11 +142,13 @@ void handleNotifications()
return; return;
} }
if (packetSize > 1026) return; if (packetSize > UDP_IN_MAXSIZE) return;
if(packetSize && notifierUdp.remoteIP() != WiFi.localIP()) //don't process broadcasts we send ourselves if(packetSize && notifierUdp.remoteIP() != WiFi.localIP()) //don't process broadcasts we send ourselves
{ {
byte udpIn[packetSize]; olen = 0;
notifierUdp.read(udpIn, packetSize); notifierUdp.read(obuf, packetSize);
char* udpIn = obuf;
if (udpIn[0] == 0 && !realtimeActive && receiveNotifications) //wled notifier, block if realtime packets active if (udpIn[0] == 0 && !realtimeActive && receiveNotifications) //wled notifier, block if realtime packets active
{ {
if (receiveNotificationColor) if (receiveNotificationColor)

View File

@ -93,6 +93,8 @@ bool reconnectMQTT()
strcat(subuf, "/api"); strcat(subuf, "/api");
mqtt->subscribe(subuf); mqtt->subscribe(subuf);
} }
publishMQTT();
} }
return mqtt->connected(); return mqtt->connected();
} }