diff --git a/wled00/cfg.cpp b/wled00/cfg.cpp index 86c8c6878..f16c69263 100644 --- a/wled00/cfg.cpp +++ b/wled00/cfg.cpp @@ -240,8 +240,9 @@ bool deserializeConfig(JsonObject doc, bool fromFS) { CJSON(receiveNotificationColor, if_sync_recv["col"]); CJSON(receiveNotificationEffects, if_sync_recv["fx"]); CJSON(receiveGroups, if_sync_recv["grp"]); + CJSON(receiveSegmentOptions, if_sync_recv["seg"]); //! following line might be a problem if called after boot - receiveNotifications = (receiveNotificationBrightness || receiveNotificationColor || receiveNotificationEffects); + receiveNotifications = (receiveNotificationBrightness || receiveNotificationColor || receiveNotificationEffects || receiveSegmentOptions); JsonObject if_sync_send = if_sync["send"]; prev = notifyDirectDefault; @@ -640,6 +641,7 @@ void serializeConfig() { if_sync_recv["col"] = receiveNotificationColor; if_sync_recv["fx"] = receiveNotificationEffects; if_sync_recv["grp"] = receiveGroups; + if_sync_recv["seg"] = receiveSegmentOptions; JsonObject if_sync_send = if_sync.createNestedObject("send"); if_sync_send[F("dir")] = notifyDirect; diff --git a/wled00/colors.cpp b/wled00/colors.cpp index 424c99165..0655060e6 100644 --- a/wled00/colors.cpp +++ b/wled00/colors.cpp @@ -22,11 +22,6 @@ void colorFromUint24(uint32_t in, bool secondary) _col[2] = B(in); } -//store color components in uint32_t -uint32_t colorFromRgbw(byte* rgbw) { - return RGBW32(rgbw[0], rgbw[1], rgbw[2], rgbw[3]); -} - //relatively change white brightness, minumum A=5 void relativeChangeWhite(int8_t amount, byte lowerBoundary) { @@ -259,7 +254,7 @@ uint32_t colorBalanceFromKelvin(uint16_t kelvin, uint32_t rgb) rgbw[1] = ((uint16_t) correctionRGB[1] * G(rgb)) /255; // correct G rgbw[2] = ((uint16_t) correctionRGB[2] * B(rgb)) /255; // correct B rgbw[3] = W(rgb); - return colorFromRgbw(rgbw); + return RGBW32(rgbw[0],rgbw[1],rgbw[2],rgbw[3]); } //approximates a Kelvin color temperature from an RGB color. @@ -299,4 +294,4 @@ uint16_t approximateKelvinFromRGB(uint32_t rgb) { uint16_t k = 8080 + (225-r) *86; return (k > 10091) ? 10091 : k; } -} \ No newline at end of file +} diff --git a/wled00/data/index.css b/wled00/data/index.css index a7588ddbc..fe7f55821 100644 --- a/wled00/data/index.css +++ b/wled00/data/index.css @@ -609,11 +609,12 @@ input[type=range]:active + .sliderbubble { width: 216px; } .btn-xs { - width: 39px; + width: 42px; + height: 42px; margin: 2px 0 0 0; } .btn-pl-add { - margin-left: 9px; + margin-left: 5px; } @@ -645,7 +646,7 @@ input[type=range]:active + .sliderbubble { .sel-pl { width: 192px; background-position: 168px 16px; - margin: 8px 7px 0 0; + margin: 8px 3px 0 0; } .sel-ple { diff --git a/wled00/data/index.htm b/wled00/data/index.htm index 25787aa34..6ec6d5bf1 100644 --- a/wled00/data/index.htm +++ b/wled00/data/index.htm @@ -141,7 +141,7 @@

Effect speed

- +
diff --git a/wled00/data/index.js b/wled00/data/index.js index 806315ae0..8f13a9f33 100644 --- a/wled00/data/index.js +++ b/wled00/data/index.js @@ -603,7 +603,6 @@ function populateSegments(s)
- +
+ + +

`; } @@ -627,10 +630,13 @@ function populateSegments(s) noNewSegs = false; } for (var i = 0; i <= lSeg; i++) { - updateLen(i); - updateTrail(d.getElementById(`seg${i}bri`)); - if (segCount < 2) d.getElementById(`segd${lSeg}`).style.display = "none"; + updateLen(i); + updateTrail(d.getElementById(`seg${i}bri`)); + let segr = d.getElementById(`segr${i}`); + if (segr) segr.style.display = "none"; } + if (segCount < 2) d.getElementById(`segd${lSeg}`).style.display = "none"; + if (!noNewSegs && (cfg.comp.seglen?parseInt(d.getElementById(`seg${lSeg}s`).value):0)+parseInt(d.getElementById(`seg${lSeg}e`).value) 1) ? "inline":"none"; } @@ -872,7 +878,7 @@ function updateLen(s) { if (!d.getElementById(`seg${s}s`)) return; var start = parseInt(d.getElementById(`seg${s}s`).value); - var stop = parseInt(d.getElementById(`seg${s}e`).value); + var stop = parseInt(d.getElementById(`seg${s}e`).value); var len = stop - (cfg.comp.seglen?0:start); var out = "(delete)"; if (len > 1) { @@ -1491,6 +1497,29 @@ function selSeg(s){ requestJson(obj, false); } +function rptSeg(s) +{ + var name = d.getElementById(`seg${s}t`).value; + var start = parseInt(d.getElementById(`seg${s}s`).value); + var stop = parseInt(d.getElementById(`seg${s}e`).value); + if (stop == 0) {return;} + var rev = d.getElementById(`seg${s}rev`).checked; + var mi = d.getElementById(`seg${s}mi`).checked; + var sel = d.getElementById(`seg${s}sel`).checked; + var obj = {"seg": {"id": s, "n": name, "start": start, "stop": (cfg.comp.seglen?start:0)+stop, "rev": rev, "mi": mi, "on": !powered[s], "bri": parseInt(d.getElementById(`seg${s}bri`).value), "sel": sel}}; + if (d.getElementById(`seg${s}grp`)) { + var grp = parseInt(d.getElementById(`seg${s}grp`).value); + var spc = parseInt(d.getElementById(`seg${s}spc`).value); + var ofs = parseInt(d.getElementById(`seg${s}of` ).value); + obj.seg.grp = grp; + obj.seg.spc = spc; + obj.seg.of = ofs; + } + obj.seg.rpt = true; + expand(s); + requestJson(obj); +} + function setSeg(s){ var name = d.getElementById(`seg${s}t`).value; var start = parseInt(d.getElementById(`seg${s}s`).value); @@ -1542,6 +1571,13 @@ function setSegBri(s){ requestJson(obj); } +function tglFreeze(s=null) +{ + var obj = {"seg": {"frz": "t"}}; // toggle + if (s!==null) obj.id = s; + requestJson(obj); +} + function setX(ind = null) { if (ind === null) { ind = parseInt(d.querySelector('#fxlist input[name="fx"]:checked').value); diff --git a/wled00/data/settings_sync.htm b/wled00/data/settings_sync.htm index cb0e5b1c0..0eb0cfb63 100644 --- a/wled00/data/settings_sync.htm +++ b/wled00/data/settings_sync.htm @@ -5,7 +5,8 @@ function gId(s) { return d.getElementById(s); } -function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#sync-settings");}function B(){window.open("/settings","_self");} +function H(){window.open("https://kno.wled.ge/interfaces/udp-notifier/");} +function B(){window.open("/settings","_self");} function adj(){if (d.Sf.DI.value == 6454) {if (d.Sf.DA.value == 1) d.Sf.DA.value = 0; if (d.Sf.EU.value == 1) d.Sf.EU.value = 0;} else if (d.Sf.DI.value == 5568) {if (d.Sf.DA.value == 0) d.Sf.DA.value = 1; if (d.Sf.EU.value == 0) d.Sf.EU.value = 1;} } function FC() @@ -81,7 +82,8 @@ UDP Port:
-Receive: Brightness, Color, and Effects
+Receive: Brightness, Color, and Effects
+ Segment options
Send notifications on direct change:
Send notifications on button press or IR:
Send Alexa notifications:
@@ -117,45 +119,45 @@ DMX mode:
-E1.31 info
+E1.31 info
Timeout: ms
Force max brightness:
Disable realtime gamma correction:
Realtime LED offset:

Alexa Voice Assistant

Emulate Alexa device:
-Alexa invocation name: +Alexa invocation name:

Blynk

Blynk, MQTT and Hue sync all connect to external hosts!
This may impact the responsiveness of the ESP8266.

For best results, only use one of these services at a time.
(alternatively, connect a second ESP to them and use the UDP sync)

-Host: +Host: Port:
Device Auth token:
-Clear the token field to disable. Setup info +Clear the token field to disable. Setup info

MQTT

Enable MQTT:
-Broker: +Broker: Port:
The MQTT credentials are sent over an unsecured connection.
Never use the MQTT password for another service!

-Username:
+Username:
Password:
-Client ID:
-Device Topic:
-Group Topic:
+Client ID:
+Device Topic:
+Group Topic:
Publish on button press:
-Reboot required to apply changes. MQTT info +Reboot required to apply changes. MQTT info

Philips Hue

You can find the bridge IP and the light number in the 'About' section of the hue app.
Poll Hue light every ms:
Then, receive On/Off, Brightness, and Color
Hue Bridge IP:
- . - . - . -
+ . + . + . +
Press the pushlink button on the bridge, after that save this page!
(when first connecting)
Hue status: Disabled in this build
diff --git a/wled00/fcn_declare.h b/wled00/fcn_declare.h index af9e4a53f..a139cb2f7 100644 --- a/wled00/fcn_declare.h +++ b/wled00/fcn_declare.h @@ -15,9 +15,11 @@ void handleAlexa(); void onAlexaChange(EspalexaDevice* dev); //blynk.cpp +#ifndef WLED_DISABLE_BLYNK void initBlynk(const char* auth, const char* host, uint16_t port); void handleBlynk(); void updateBlynk(); +#endif //button.cpp void shortPressAction(uint8_t b=0); @@ -56,7 +58,7 @@ bool getJsonValue(const JsonVariant& element, DestType& destination, const Defau //colors.cpp void colorFromUint32(uint32_t in, bool secondary = false); void colorFromUint24(uint32_t in, bool secondary = false); -uint32_t colorFromRgbw(byte* rgbw); +inline uint32_t colorFromRgbw(byte* rgbw) { return uint32_t((byte(rgbw[3]) << 24) | (byte(rgbw[0]) << 16) | (byte(rgbw[1]) << 8) | (byte(rgbw[2]))); } void relativeChangeWhite(int8_t amount, byte lowerBoundary = 0); void colorHStoRGB(uint16_t hue, byte sat, byte* rgb); //hue, sat to rgb void colorKtoRGB(uint16_t kelvin, byte* rgb); @@ -141,7 +143,6 @@ void resetTimebase(); void toggleOnOff(); void setAllLeds(); void setLedsStandard(); -bool colorChanged(); void colorUpdated(int callMode); void updateInterfaces(uint8_t callMode); void handleTransitions(); diff --git a/wled00/html_settings.h b/wled00/html_settings.h index 79afdda1f..370c28288 100644 --- a/wled00/html_settings.h +++ b/wled00/html_settings.h @@ -245,7 +245,7 @@ type="button" onclick="Save()">Save)====="; // Autogenerated from wled00/data/settings_sync.htm, do not edit!! const char PAGE_settings_sync[] PROGMEM = R"=====( Sync Settings