diff --git a/wled00/WS2812FX.cpp b/wled00/WS2812FX.cpp index c161d8cd..f821ba04 100644 --- a/wled00/WS2812FX.cpp +++ b/wled00/WS2812FX.cpp @@ -101,6 +101,10 @@ void WS2812FX::decreaseSpeed(uint8_t s) { setSpeed(s); } +void WS2812FX::setIntensity(uint8_t in) { + _intensity=in; +} + void WS2812FX::setColor(uint8_t r, uint8_t g, uint8_t b) { setColor(((uint32_t)r << 16) | ((uint32_t)g << 8) | b); } diff --git a/wled00/WS2812FX.h b/wled00/WS2812FX.h index f29b1717..fdd997ae 100644 --- a/wled00/WS2812FX.h +++ b/wled00/WS2812FX.h @@ -235,6 +235,7 @@ class WS2812FX : public NeoPixelBrightnessBus { setCCFS(bool fs), setCCFE(bool fe), setSpeed(uint8_t s), + setIntensity(uint8_t in), increaseSpeed(uint8_t s), decreaseSpeed(uint8_t s), setColor(uint8_t r, uint8_t g, uint8_t b), @@ -272,6 +273,7 @@ class WS2812FX : public NeoPixelBrightnessBus { get_random_wheel_index(uint8_t), getMode(void), getSpeed(void), + getIntensity(void), getBrightness(void), getModeCount(void); @@ -372,6 +374,7 @@ class WS2812FX : public NeoPixelBrightnessBus { maxval(uint8_t v, uint8_t w), _mode_index, _speed, + _intensity, _cc_i1, _cc_i2, _cc_is, diff --git a/wled00/data/index-min.htm b/wled00/data/index-min.htm deleted file mode 100644 index e7a76aa8..00000000 --- a/wled00/data/index-min.htm +++ /dev/null @@ -1,92 +0,0 @@ - - - -WLED 0.5dev - - - - - Loading... - - -//Linearicons.com/free - - - - - - - - - - - - - - - -
- - - - - - - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Effect Panel

- - - - -


-Set secondary color to - - - - - -or -
-
Custom Theater Chase
-using primary and - secondary color LEDs,
-doing steps per tick, -from start and end. -
-
-
-Favorite Presets

- - - - -


-Click checkmark to apply brightness, color and effects.
-Effect 0 is the configuration when the light is powered up. -
-
-

-
-
- - - \ No newline at end of file diff --git a/wled00/data/index.htm b/wled00/data/index.htm index d6f91849..50d3d6cb 100644 --- a/wled00/data/index.htm +++ b/wled00/data/index.htm @@ -1,23 +1,25 @@ + WLED 0.5dev - Loading... + Loading... //Linearicons.com/free @@ -584,63 +534,137 @@
- - - + + + - +

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Effect Panel

- - - - -


+ + + +

+

Set secondary color to - - - - - - or -
+ + + + + + or +

Custom Theater Chase
- using primary and - secondary color LEDs,
- doing steps per tick, + using primary and + secondary color LEDs,
+ doing steps per tick, from start and end.
+
+
+
+
-
- Favorite Presets

- - - - -


- Click checkmark to apply brightness, color and effects.
- Effect 0 is the configuration when the light is powered up. +
+ Favorite Presets

+ + + + +


+ Click checkmark to apply brightness, color and effects.
+ Effect 0 is the configuration when the light is powered up.
-
-

+
+ Timed Light

+

+ Gradually dim down
+ 1st slider sets duration (1-255min), 2nd sets target brightness. +
+
+
+
+
+
diff --git a/wled00/data/msg.htm b/wled00/data/msg.htm new file mode 100644 index 00000000..fbcd679d --- /dev/null +++ b/wled00/data/msg.htm @@ -0,0 +1,43 @@ + + + + WLED Message + + + + +

Sample message.

+ + + \ No newline at end of file diff --git a/wled00/data/settings.htm b/wled00/data/settings.htm index 327b47ea..02adbd7c 100644 --- a/wled00/data/settings.htm +++ b/wled00/data/settings.htm @@ -1,135 +1,41 @@ - - - Settings - + + WLED Settings - -

WLED Settings

-
-
-
-

WiFi setup

-

Connect to existing network

- Network SSID (leave empty to not connect):

- Network password:

- Static IP (leave at 0.0.0.0 for DHCP):
- . - . - . -
- Static gateway:
- . - . - . -
- Static subnet mask:
- . - . - . -
- mDNS address (leave empty for no mDNS):
- http:// .local
- Try connecting before opening AP for: s
- Client IP: Not connected
-

Configure Access Point

- AP SSID (leave empty for no AP):

- Hide AP SSID:
- AP password (leave empty for open):

- AP channel:
- AP IP: Not active
-
-

Application setup

-

Web setup

- Server description:
- Use HSB sliders instead of RGB by default:
-

LED setup

- LED count (max. 255):
- The default boot color is always saved in preset slot 0.
- Alternatively, apply preset at boot
- Default RGB color: - - -
- Default brightness: (0-255)
- Default white value (only RGBW, -1 to disable):
- Default effect ID:
- Default effect speed:
- Ignore and use current color, brightness and effects:
- Turn on after power up/reset:
- Use Gamma correction for brightness:
- Use Gamma correction for color:
- Brightness factor: %
-

Button setup

- On/Off button enabled:
-

Transitions

- Fade:
- Sweep: Invert direction:
- Transition Delay: ms
-

Timed light

- Target brightness: (0-255)
- Change after: min
- Fade:
-

Broadcast

- UDP Port:
- Receive notifications:
- Send notifications on direct change:
- Send notifications on button press:
-

Interfaces

- Emulate Alexa device:
- Alexa invocation name:
- Send Alexa notifications:
-

Time (experimental!)

- Requires reboot.
- Get time from NTP server:
- Current local time is unknown
-

Advanced

- Default overlay ID:
- WARLS offset:
-

Security

- OTA locked:
- Passphrase:
- To enable OTA, for security reasons you need to also enter the correct password!
- The password may/should be changed when OTA is enabled.
- Disable OTA when not in use, otherwise an attacker could reflash device software!

- Disable recovery AP:
- In case of a connection error there will be no wireless recovery possible!
- Completely disables all Access Point functions.
- Setting only changable if OTA is enabled!

- Factory reset:
- All EEPROM content (settings) will be erased.

- - HTTP traffic is not encrypted. An attacker in the same network could intercept form data!
-

About

- WLED version 0.5dev
- (c) 2016-2018 Christian Schwinne
- Licensed under the MIT license

- Uses libraries:
- ESP8266 Arduino Core
- WS2812FX by kitesurfer1404 (Aircoookie fork)
- Timezone library by JChristensen
- arduino-esp8266-alexa-multiple-wemo-switch by kakopappa

- UI icons by Linearicons created by Perxis! (CC-BY-SA 4.0)

- Server message: XML response error! -


-
-
+ +
+
+
+
+
+
\ No newline at end of file diff --git a/wled00/data/settings_leds.htm b/wled00/data/settings_leds.htm new file mode 100644 index 00000000..bdc1feb0 Binary files /dev/null and b/wled00/data/settings_leds.htm differ diff --git a/wled00/data/settings_sec.htm b/wled00/data/settings_sec.htm new file mode 100644 index 00000000..f8b5d624 Binary files /dev/null and b/wled00/data/settings_sec.htm differ diff --git a/wled00/data/settings_sync.htm b/wled00/data/settings_sync.htm new file mode 100644 index 00000000..eea7ce1c Binary files /dev/null and b/wled00/data/settings_sync.htm differ diff --git a/wled00/data/settings_time.htm b/wled00/data/settings_time.htm new file mode 100644 index 00000000..f2cd8c10 Binary files /dev/null and b/wled00/data/settings_time.htm differ diff --git a/wled00/data/settings_ui.htm b/wled00/data/settings_ui.htm new file mode 100644 index 00000000..4d179fee Binary files /dev/null and b/wled00/data/settings_ui.htm differ diff --git a/wled00/data/settings_wifi.htm b/wled00/data/settings_wifi.htm new file mode 100644 index 00000000..264436f0 Binary files /dev/null and b/wled00/data/settings_wifi.htm differ diff --git a/wled00/data/settingssaved.htm b/wled00/data/settingssaved.htm deleted file mode 100644 index 7b55f969..00000000 --- a/wled00/data/settingssaved.htm +++ /dev/null @@ -1,18 +0,0 @@ - - - - Saved Settings - - -
-

Settings saved.

-

If you made changes to WiFi configuration, please reboot.


- -
- - \ No newline at end of file diff --git a/wled00/data/welcome.htm b/wled00/data/welcome.htm new file mode 100644 index 00000000..c6ae60a6 --- /dev/null +++ b/wled00/data/welcome.htm @@ -0,0 +1,43 @@ + + + + WLED Setup + + + + + + + +

+ +

Welcome to WLED!

+

Thank you for installing my application!

+Take a quick look at the wiki!
+If you encounter a bug or have a question/feature suggestion, feel free to open a GitHub issue!

+Next steps:

+Connect the module to your local WiFi here!

+Just trying this out in AP mode? Here are the controls.
+ + \ No newline at end of file diff --git a/wled00/htmls00.h b/wled00/htmls00.h index 2d9c5354..eefe7d06 100644 --- a/wled00/htmls00.h +++ b/wled00/htmls00.h @@ -1,136 +1,22 @@ -/* - * favicon - */ -const char favicon[156] PROGMEM = { - 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x10, 0x10, 0x00, 0x00, 0x01, 0x00, - 0x18, 0x00, 0x86, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x89, 0x50, - 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 0x00, 0x00, 0x00, 0x0D, 0x49, 0x48, - 0x44, 0x52, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x08, 0x06, - 0x00, 0x00, 0x00, 0x1F, 0xF3, 0xFF, 0x61, 0x00, 0x00, 0x00, 0x4D, 0x49, - 0x44, 0x41, 0x54, 0x38, 0x8D, 0x63, 0xFC, 0xFF, 0xFF, 0x3F, 0x03, 0xB1, - 0x80, 0xD1, 0x9E, 0x01, 0x43, 0x31, 0x13, 0xD1, 0xBA, 0x71, 0x00, 0x8A, - 0x0D, 0x60, 0x21, 0xA4, 0x00, 0xD9, 0xD9, 0xFF, 0x0F, 0x32, 0x30, 0x52, - 0xDD, 0x05, 0xB4, 0xF1, 0x02, 0xB6, 0xD0, 0xA6, 0x99, 0x0B, 0x68, 0x1F, - 0x0B, 0xD8, 0x42, 0x9E, 0xAA, 0x2E, 0xA0, 0xD8, 0x00, 0x46, 0x06, 0x3B, - 0xCC, 0xCC, 0x40, 0xC8, 0xD9, 0x54, 0x75, 0x01, 0xE5, 0x5E, 0x20, 0x25, - 0x3B, 0x63, 0x03, 0x00, 0x3E, 0xB7, 0x11, 0x5A, 0x8D, 0x1C, 0x07, 0xB4, - 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4E, 0x44, 0xAE, 0x42, 0x60, 0x82 -}; - /* * Index html */ -//head (js, css) +//head0 (js) const char PAGE_index0[] PROGMEM = R"=====( - - - -WLED 0.5dev - - - + )====="; -//body1 (svg defs) +//head1 (css) const char PAGE_index1[] PROGMEM = R"=====( - - Loading... - -//Linearicons.com/free - - - - - - - - - - - - - - - + )====="; -//body2 (html) +//body0 (svg defs) const char PAGE_index2[] PROGMEM = R"=====( -
- - - - - - - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Effect Panel

- - - - -


-Set secondary color to - - - - - -or -
-
Custom Theater Chase
-using primary and - secondary color LEDs,
-doing steps per tick, -from start and end. -
-
-
-Favorite Presets

- - - - -


-Click checkmark to apply brightness, color and effects.
-Effect 0 is the configuration when the light is powered up. -
-
-

-
-
- - - + )====="; -/* - * SPIFFS editor html - */ -#ifdef USEFS -const char PAGE_edit[] PROGMEM = R"=====( -ESP Editor
+ +//body1 (html) +const char PAGE_index3[] PROGMEM = R"=====( + )====="; -#else -const char PAGE_edit[] PROGMEM = R"=====(SPIFFS disabled by firmware)====="; -#endif diff --git a/wled00/htmls01.h b/wled00/htmls01.h index fb01a8a2..6d213b5e 100644 --- a/wled00/htmls01.h +++ b/wled00/htmls01.h @@ -1,157 +1,17 @@ /* - * Settings html (part 1) + * Settings html */ const char PAGE_settings0[] PROGMEM = R"=====( - - - - -Settings - - - - -

WLED Settings

-
-
-
-

WiFi setup

-

Connect to existing network

-Network SSID (leave empty to not connect):

-Network password:

-Static IP (leave at 0.0.0.0 for DHCP):
- . - . - . -
-Static gateway:
- . - . - . -
-Static subnet mask:
- . - . - . -
-mDNS address (leave empty for no mDNS):
-http:// .local
-Try connecting before opening AP for: s
-Client IP: Not connected
-

Configure Access Point

-AP SSID (leave empty for no AP):

-Hide AP SSID:
-AP password (leave empty for open):

-AP channel:
-AP IP: Not active
-
-

Application setup

-

Web setup

-Server description:
-Use HSB sliders instead of RGB by default:
-

LED setup

-LED count (max. 255):
-The default boot color is saved in preset slot 0.
-Alternatively, apply preset at boot
-Default RGB color: - - -
-Default brightness: (0-255)
-Default white value (only RGBW, -1 to disable):
-Default effect ID:
-Default effect speed:
-Ignore and use current color, brightness and effects:
-Turn on after power up/reset:
-Use Gamma correction for brightness:
-Use Gamma correction for color:
-Brightness factor: %
-

Button setup

-On/Off button enabled:
-

Transitions

-Fade:
-Sweep: Invert direction:
-Transition Delay: ms
-

Timed light

-Target brightness: (0-255)
-Change after: min
-Fade:
-

Broadcast

-UDP Port:
-Receive notifications:
-Send notifications on direct change:
-Send notifications on button press:
-

Interfaces

-Emulate Alexa device:
-Alexa invocation name:
-Send Alexa notifications:
-

Time (experimental!)

-Requires reboot.
-Get time from NTP server:
-Current local time is unknown
-

Advanced

-Default overlay ID:
-WARLS offset:
-

Security

-OTA locked:
-Passphrase:
-To enable OTA, for security reasons you need to also enter the correct password!
-The password may/should be changed when OTA is enabled.
-Disable OTA when not in use, otherwise an attacker could reflash device software!

-Disable recovery AP:
-In case of a connection error there will be no wireless recovery possible!
-Completely disables all Access Point functions.
-Setting only changable if OTA is enabled!

-Factory reset:
-All EEPROM content (settings) will be erased.

-HTTP traffic is not encrypted. An attacker in the same network could intercept form data!
-

About

-WLED version 0.5dev
-(c) 2016-2018 Christian Schwinne
-Licensed under the MIT license

-Uses libraries:
-ESP8266 Arduino Core
-WS2812FX by kitesurfer1404 (Aircoookie fork)
-Timezone library by JChristensen
-arduino-esp8266-alexa-multiple-wemo-switch by kakopappa

-UI icons by Linearicons created by Perxis! (CC-BY-SA 4.0)

-Server message: XML response error! -


-
-
- - + )====="; /* * Settings set html */ -const char PAGE_settingssaved[] PROGMEM = R"=====( - - - - Saved Settings - - -
-

Settings saved.

-

If you made changes to WiFi configuration, please reboot.


- -
- +const char PAGE_msg[] PROGMEM = R"=====( + )====="; diff --git a/wled00/htmls02.h b/wled00/htmls02.h new file mode 100644 index 00000000..9b7b6c6f --- /dev/null +++ b/wled00/htmls02.h @@ -0,0 +1,33 @@ +/* + * Various + */ +/* + * SPIFFS editor html + */ +#ifdef USEFS +const char PAGE_edit[] PROGMEM = R"=====( +ESP
+)====="; +#else +const char PAGE_edit[] PROGMEM = R"=====(SPIFFS disabled by firmware)====="; +#endif +/* + * favicon + */ +const char favicon[156] PROGMEM = { + 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x10, 0x10, 0x00, 0x00, 0x01, 0x00, + 0x18, 0x00, 0x86, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x89, 0x50, + 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 0x00, 0x00, 0x00, 0x0D, 0x49, 0x48, + 0x44, 0x52, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x08, 0x06, + 0x00, 0x00, 0x00, 0x1F, 0xF3, 0xFF, 0x61, 0x00, 0x00, 0x00, 0x4D, 0x49, + 0x44, 0x41, 0x54, 0x38, 0x8D, 0x63, 0xFC, 0xFF, 0xFF, 0x3F, 0x03, 0xB1, + 0x80, 0xD1, 0x9E, 0x01, 0x43, 0x31, 0x13, 0xD1, 0xBA, 0x71, 0x00, 0x8A, + 0x0D, 0x60, 0x21, 0xA4, 0x00, 0xD9, 0xD9, 0xFF, 0x0F, 0x32, 0x30, 0x52, + 0xDD, 0x05, 0xB4, 0xF1, 0x02, 0xB6, 0xD0, 0xA6, 0x99, 0x0B, 0x68, 0x1F, + 0x0B, 0xD8, 0x42, 0x9E, 0xAA, 0x2E, 0xA0, 0xD8, 0x00, 0x46, 0x06, 0x3B, + 0xCC, 0xCC, 0x40, 0xC8, 0xD9, 0x54, 0x75, 0x01, 0xE5, 0x5E, 0x20, 0x25, + 0x3B, 0x63, 0x03, 0x00, 0x3E, 0xB7, 0x11, 0x5A, 0x8D, 0x1C, 0x07, 0xB4, + 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4E, 0x44, 0xAE, 0x42, 0x60, 0x82 +}; diff --git a/wled00/wled00.ino b/wled00/wled00.ino index 9264328b..490b4b21 100644 --- a/wled00/wled00.ino +++ b/wled00/wled00.ino @@ -29,7 +29,7 @@ #include "WS2812FX.h" //version in format yymmddb (b = daily build) -#define VERSION 1801164 +#define VERSION 1801180 const String versionName = "WLED 0.5dev"; //AP and OTA default passwords (change them!) @@ -45,7 +45,7 @@ boolean useRGBW = false; //support for the CRONIXIE clock by Diamex (disable overlays!) //#define CRONIXIE -//spiffs FS only useful for debug +//spiffs FS only useful for debug (only ESP8266) //#define USEFS //to toggle usb serial debug (un)comment following line @@ -53,7 +53,6 @@ boolean useRGBW = false; //Hardware-settings (only changeble via code) #define LEDCOUNT 255 //maximum, exact count set-able via settings -#define MAXDIRECT 255 //for direct access like arls, should be >= LEDCOUNT uint8_t buttonPin = 0; //needs pull-up uint8_t auxPin = 15; //use e.g. for external relay uint8_t auxDefaultState = 0; //0: input 1: high 2: low @@ -69,8 +68,6 @@ time_t local; #ifdef CRONIXIE #undef LEDCOUNT #define LEDCOUNT 60 -#undef MAXDIRECT -#define MAXDIRECT 48 uint8_t ledcount = 6; String apssid = "CRONIXIE-AP"; String alexaInvocationName = "Clock"; @@ -124,6 +121,7 @@ boolean nightlightFade = true; uint16_t udpPort = 21324; uint8_t effectDefault = 0; uint8_t effectSpeedDefault = 75; +uint8_t effectIntensityDefault = 128; //NTP stuff #ifndef CRONIXIE boolean ntpEnabled = false; @@ -177,8 +175,9 @@ boolean nightlightActive_old = false; int nightlightDelayMs; uint8_t effectCurrent = 0; uint8_t effectSpeed = 75; +uint8_t effectIntensity = 128; boolean udpConnected = false; -byte udpIn[MAXDIRECT*4+2]; +byte udpIn[1026]; //NTP stuff boolean ntpConnected = false; unsigned int ntpLocalPort = 2390; @@ -218,6 +217,7 @@ boolean arlsSign = true; uint8_t auxTime = 0; unsigned long auxStartTime; boolean auxActive, auxActiveBefore; +boolean initialBoot = false; boolean useGammaCorrectionBri = false; boolean useGammaCorrectionRGB = true; @@ -243,11 +243,12 @@ WiFiUDP ntpUdp; WS2812FX strip = WS2812FX(LEDCOUNT); //eeprom Version code, enables default settings instead of 0 init on update -#define EEPVER 3 +#define EEPVER 4 //0 -> old version, default //1 -> 0.4p 1711272 and up //2 -> 0.4p 1711302 and up //3 -> 0.4 1712121 and up +//4 -> 0.5dev 1801271 and up #ifdef DEBUG #define DEBUG_PRINT(x) Serial.print (x) diff --git a/wled00/wled01_eeprom.ino b/wled00/wled01_eeprom.ino index 26a673ff..37bce9fc 100644 --- a/wled00/wled01_eeprom.ino +++ b/wled00/wled01_eeprom.ino @@ -87,7 +87,7 @@ void saveSettingsToEEPROM() } EEPROM.write(324, effectDefault); EEPROM.write(325, effectSpeedDefault); - //326 reserved for effectIntensity + EEPROM.write(326, effectIntensityDefault); EEPROM.write(327, ntpEnabled); //328 reserved for timezone setting //329 reserved for dst setting @@ -246,10 +246,10 @@ void loadSettingsFromEEPROM(bool first) } //377 = lastEEPROMversion if (lastEEPROMversion > 1) { - col_sec_s[0] = EEPROM.read(378); - col_sec_s[1] = EEPROM.read(379); - col_sec_s[2] = EEPROM.read(380); - white_sec_s = EEPROM.read(381); + col_sec_s[0] = EEPROM.read(378); col_sec[0] = col_sec_s[0]; + col_sec_s[1] = EEPROM.read(379); col_sec[1] = col_sec_s[1]; + col_sec_s[2] = EEPROM.read(380); col_sec[2] = col_sec_s[2]; + white_sec_s = EEPROM.read(381); white_sec = white_sec_s; cc_index1 = EEPROM.read(382); cc_index2 = EEPROM.read(383); cc_numPrimary = EEPROM.read(384); @@ -259,6 +259,9 @@ void loadSettingsFromEEPROM(bool first) cc_step = EEPROM.read(388); strip.setCustomChase(cc_index1, cc_index2, cc_start, cc_numPrimary, cc_numSecondary, cc_step, cc_fromStart, cc_fromEnd); } + if (lastEEPROMversion > 3) { + effectIntensityDefault = EEPROM.read(326); effectIntensity = effectIntensityDefault; + } bootPreset = EEPROM.read(389); //favorite setting memory (25 slots/ each 20byte) @@ -271,12 +274,13 @@ void loadSettingsFromEEPROM(bool first) strip.setMode(effectCurrent); strip.setSpeed(effectSpeed); + strip.setIntensity(effectIntensity); overlayCurrent = overlayDefault; } //PRESET PROTOCOL 20 bytes //0: preset purpose byte 0:invalid 1:valid preset 1.0 -//1:a 2:r 3:g 4:b 5:w 6:er 7:eg 8:eb 9:ew 10:fx 11:sx | custom chase 12:numP 13:numS 14:(0:fs 1:both 2:fe) 15:step 16-19:Zeros +//1:a 2:r 3:g 4:b 5:w 6:er 7:eg 8:eb 9:ew 10:fx 11:sx | custom chase 12:numP 13:numS 14:(0:fs 1:both 2:fe) 15:step 16:ix 17-19:Zeros void applyPreset(uint8_t index, bool loadBri, bool loadCol, bool loadFX) { @@ -300,6 +304,7 @@ void applyPreset(uint8_t index, bool loadBri, bool loadCol, bool loadFX) { effectCurrent = EEPROM.read(i+10); effectSpeed = EEPROM.read(i+11); + effectIntensity = EEPROM.read(i+16); cc_numPrimary = EEPROM.read(i+12); cc_numSecondary = EEPROM.read(i+13); cc_fromEnd = EEPROM.read(i+14); @@ -308,6 +313,7 @@ void applyPreset(uint8_t index, bool loadBri, bool loadCol, bool loadFX) strip.setCustomChase(cc_index1, cc_index2, cc_start, cc_numPrimary, cc_numSecondary, cc_step, cc_fromStart, cc_fromEnd); strip.setMode(effectCurrent); strip.setSpeed(effectSpeed); + strip.setIntensity(effectIntensity); } } @@ -335,6 +341,7 @@ void savePreset(uint8_t index) if (!cc_fromEnd) m = 0; EEPROM.write(i+14, m); EEPROM.write(i+15, cc_step); + EEPROM.write(i+16, effectIntensity); EEPROM.commit(); } diff --git a/wled00/wled02_xml.ino b/wled00/wled02_xml.ino index 651e7f13..bdad0002 100644 --- a/wled00/wled02_xml.ino +++ b/wled00/wled02_xml.ino @@ -33,7 +33,9 @@ void XML_response() resp = resp + effectCurrent; resp = resp + ""; resp = resp + effectSpeed; - resp = resp + ""; + resp = resp + ""; + resp = resp + effectIntensity; + resp = resp + ""; if (useRGBW) { resp = resp + white; } else { @@ -49,9 +51,11 @@ void XML_response() server.send(200, "text/xml", resp); } -String getSettings() +String getSettings(uint8_t subPage) { - DEBUG_PRINTLN("settings resp"); + //0: menu 1: wifi 2: leds 3: ui 4: sync 5: time 6: sec + DEBUG_PRINT("settings resp"); + DEBUG_PRINTLN(subPage); String resp = ""; String ds = "d.Sf."; @@ -103,6 +107,10 @@ String getSettings() } else { resp += ds + "CLDFW" + v + "-1;"; } + resp += ds + "CSECR" + v + col_sec_s[0] +";"; + resp += ds + "CSECG" + v + col_sec_s[1] +";"; + resp += ds + "CSECB" + v + col_sec_s[2] +";"; + resp += ds + "CSECW" + v + white_s +";"; resp += ds + "BOOTN" + c + turnOnAtBoot +";"; resp += ds + "BOOTP" + v + bootPreset +";"; resp += ds + "FXDEF" + v + effectDefault +";"; diff --git a/wled00/wled03_set.ino b/wled00/wled03_set.ino index 69e2d5bd..707069e7 100644 --- a/wled00/wled03_set.ino +++ b/wled00/wled03_set.ino @@ -122,11 +122,12 @@ void handleSettingsSet() if (i >= 0 && i <= LEDCOUNT) ledcount = i; strip.setLedCount(ledcount); } - if (server.hasArg("CBEOR")) + if (server.hasArg("CBEOR")) //ignore settings and save current brightness, colors and fx as default { col_s[0] = col[0]; col_s[1] = col[1]; col_s[2] = col[2]; + if (useRGBW) white_s = white; bri_s = bri; effectDefault = effectCurrent; effectSpeedDefault = effectSpeed; @@ -146,6 +147,26 @@ void handleSettingsSet() int i = server.arg("CLDFB").toInt(); if (i >= 0 && i <= 255) col_s[2] = i; } + if (server.hasArg("CSECR")) + { + int i = server.arg("CSECR").toInt(); + if (i >= 0 && i <= 255) col_sec_s[0] = i; + } + if (server.hasArg("CSECG")) + { + int i = server.arg("CSECG").toInt(); + if (i >= 0 && i <= 255) col_sec_s[1] = i; + } + if (server.hasArg("CSECB")) + { + int i = server.arg("CSECB").toInt(); + if (i >= 0 && i <= 255) col_sec_s[2] = i; + } + if (server.hasArg("CSECW")) + { + int i = server.arg("CSECW").toInt(); + if (i >= 0 && i <= 255) white_sec_s = i; + } if (server.hasArg("CLDFW")) { int i = server.arg("CLDFW").toInt(); @@ -163,12 +184,6 @@ void handleSettingsSet() int i = server.arg("CLDFA").toInt(); if (i >= 0 && i <= 255) bri_s = i; } - turnOnAtBoot = server.hasArg("BOOTN"); - if (server.hasArg("BOOTP")) - { - int i = server.arg("BOOTP").toInt(); - if (i >= 0 && i <= 25) bootPreset = i; - } if (server.hasArg("FXDEF")) { int i = server.arg("FXDEF").toInt(); @@ -180,6 +195,12 @@ void handleSettingsSet() if (i >= 0 && i <= 255) effectSpeedDefault = i; } } + turnOnAtBoot = server.hasArg("BOOTN"); + if (server.hasArg("BOOTP")) + { + int i = server.arg("BOOTP").toInt(); + if (i >= 0 && i <= 25) bootPreset = i; + } useGammaCorrectionBri = server.hasArg("GCBRI"); useGammaCorrectionRGB = server.hasArg("GCRGB"); buttonEnabled = server.hasArg("BTNON"); diff --git a/wled00/wled05_init.ino b/wled00/wled05_init.ino index 373ec61b..620010ba 100644 --- a/wled00/wled05_init.ino +++ b/wled00/wled05_init.ino @@ -87,19 +87,18 @@ void wledInit() if(!handleFileRead("/favicon.ico")) server.send(200, "image/x-icon", favicon); }); server.on("/", HTTP_GET, [](){ - if(!handleFileRead("/index.htm")) { - if (!arlsTimeout) //do not serve while receiving realtime - { - server.setContentLength(strlen_P(PAGE_index0) + strlen_P(PAGE_index1) + strlen_P(PAGE_index2)); - server.send(200, "text/html", ""); - server.sendContent_P(PAGE_index0); - server.sendContent_P(PAGE_index1); - server.sendContent_P(PAGE_index2); - } else { - server.send(200, "text/plain", "The WLED UI is not available while receiving real-time data."); + if (!initialBoot){ + if(!handleFileRead("/index.htm")) { + serveIndex(); + } + }else{ + if(!handleFileRead("/welcome.htm")) { + serveWelcomePage(); } } }); + server.on("/sliders", HTTP_GET, serveIndex) + server.on("/welcome", HTTP_GET, serveWelcomePage) server.on("/reset", HTTP_GET, [](){ server.send(200, "text/plain", "Rebooting..."); reset(); @@ -134,13 +133,13 @@ void wledInit() #endif info += "name: " + versionName + "\r\n"; info += "version: " + (String)VERSION + "\r\n"; + info += "eepver: " + String(EEPVER) + "\r\n"; #ifdef RGBW info += "rgbw: true\r\n"; #else info += "rgbw: false\r\n"; #endif info += "max-leds: " + (String)LEDCOUNT + "\r\n"; - info += "max-direct: " + (String)MAXDIRECT + "\r\n"; #ifdef USEOVERLAYS info += "overlays: true\r\n"; #else @@ -231,9 +230,7 @@ void wledInit() // Initialize NeoPixel Strip strip.init(); strip.setLedCount(ledcount); - strip.setMode(effectCurrent); strip.setColor(0); - strip.setSpeed(effectSpeed); strip.setBrightness(255); strip.start(); @@ -279,3 +276,46 @@ void initCon() } } +void buildCssColorString() +{ + cssColorString=":root{--aCol:"; + cssColorString+=cssCol[0]; + cssColorString+=";--bCol:"; + cssColorString+=cssCol[1]; + cssColorString+=";--cCol:"; + cssColorString+=cssCol[2]; + cssColorString+=";--dCol:"; + cssColorString+=cssCol[3]; + cssColorString+=";--sCol:"; + cssColorString+=cssCol[4]; + cssColorString+=";}"; +} + +void serveIndex() +{ + if (!arlsTimeout) //do not serve while receiving realtime + { + server.setContentLength(strlen_P(PAGE_index0) + cssColorString.length() + strlen_P(PAGE_index1) + strlen_P(PAGE_index2) + strlen_P(PAGE_index3)); + server.send(200, "text/html", ""); + server.sendContent_P(PAGE_index0); + server.sendContent(cssColorString); + server.sendContent_P(PAGE_index1); + server.sendContent_P(PAGE_index2); + server.sendContent_P(PAGE_index3); + } else { + server.send(200, "text/plain", "The WLED UI is not available while receiving real-time data."); + } +} + +void serveWelcomePage() +{ + String resp = ""; + resp += PAGE_welcome0; + resp += cssColorString; + resp += PAGE_welcome1; + server.send(200, "text/html", resp); +} + + + + diff --git a/wled00/wled07_notify.ino b/wled00/wled07_notify.ino index adf6ff8d..94cda649 100644 --- a/wled00/wled07_notify.ino +++ b/wled00/wled07_notify.ino @@ -2,6 +2,8 @@ * UDP notifier */ +#define WLEDPACKETSIZE 24 + void notify(uint8_t callMode) { if (!udpConnected) return; @@ -13,7 +15,7 @@ void notify(uint8_t callMode) case 6: if (!notifyDirect) return; break; //fx change default: return; } - byte udpOut[16]; + byte udpOut[WLEDPACKETSIZE]; udpOut[0] = 0; //0: wled notifier protocol 1: WARLS protocol udpOut[1] = callMode; udpOut[2] = bri; @@ -25,17 +27,18 @@ void notify(uint8_t callMode) udpOut[8] = effectCurrent; udpOut[9] = effectSpeed; udpOut[10] = white; - udpOut[11] = 2; //compatibilityVersionByte: 0: old 1: supports white 2: supports secondary color + udpOut[11] = 3; //compatibilityVersionByte: 0: old 1: supports white 2: supports secondary color 3: supports FX intensity, 24 byte packet udpOut[12] = col_sec[0]; udpOut[13] = col_sec[1]; udpOut[14] = col_sec[2]; udpOut[15] = white_sec; + udpOut[16] = effectIntensity; IPAddress broadcastIp; broadcastIp = ~WiFi.subnetMask() | WiFi.gatewayIP(); notifierUdp.beginPacket(broadcastIp, udpPort); - notifierUdp.write(udpOut, 16); + notifierUdp.write(udpOut, WLEDPACKETSIZE); notifierUdp.endPacket(); } @@ -72,6 +75,11 @@ void handleNotifications() effectSpeed = udpIn[9]; strip.setSpeed(effectSpeed); } + if (udpIn[11] > 3 && udpIn[16] != effectIntensity) + { + effectSpeed = udpIn[16]; + strip.setIntensity(effectIntensity); + } nightlightActive = udpIn[6]; if (!nightlightActive) { diff --git a/wled00/wled15_hue.ino b/wled00/wled15_hue.ino new file mode 100644 index 00000000..388ce0c8 --- /dev/null +++ b/wled00/wled15_hue.ino @@ -0,0 +1,4 @@ +/* + * Sync to Philips hue lights + */ +void foo(){}