diff --git a/wled00/cfg.cpp b/wled00/cfg.cpp index 72aaf14b9..f99aa8cd5 100644 --- a/wled00/cfg.cpp +++ b/wled00/cfg.cpp @@ -482,6 +482,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(receiveNotificationPalette, if_sync_recv["pal"]); CJSON(receiveGroups, if_sync_recv["grp"]); CJSON(receiveSegmentOptions, if_sync_recv["seg"]); CJSON(receiveSegmentBounds, if_sync_recv["sb"]); @@ -969,6 +970,7 @@ void serializeConfig() { if_sync_recv["bri"] = receiveNotificationBrightness; if_sync_recv["col"] = receiveNotificationColor; if_sync_recv["fx"] = receiveNotificationEffects; + if_sync_recv["pal"] = receiveNotificationPalette; if_sync_recv["grp"] = receiveGroups; if_sync_recv["seg"] = receiveSegmentOptions; if_sync_recv["sb"] = receiveSegmentBounds; diff --git a/wled00/data/index.js b/wled00/data/index.js index 447bf03a6..25ade1163 100644 --- a/wled00/data/index.js +++ b/wled00/data/index.js @@ -3201,7 +3201,7 @@ function simplifyUI() { createDropdown("palw", "Change palette"); createDropdown("fx", "Change effect", [gId("fxFind"), gId("fxlist")]); - // Hide pallete label + // Hide palette label gId("pall").style.display = "none"; gId("Colors").insertBefore(document.createElement("br"), gId("pall")); // Hide effect label diff --git a/wled00/data/settings_sync.htm b/wled00/data/settings_sync.htm index b8bb5e971..848bf4f2d 100755 --- a/wled00/data/settings_sync.htm +++ b/wled00/data/settings_sync.htm @@ -138,7 +138,7 @@ Use ESP-NOW sync:
(in AP mode or no WiFi

Receive

-Brightness, Color, and Effects
+Brightness, Color, Effects, and Palette
Segment options, bounds

Send

Enable Sync on start:
diff --git a/wled00/set.cpp b/wled00/set.cpp index 6ba920a8a..812bcc52f 100644 --- a/wled00/set.cpp +++ b/wled00/set.cpp @@ -379,6 +379,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage) receiveNotificationBrightness = request->hasArg(F("RB")); receiveNotificationColor = request->hasArg(F("RC")); receiveNotificationEffects = request->hasArg(F("RX")); + receiveNotificationPalette = request->hasArg(F("RP")); receiveSegmentOptions = request->hasArg(F("SO")); receiveSegmentBounds = request->hasArg(F("SG")); sendNotifications = request->hasArg(F("SS")); diff --git a/wled00/udp.cpp b/wled00/udp.cpp index d030b6655..8cf733dff 100644 --- a/wled00/udp.cpp +++ b/wled00/udp.cpp @@ -221,7 +221,7 @@ void parseNotifyPacket(uint8_t *udpIn) { if (!(receiveGroups & 0x01)) return; } else if (!(receiveGroups & udpIn[36])) return; - bool someSel = (receiveNotificationBrightness || receiveNotificationColor || receiveNotificationEffects); + bool someSel = (receiveNotificationBrightness || receiveNotificationColor || receiveNotificationEffects || receiveNotificationPalette); // set transition time before making any segment changes if (version > 3) { @@ -311,6 +311,9 @@ void parseNotifyPacket(uint8_t *udpIn) { selseg.setMode(udpIn[11+ofs]); selseg.speed = udpIn[12+ofs]; selseg.intensity = udpIn[13+ofs]; + } + if (receiveNotificationPalette || !someSel) { + DEBUG_PRINTF_P(PSTR("Apply palette: %u\n"), id); selseg.palette = udpIn[14+ofs]; } if (receiveNotificationColor || !someSel) { @@ -352,14 +355,16 @@ void parseNotifyPacket(uint8_t *udpIn) { } // simple effect sync, applies to all selected segments - if (applyEffects && (version < 11 || !receiveSegmentOptions)) { + if ((applyEffects || receiveNotificationPalette) && (version < 11 || !receiveSegmentOptions)) { for (size_t i = 0; i < strip.getSegmentsNum(); i++) { Segment& seg = strip.getSegment(i); if (!seg.isActive() || !seg.isSelected()) continue; - seg.setMode(udpIn[8]); - seg.speed = udpIn[9]; - if (version > 2) seg.intensity = udpIn[16]; - if (version > 4) seg.setPalette(udpIn[19]); + if (applyEffects) { + seg.setMode(udpIn[8]); + seg.speed = udpIn[9]; + if (version > 2) seg.intensity = udpIn[16]; + } + if (version > 4 && receiveNotificationPalette) seg.setPalette(udpIn[19]); } stateChanged = true; } diff --git a/wled00/wled.h b/wled00/wled.h index 861693463..23c345907 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -676,6 +676,7 @@ WLED_GLOBAL send_notification_t notifyG _INIT(0b00001111); #define receiveNotificationBrightness receiveN.Brightness #define receiveNotificationColor receiveN.Color #define receiveNotificationEffects receiveN.Effects +#define receiveNotificationPalette receiveN.Palette #define receiveSegmentOptions receiveN.SegmentOptions #define receiveSegmentBounds receiveN.SegmentBounds #define receiveDirect receiveN.Direct @@ -687,6 +688,7 @@ WLED_GLOBAL send_notification_t notifyG _INIT(0b00001111); 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 +WLED_GLOBAL bool receiveNotificationPalette _INIT(true); // apply palette WLED_GLOBAL bool receiveSegmentOptions _INIT(false); // apply segment options WLED_GLOBAL bool receiveSegmentBounds _INIT(false); // apply segment bounds (start, stop, offset) WLED_GLOBAL bool receiveDirect _INIT(true); // receive UDP/Hyperion realtime diff --git a/wled00/xml.cpp b/wled00/xml.cpp index 079c0a91b..ef23c0909 100644 --- a/wled00/xml.cpp +++ b/wled00/xml.cpp @@ -484,6 +484,7 @@ void getSettingsJS(byte subPage, char* dest) sappend('c',SET_F("RB"),receiveNotificationBrightness); sappend('c',SET_F("RC"),receiveNotificationColor); sappend('c',SET_F("RX"),receiveNotificationEffects); + sappend('c',SET_F("RP"),receiveNotificationPalette); sappend('c',SET_F("SO"),receiveSegmentOptions); sappend('c',SET_F("SG"),receiveSegmentBounds); sappend('c',SET_F("SS"),sendNotifications);