From b5737ce9c1029a0b20a131701686a227117b1d06 Mon Sep 17 00:00:00 2001 From: Blaz Kristan Date: Sat, 21 Aug 2021 12:30:40 +0200 Subject: [PATCH 1/4] Shortened string. --- wled00/cfg.cpp | 8 ++++---- wled00/json.cpp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/wled00/cfg.cpp b/wled00/cfg.cpp index cce2b89b..8b31f5a7 100644 --- a/wled00/cfg.cpp +++ b/wled00/cfg.cpp @@ -237,7 +237,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[F("groups")]); + CJSON(receiveGroups, if_sync_recv["grp"]); //! following line might be a problem if called after boot receiveNotifications = (receiveNotificationBrightness || receiveNotificationColor || receiveNotificationEffects); @@ -250,7 +250,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[F("groups")]); + CJSON(syncGroups, if_sync_send["grp"]); JsonObject if_nodes = interfaces["nodes"]; CJSON(nodeListEnabled, if_nodes[F("list")]); @@ -591,7 +591,7 @@ void serializeConfig() { if_sync_recv["bri"] = receiveNotificationBrightness; if_sync_recv["col"] = receiveNotificationColor; if_sync_recv["fx"] = receiveNotificationEffects; - if_sync_recv[F("groups")] = receiveGroups; + if_sync_recv["grp"] = receiveGroups; JsonObject if_sync_send = if_sync.createNestedObject("send"); if_sync_send[F("dir")] = notifyDirect; @@ -600,7 +600,7 @@ void serializeConfig() { if_sync_send["hue"] = notifyHue; if_sync_send["macro"] = notifyMacro; if_sync_send[F("twice")] = notifyTwice; - if_sync_send[F("groups")] = syncGroups; + if_sync_send["grp"] = syncGroups; JsonObject if_nodes = interfaces.createNestedObject("nodes"); if_nodes[F("list")] = nodeListEnabled; diff --git a/wled00/json.cpp b/wled00/json.cpp index eb02edbb..7d136d4a 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -22,7 +22,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); @@ -332,7 +332,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); From a7bfd0af4116f887c333830b56c4a64d9fa78db6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Kristan?= Date: Mon, 23 Aug 2021 07:37:34 +0200 Subject: [PATCH 2/4] Changed sync default to group 1 only. --- wled00/wled.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wled00/wled.h b/wled00/wled.h index 8944a303..dc51d7a9 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -298,8 +298,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 uint8_t syncGroups _INIT(0x01); // sync groups this instance syncs (bit mapped) +WLED_GLOBAL uint8_t receiveGroups _INIT(0x01); // 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 From 542d6361f2db9ef6164306a100bbb4e292718198 Mon Sep 17 00:00:00 2001 From: cschwinne Date: Tue, 24 Aug 2021 23:59:09 +0200 Subject: [PATCH 3/4] Make packets with version < 9 group 1 --- wled00/udp.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/wled00/udp.cpp b/wled00/udp.cpp index e380e9e2..14eda6df 100644 --- a/wled00/udp.cpp +++ b/wled00/udp.cpp @@ -225,7 +225,10 @@ void handleNotifications() byte version = udpIn[11]; // if we are not part of any sync group ignore message - if (version > 8 && !(receiveGroups & udpIn[36])) return; + if (version < 9 || version > 199) { + // legacy senders are treated as if sending in sync group 1 only + if (!(receiveGroups & 0x01)) return; + } else if (!(receiveGroups & udpIn[36])) return; bool someSel = (receiveNotificationBrightness || receiveNotificationColor || receiveNotificationEffects); //apply colors from notification @@ -270,7 +273,7 @@ void handleNotifications() } //adjust system time, but only if sender is more accurate than self - if (version > 7) + if (version > 7 && version < 200) { Toki::Time tm; tm.sec = (udpIn[30] << 24) | (udpIn[31] << 16) | (udpIn[32] << 8) | (udpIn[33]); From 421f93205347a868cd3f34e255ff6a1e68e7dc47 Mon Sep 17 00:00:00 2001 From: cschwinne Date: Wed, 25 Aug 2021 00:36:31 +0200 Subject: [PATCH 4/4] Send sync group options as bytes, parse in JS --- wled00/data/settings_sync.htm | 34 +- wled00/html_settings.h | 48 +- wled00/html_ui.h | 1577 +++++++++++++++++---------------- wled00/set.cpp | 9 +- wled00/udp.cpp | 3 +- wled00/xml.cpp | 9 +- 6 files changed, 851 insertions(+), 829 deletions(-) diff --git a/wled00/data/settings_sync.htm b/wled00/data/settings_sync.htm index 094d8f76..66e8b433 100644 --- a/wled00/data/settings_sync.htm +++ b/wled00/data/settings_sync.htm @@ -1,23 +1,51 @@ Sync Settings -
+

Sync setup

WLED Broadcast

UDP Port:
2nd Port:

+ + diff --git a/wled00/html_settings.h b/wled00/html_settings.h index 6a812743..5b253156 100644 --- a/wled00/html_settings.h +++ b/wled00/html_settings.h @@ -237,30 +237,32 @@ type="button" onclick="Save()">Save)====="; // Autogenerated from wled00/data/settings_sync.htm, do not edit!! const char PAGE_settings_sync[] PROGMEM = R"=====(Sync Settings
Sync groups