mirror of
https://github.com/wled/WLED.git
synced 2025-04-23 14:27:18 +00:00
Merge pull request #4137 from felddy/feature/toggle_pallet_sync
Add the ability to toggle the reception of palette synchronizations
This commit is contained in:
commit
7f1ec4802d
@ -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;
|
||||
|
@ -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
|
||||
|
@ -138,7 +138,7 @@ Use ESP-NOW sync: <input type="checkbox" name="EN"><br><i>(in AP mode or no WiFi
|
||||
</tr>
|
||||
</table>
|
||||
<h3>Receive</h3>
|
||||
<nowrap><input type="checkbox" name="RB">Brightness,</nowrap> <nowrap><input type="checkbox" name="RC">Color,</nowrap> <nowrap>and <input type="checkbox" name="RX">Effects</nowrap><br>
|
||||
<nowrap><input type="checkbox" name="RB">Brightness,</nowrap> <nowrap><input type="checkbox" name="RC">Color,</nowrap> <nowrap><input type="checkbox" name="RX">Effects,</nowrap> <nowrap>and <input type="checkbox" name="RP">Palette</nowrap><br>
|
||||
<input type="checkbox" name="SO"> Segment options, <input type="checkbox" name="SG"> bounds
|
||||
<h3>Send</h3>
|
||||
Enable Sync on start: <input type="checkbox" name="SS"><br>
|
||||
|
@ -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"));
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user