diff --git a/wled00/data/index.htm b/wled00/data/index.htm
index 300184bf..f7579be1 100644
--- a/wled00/data/index.htm
+++ b/wled00/data/index.htm
@@ -2,7 +2,7 @@
- WLED 0.6.5
+ WLED 0.7.0
diff --git a/wled00/data/settings_leds.htm b/wled00/data/settings_leds.htm
index aee4a377..76fb1f8e 100644
Binary files a/wled00/data/settings_leds.htm and b/wled00/data/settings_leds.htm differ
diff --git a/wled00/data/settings_sec.htm b/wled00/data/settings_sec.htm
index 2b61d5ad..c02bcd39 100644
Binary files a/wled00/data/settings_sec.htm and b/wled00/data/settings_sec.htm differ
diff --git a/wled00/htmls00.h b/wled00/htmls00.h
index 35ceaa5f..3c1b532c 100644
--- a/wled00/htmls00.h
+++ b/wled00/htmls00.h
@@ -1058,7 +1058,7 @@ const char PAGE_index0[] PROGMEM = R"=====(
-WLED 0.6.5
+WLED 0.7.0
)=====";
diff --git a/wled00/htmls01.h b/wled00/htmls01.h
index 7bc78e64..d87b8a79 100644
--- a/wled00/htmls01.h
+++ b/wled00/htmls01.h
@@ -93,10 +93,12 @@ Default RGB color:
Default white value (only RGBW):
+Auto-calculate white from RGB instead:
Default brightness: (0-255)
Default effect ID:
Default effect speed:
Default effect intensity:
+Default secondary RGB(W):
@@ -345,7 +347,7 @@ HTTP traffic is unencrypted. An attacker in the same network can intercept form
Enable ArduinoOTA:
About
-WLED version 0.6.5
+WLED version 0.7.0
Contributors:
StormPie (Mobile HTML UI)
(c) 2016-2018 Christian Schwinne
diff --git a/wled00/wled00.ino b/wled00/wled00.ino
index c16ff171..261cbdf1 100644
--- a/wled00/wled00.ino
+++ b/wled00/wled00.ino
@@ -3,7 +3,7 @@
*/
/*
* @title WLED project sketch
- * @version 0.6.5
+ * @version 0.7.0
* @author Christian Schwinne
*/
@@ -33,8 +33,8 @@
#include "WS2812FX.h"
//version in format yymmddb (b = daily build)
-#define VERSION 1805222
-const String versionString = "0.6.5";
+#define VERSION 1805311
+const String versionString = "0.7.0";
//AP and OTA default passwords (change them!)
String apPass = "wled1234";
@@ -70,7 +70,7 @@ IPAddress staticIP(0, 0, 0, 0);
IPAddress staticGateway(0, 0, 0, 0);
IPAddress staticSubnet(255, 255, 255, 0);
IPAddress staticDNS(8, 8, 8, 8); //only for NTP
-bool useHSB = true, useHSBDefault = true, useRGBW = false;
+bool useHSB = true, useHSBDefault = true, useRGBW = false, autoRGBtoRGBW = false;
bool turnOnAtBoot = true;
bool initLedsLast = false;
byte bootPreset = 0;
diff --git a/wled00/wled01_eeprom.ino b/wled00/wled01_eeprom.ino
index acfa1cfd..6755e29f 100644
--- a/wled00/wled01_eeprom.ino
+++ b/wled00/wled01_eeprom.ino
@@ -213,6 +213,7 @@ void saveSettingsToEEPROM()
EEPROM.write(2200,!receiveDirect);
EEPROM.write(2201,enableRealtimeUI);
EEPROM.write(2202,uiConfiguration);
+ EEPROM.write(2203,autoRGBtoRGBW);
EEPROM.commit();
}
@@ -424,6 +425,7 @@ void loadSettingsFromEEPROM(bool first)
receiveDirect = !EEPROM.read(2200);
enableRealtimeUI = EEPROM.read(2201);
uiConfiguration = EEPROM.read(2202);
+ autoRGBtoRGBW = EEPROM.read(2203);
bootPreset = EEPROM.read(389);
wifiLock = EEPROM.read(393);
diff --git a/wled00/wled02_xml.ino b/wled00/wled02_xml.ino
index 6258f417..e30f4177 100644
--- a/wled00/wled02_xml.ino
+++ b/wled00/wled02_xml.ino
@@ -142,6 +142,7 @@ String getSettings(byte subPage)
resp += ds + "CB" + v + colS[2] +";";
resp += ds + "CA" + v + briS +";";
resp += ds + "EW" + c + useRGBW +";";
+ resp += ds + "AW" + c + autoRGBtoRGBW +";";
resp += ds + "CW" + v + whiteS +";";
resp += ds + "SR" + v + colSecS[0] +";";
resp += ds + "SG" + v + colSecS[1] +";";
diff --git a/wled00/wled03_set.ino b/wled00/wled03_set.ino
index 4f6d3965..7a2ccf09 100644
--- a/wled00/wled03_set.ino
+++ b/wled00/wled03_set.ino
@@ -122,6 +122,7 @@ void handleSettingsSet(byte subPage)
#endif
}
useRGBW = server.hasArg("EW");
+ autoRGBtoRGBW = server.hasArg("AW");
if (server.hasArg("IS")) //ignore settings and save current brightness, colors and fx as default
{
colS[0] = col[0];
@@ -707,6 +708,8 @@ bool handleSet(String req)
}
}
}
+ //deactivate nightlight if target brightness is reached
+ if (bri == nightlightTargetBri) nightlightActive = false;
//set time (unix timestamp)
pos = req.indexOf("ST=");
if (pos > 0) {
diff --git a/wled00/wled08_led.ino b/wled00/wled08_led.ino
index 4e97d076..f4e83cc9 100644
--- a/wled00/wled08_led.ino
+++ b/wled00/wled08_led.ino
@@ -20,6 +20,11 @@ void setAllLeds() {
}
whiteSecT = whiteSec;
}
+ if (autoRGBtoRGBW)
+ {
+ colorRGBtoRGBW(colT,&whiteT);
+ colorRGBtoRGBW(colSecT,&whiteSecT);
+ }
if (useGammaCorrectionRGB)
{
strip.setColor(gamma8[colT[0]], gamma8[colT[1]], gamma8[colT[2]], gamma8[whiteT]);
diff --git a/wled00/wled14_colors.ino b/wled00/wled14_colors.ino
index 533cccc6..6f882299 100644
--- a/wled00/wled14_colors.ino
+++ b/wled00/wled14_colors.ino
@@ -115,8 +115,6 @@ void colorRGBtoXY(byte* rgb, float* xy) //rgb to coordinates (https://www.develo
xy[1] = Y / (X + Y + Z);
}
-/*//For some reason min and max are not declared here
-
float minf (float v, float w)
{
if (w > v) return v;
@@ -129,11 +127,12 @@ float maxf (float v, float w)
return v;
}
-void colorRGBtoRGBW(byte* rgb, byte* wht) //rgb to rgbw, untested and currently unused
+void colorRGBtoRGBW(byte* rgb, byte* wht) //rgb to rgbw (http://codewelt.com/rgbw)
{
- *wht = (float)minf(rgb[0],minf(rgb[1],rgb[2]))*0.95;
- rgb[0]-=wht;
- rgb[1]-=wht;
- rgb[2]-=wht;
-}*/
+ float low = minf(rgb[0],minf(rgb[1],rgb[2]));
+ float high = maxf(rgb[0],maxf(rgb[1],rgb[2]));
+ if (high < 0.1f) return;
+ float sat = 255.0f * ((high - low) / high);
+ *wht = (byte)((255.0f - sat) / 255.0f * (rgb[0] + rgb[1] + rgb[2]) / 3);
+}