Added UDP sync groups.
This commit is contained in:
commit
f921d9a1f8
@ -267,6 +267,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
|
||||
CJSON(receiveNotificationBrightness, if_sync_recv["bri"]);
|
||||
CJSON(receiveNotificationColor, if_sync_recv["col"]);
|
||||
CJSON(receiveNotificationEffects, if_sync_recv["fx"]);
|
||||
CJSON(receiveGroups, if_sync_recv["grp"]);
|
||||
//! following line might be a problem if called after boot
|
||||
receiveNotifications = (receiveNotificationBrightness || receiveNotificationColor || receiveNotificationEffects);
|
||||
|
||||
@ -279,6 +280,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
|
||||
CJSON(notifyHue, if_sync_send["hue"]);
|
||||
CJSON(notifyMacro, if_sync_send["macro"]);
|
||||
CJSON(notifyTwice, if_sync_send[F("twice")]);
|
||||
CJSON(syncGroups, if_sync_send["grp"]);
|
||||
|
||||
JsonObject if_nodes = interfaces["nodes"];
|
||||
CJSON(nodeListEnabled, if_nodes[F("list")]);
|
||||
@ -639,6 +641,7 @@ void serializeConfig() {
|
||||
if_sync_recv["bri"] = receiveNotificationBrightness;
|
||||
if_sync_recv["col"] = receiveNotificationColor;
|
||||
if_sync_recv["fx"] = receiveNotificationEffects;
|
||||
if_sync_recv["grp"] = receiveGroups;
|
||||
|
||||
JsonObject if_sync_send = if_sync.createNestedObject("send");
|
||||
if_sync_send[F("dir")] = notifyDirect;
|
||||
@ -647,6 +650,7 @@ void serializeConfig() {
|
||||
if_sync_send["hue"] = notifyHue;
|
||||
if_sync_send["macro"] = notifyMacro;
|
||||
if_sync_send[F("twice")] = notifyTwice;
|
||||
if_sync_send["grp"] = syncGroups;
|
||||
|
||||
JsonObject if_nodes = interfaces.createNestedObject("nodes");
|
||||
if_nodes[F("list")] = nodeListEnabled;
|
||||
|
@ -20,7 +20,42 @@ function GetV(){var d=document;}
|
||||
<h2>Sync setup</h2>
|
||||
<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>
|
||||
2nd Port: <input name="U2" type="number" min="1" max="65535" class="d5" required><br><br>
|
||||
<table style="margin: 0 auto;">
|
||||
<tr>
|
||||
<td>Sync groups</td>
|
||||
<td>1</td>
|
||||
<td>2</td>
|
||||
<td>3</td>
|
||||
<td>4</td>
|
||||
<td>5</td>
|
||||
<td>6</td>
|
||||
<td>7</td>
|
||||
<td>8</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Send:</td>
|
||||
<td><input type="checkbox" id="G1" name="G1"></td>
|
||||
<td><input type="checkbox" id="G2" name="G2"></td>
|
||||
<td><input type="checkbox" id="G3" name="G3"></td>
|
||||
<td><input type="checkbox" id="G4" name="G4"></td>
|
||||
<td><input type="checkbox" id="G5" name="G5"></td>
|
||||
<td><input type="checkbox" id="G6" name="G6"></td>
|
||||
<td><input type="checkbox" id="G7" name="G7"></td>
|
||||
<td><input type="checkbox" id="G8" name="G8"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Receive:</td>
|
||||
<td><input type="checkbox" id="R1" name="R1"></td>
|
||||
<td><input type="checkbox" id="R2" name="R2"></td>
|
||||
<td><input type="checkbox" id="R3" name="R3"></td>
|
||||
<td><input type="checkbox" id="R4" name="R4"></td>
|
||||
<td><input type="checkbox" id="R5" name="R5"></td>
|
||||
<td><input type="checkbox" id="R6" name="R6"></td>
|
||||
<td><input type="checkbox" id="R7" name="R7"></td>
|
||||
<td><input type="checkbox" id="R8" name="R8"></td>
|
||||
</tr>
|
||||
</table><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 or IR: <input type="checkbox" name="SB"><br>
|
||||
|
@ -245,10 +245,23 @@ class="helpB"><button type="button" onclick="H()">?</button></div><button
|
||||
type="button" onclick="B()">Back</button><button type="submit">Save</button><hr>
|
||||
</div><h2>Sync setup</h2><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>
|
||||
name="U2" type="number" min="1" max="65535" class="d5" required><br><br><table
|
||||
style="margin:0 auto"><tr><td>Sync groups</td><td>1</td><td>2</td><td>3</td><td>
|
||||
4</td><td>5</td><td>6</td><td>7</td><td>8</td></tr><tr><td>Send:</td><td><input
|
||||
type="checkbox" id="G1" name="G1"></td><td><input type="checkbox" id="G2"
|
||||
name="G2"></td><td><input type="checkbox" id="G3" name="G3"></td><td><input
|
||||
type="checkbox" id="G4" name="G4"></td><td><input type="checkbox" id="G5"
|
||||
name="G5"></td><td><input type="checkbox" id="G6" name="G6"></td><td><input
|
||||
type="checkbox" id="G7" name="G7"></td><td><input type="checkbox" id="G8"
|
||||
name="G8"></td></tr><tr><td>Receive:</td><td><input type="checkbox" id="R1"
|
||||
name="R1"></td><td><input type="checkbox" id="R2" name="R2"></td><td><input
|
||||
type="checkbox" id="R3" name="R3"></td><td><input type="checkbox" id="R4"
|
||||
name="R4"></td><td><input type="checkbox" id="R5" name="R5"></td><td><input
|
||||
type="checkbox" id="R6" name="R6"></td><td><input type="checkbox" id="R7"
|
||||
name="R7"></td><td><input type="checkbox" id="R8" name="R8"></td></tr></table>
|
||||
<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 or IR: <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>
|
||||
|
@ -45,7 +45,7 @@ void deserializeSegment(JsonObject elem, byte it, byte presetId)
|
||||
uint16_t len = elem[F("len")];
|
||||
stop = (len > 0) ? start + len : seg.stop;
|
||||
}
|
||||
uint16_t grp = elem[F("grp")] | seg.grouping;
|
||||
uint16_t grp = elem["grp"] | seg.grouping;
|
||||
uint16_t spc = elem[F("spc")] | seg.spacing;
|
||||
strip.setSegment(id, start, stop, grp, spc);
|
||||
|
||||
@ -368,7 +368,7 @@ void serializeSegment(JsonObject& root, WS2812FX::Segment& seg, byte id, bool fo
|
||||
root["stop"] = seg.stop;
|
||||
}
|
||||
if (!forPreset) root[F("len")] = seg.stop - seg.start;
|
||||
root[F("grp")] = seg.grouping;
|
||||
root["grp"] = seg.grouping;
|
||||
root[F("spc")] = seg.spacing;
|
||||
root[F("of")] = seg.offset;
|
||||
root["on"] = seg.getOption(SEG_OPTION_ON);
|
||||
|
@ -208,6 +208,15 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
||||
if (t > 0) udpPort = t;
|
||||
t = request->arg(F("U2")).toInt();
|
||||
if (t > 0) udpPort2 = t;
|
||||
|
||||
char k[3]; k[2] = 0;
|
||||
syncGroups = receiveGroups = 0;
|
||||
for (uint8_t i=0; i<8; i++) {
|
||||
k[1] = 49+i; // char '1','2',...
|
||||
k[0] = 'G'; syncGroups |= request->hasArg(k)<<i;
|
||||
k[0] = 'R'; receiveGroups |= request->hasArg(k)<<i;
|
||||
}
|
||||
|
||||
receiveNotificationBrightness = request->hasArg(F("RB"));
|
||||
receiveNotificationColor = request->hasArg(F("RC"));
|
||||
receiveNotificationEffects = request->hasArg(F("RX"));
|
||||
|
@ -4,7 +4,7 @@
|
||||
* UDP sync notifier / Realtime / Hyperion / TPM2.NET
|
||||
*/
|
||||
|
||||
#define WLEDPACKETSIZE 36
|
||||
#define WLEDPACKETSIZE 37
|
||||
#define UDP_IN_MAXSIZE 1472
|
||||
#define PRESUMED_NETWORK_DELAY 3 //how many ms could it take on avg to reach the receiver? This will be added to transmitted times
|
||||
|
||||
@ -39,7 +39,8 @@ void notify(byte callMode, bool followUp)
|
||||
//0: old 1: supports white 2: supports secondary color
|
||||
//3: supports FX intensity, 24 byte packet 4: supports transitionDelay 5: sup palette
|
||||
//6: supports timebase syncing, 29 byte packet 7: supports tertiary color 8: supports sys time sync, 36 byte packet
|
||||
udpOut[11] = 8;
|
||||
//9: supports sync groups, 37 byte packet
|
||||
udpOut[11] = 9;
|
||||
udpOut[12] = colSec[0];
|
||||
udpOut[13] = colSec[1];
|
||||
udpOut[14] = colSec[2];
|
||||
@ -72,6 +73,9 @@ void notify(byte callMode, bool followUp)
|
||||
uint16_t ms = tm.ms;
|
||||
udpOut[34] = (ms >> 8) & 0xFF;
|
||||
udpOut[35] = (ms >> 0) & 0xFF;
|
||||
|
||||
//sync groups
|
||||
udpOut[36] = syncGroups & 0xFF;
|
||||
|
||||
IPAddress broadcastIp;
|
||||
broadcastIp = ~uint32_t(Network.subnetMask()) | uint32_t(Network.gatewayIP());
|
||||
@ -223,6 +227,9 @@ void handleNotifications()
|
||||
|
||||
//compatibilityVersionByte:
|
||||
byte version = udpIn[11];
|
||||
|
||||
// if we are not part of any sync group ignore message
|
||||
if (version > 8 && !(receiveGroups & udpIn[36])) return;
|
||||
|
||||
bool someSel = (receiveNotificationBrightness || receiveNotificationColor || receiveNotificationEffects);
|
||||
//apply colors from notification
|
||||
|
@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
// version code in format yymmddb (b = daily build)
|
||||
#define VERSION 2108201
|
||||
#define VERSION 2108211
|
||||
|
||||
//uncomment this if you have a "my_config.h" file you'd like to use
|
||||
//#define WLED_USE_MY_CONFIG
|
||||
@ -301,6 +301,8 @@ WLED_GLOBAL bool liveHSVCorrection _INIT(false);
|
||||
WLED_GLOBAL uint16_t liveHSVSaturation _INIT(13);
|
||||
WLED_GLOBAL uint16_t liveHSVValue _INIT(10);
|
||||
|
||||
WLED_GLOBAL uint8_t syncGroups _INIT(0xFF); // sync groups this instance syncs (bit mapped)
|
||||
WLED_GLOBAL uint8_t receiveGroups _INIT(0xFF); // sync receive groups this instance belongs to (bit mapped)
|
||||
WLED_GLOBAL bool receiveNotificationBrightness _INIT(true); // apply brightness from incoming notifications
|
||||
WLED_GLOBAL bool receiveNotificationColor _INIT(true); // apply color
|
||||
WLED_GLOBAL bool receiveNotificationEffects _INIT(true); // apply effects setup
|
||||
|
@ -430,6 +430,13 @@ void getSettingsJS(byte subPage, char* dest)
|
||||
sappend('v',SET_F("UP"),udpPort);
|
||||
sappend('v',SET_F("U2"),udpPort2);
|
||||
|
||||
char k[3]; k[2] = 0;
|
||||
for (int i = 0; i<8; i++)
|
||||
{
|
||||
k[1] = 49+i; //ascii 1,2,3,...
|
||||
k[0] = 'G'; sappend('c',k,(syncGroups>>i)&0x01);
|
||||
k[0] = 'R'; sappend('c',k,(receiveGroups>>i)&0x01);
|
||||
}
|
||||
sappend('c',SET_F("HX"),liveHSVCorrection);
|
||||
sappend('v',SET_F("HS"),liveHSVSaturation);
|
||||
sappend('v',SET_F("HV"),liveHSVValue);
|
||||
|
Loading…
Reference in New Issue
Block a user