Skip to content

Commit 3d51d1e

Browse files
authored
Merge pull request wled#2175 from henrygab/revert_pr1902
Revert changes from PR1902
2 parents bd23942 + e26299b commit 3d51d1e

File tree

9 files changed

+4
-107
lines changed

9 files changed

+4
-107
lines changed

wled00/cfg.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -277,10 +277,6 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
277277
CJSON(arlsDisableGammaCorrection, if_live[F("no-gc")]); // false
278278
CJSON(arlsOffset, if_live[F("offset")]); // 0
279279

280-
CJSON(liveHSVCorrection, if_live[F("corr")]);
281-
CJSON(liveHSVSaturation, if_live[F("hsvsat")]);
282-
CJSON(liveHSVValue, if_live[F("hsvval")]);
283-
284280
CJSON(alexaEnabled, interfaces["va"][F("alexa")]); // false
285281

286282
CJSON(macroAlexaOn, interfaces["va"]["macros"][0]);
@@ -628,9 +624,6 @@ void serializeConfig() {
628624
if_live[F("maxbri")] = arlsForceMaxBri;
629625
if_live[F("no-gc")] = arlsDisableGammaCorrection;
630626
if_live[F("offset")] = arlsOffset;
631-
if_live[F("corr")] = liveHSVCorrection;
632-
if_live[F("hsvsat")] = liveHSVSaturation;
633-
if_live[F("hsvval")] = liveHSVValue;
634627

635628
JsonObject if_va = interfaces.createNestedObject("va");
636629
if_va[F("alexa")] = alexaEnabled;

wled00/colors.cpp

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -47,77 +47,6 @@ void relativeChangeWhite(int8_t amount, byte lowerBoundary)
4747
col[3] = new_val;
4848
}
4949

50-
void colorHSVtoRGB(float hue, float saturation, float value, byte& red, byte& green, byte& blue)
51-
{
52-
float r, g, b;
53-
54-
auto i = static_cast<int>(hue * 6);
55-
auto f = hue * 6 - i;
56-
auto p = value * (1 - saturation);
57-
auto q = value * (1 - f * saturation);
58-
auto t = value * (1 - (1 - f) * saturation);
59-
60-
switch (i % 6)
61-
{
62-
case 0: r = value, g = t, b = p;
63-
break;
64-
case 1: r = q, g = value, b = p;
65-
break;
66-
case 2: r = p, g = value, b = t;
67-
break;
68-
case 3: r = p, g = q, b = value;
69-
break;
70-
case 4: r = t, g = p, b = value;
71-
break;
72-
case 5: r = value, g = p, b = q;
73-
break;
74-
}
75-
76-
red = static_cast<uint8_t>(r * 255);
77-
green = static_cast<uint8_t>(g * 255);
78-
blue = static_cast<uint8_t>(b * 255);
79-
}
80-
81-
void colorRGBtoHSV(byte red, byte green, byte blue, float& hue, float& saturation, float& value)
82-
{
83-
auto rd = static_cast<float>(red) / 255;
84-
auto gd = static_cast<float>(green) / 255;
85-
auto bd = static_cast<float>(blue) / 255;
86-
auto max = std::max({ rd, gd, bd }), min = std::min({ rd, gd, bd });
87-
88-
value = max;
89-
90-
auto d = max - min;
91-
saturation = max == 0 ? 0 : d / max;
92-
93-
hue = 0;
94-
if (max != min)
95-
{
96-
if (max == rd) hue = (gd - bd) / d + (gd < bd ? 6 : 0);
97-
else if (max == gd) hue = (bd - rd) / d + 2;
98-
else if (max == bd) hue = (rd - gd) / d + 4;
99-
hue /= 6;
100-
}
101-
}
102-
103-
#define SATURATION_THRESHOLD 0.1
104-
#define MAX_HSV_VALUE 1
105-
#define MAX_HSV_SATURATION 1
106-
107-
//corrects the realtime colors. 10 is the unchanged saturation/value
108-
//this feature might cause slowdowns with large LED counts
109-
void correctColors(byte r, byte g, byte b, byte* rgb) {
110-
float hsv[3] = { 0,0,0 };
111-
colorRGBtoHSV(r, g,b , hsv[0], hsv[1], hsv[2]);
112-
float saturated = hsv[1] > SATURATION_THRESHOLD ?
113-
hsv[1] * ((float)liveHSVSaturation / 10) : hsv[1];
114-
float saturation = saturated < MAX_HSV_SATURATION ? saturated : MAX_HSV_SATURATION;
115-
116-
float valued = hsv[2] * ((float)liveHSVValue/10);
117-
float value = valued < MAX_HSV_VALUE ? valued : MAX_HSV_VALUE;
118-
colorHSVtoRGB(hsv[0], saturation, value, rgb[0], rgb[1], rgb[2]);
119-
}
120-
12150
void colorHStoRGB(uint16_t hue, byte sat, byte* rgb) //hue, sat to rgb
12251
{
12352
float h = ((float)hue)/65535.0;

wled00/data/settings_sync.htm

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,7 @@ <h3>Realtime</h3>
122122
Timeout: <input name="ET" type="number" min="1" max="65000" required> ms<br>
123123
Force max brightness: <input type="checkbox" name="FB"><br>
124124
Disable realtime gamma correction: <input type="checkbox" name="RG"><br>
125-
Realtime LED offset: <input name="WO" type="number" min="-255" max="255" required><br><br>
126-
Realtime HSV color correction: <input type="checkbox" name="HX"><br>
127-
Saturation (1-30): <input name="HS" type="number" min="1" max="30" value="1" step="1"><br>
128-
Value (1-60): <input name="HV" type="number" min="1" max="60" value="10" step="1">
125+
Realtime LED offset: <input name="WO" type="number" min="-255" max="255" required>
129126
<h3>Alexa Voice Assistant</h3>
130127
Emulate Alexa device: <input type="checkbox" name="AL"><br>
131128
Alexa invocation name: <input name="AI" maxlength="32">

wled00/fcn_declare.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@ void colorFromUint32(uint32_t in, bool secondary = false);
5858
void colorFromUint24(uint32_t in, bool secondary = false);
5959
uint32_t colorFromRgbw(byte* rgbw);
6060
void relativeChangeWhite(int8_t amount, byte lowerBoundary = 0);
61-
void colorHSVtoRGB(float hue, float saturation, float value, byte& red, byte& green, byte& blue);
62-
void colorRGBtoHSV(byte red, byte green, byte blue, float& hue, float& saturation, float& value);
63-
void correctColors(byte r, byte g, byte b, byte* rgb);
6461
void colorHStoRGB(uint16_t hue, byte sat, byte* rgb); //hue, sat to rgb
6562
void colorKtoRGB(uint16_t kelvin, byte* rgb);
6663
void colorCTtoRGB(uint16_t mired, byte* rgb); //white spectrum to rgb

wled00/html_settings.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -291,12 +291,9 @@ E1.31 info</a><br>Timeout: <input name="ET" type="number" min="1" max="65000"
291291
required> ms<br>Force max brightness: <input type="checkbox" name="FB"><br>
292292
Disable realtime gamma correction: <input type="checkbox" name="RG"><br>
293293
Realtime LED offset: <input name="WO" type="number" min="-255" max="255"
294-
required><br><br>Realtime HSV color correction: <input type="checkbox"
295-
name="HX"><br>Saturation (1-30): <input name="HS" type="number" min="1"
296-
max="30" value="1" step="1"><br>Value (1-60): <input name="HV" type="number"
297-
min="1" max="60" value="10" step="1"><h3>Alexa Voice Assistant</h3>
298-
Emulate Alexa device: <input type="checkbox" name="AL"><br>
299-
Alexa invocation name: <input name="AI" maxlength="32"><h3>Blynk</h3><b>
294+
required><h3>Alexa Voice Assistant</h3>Emulate Alexa device: <input
295+
type="checkbox" name="AL"><br>Alexa invocation name: <input name="AI"
296+
maxlength="32"><h3>Blynk</h3><b>
300297
Blynk, MQTT and Hue sync all connect to external hosts!<br>
301298
This may impact the responsiveness of the ESP8266.</b><br>
302299
For best results, only use one of these services at a time.<br>

wled00/set.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,6 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
227227
notifyMacro = request->hasArg(F("SM"));
228228
notifyTwice = request->hasArg(F("S2"));
229229

230-
liveHSVCorrection = request->hasArg(F("HX"));
231-
liveHSVSaturation = request->arg(F("HS")).toInt();
232-
liveHSVValue = request->arg(F("HV")).toInt();
233-
234230
nodeListEnabled = request->hasArg(F("NL"));
235231
if (!nodeListEnabled) Nodes.clear();
236232
nodeBroadcastEnabled = request->hasArg(F("NB"));

wled00/udp.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -434,11 +434,6 @@ void setRealtimePixel(uint16_t i, byte r, byte g, byte b, byte w)
434434
uint16_t pix = i + arlsOffset;
435435
if (pix < ledCount)
436436
{
437-
if (liveHSVCorrection) {
438-
byte correctedColors[3] = {0,0,0};
439-
correctColors(r, g, b, correctedColors);
440-
r = correctedColors[0]; g = correctedColors[1]; b = correctedColors[2];
441-
}
442437
if (!arlsDisableGammaCorrection && strip.gammaCorrectCol)
443438
{
444439
strip.setPixelColor(pix, strip.gamma8(r), strip.gamma8(g), strip.gamma8(b), strip.gamma8(w));

wled00/wled.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,6 @@ WLED_GLOBAL byte irEnabled _INIT(0); // Infrared receiver
299299
WLED_GLOBAL uint16_t udpPort _INIT(21324); // WLED notifier default port
300300
WLED_GLOBAL uint16_t udpPort2 _INIT(65506); // WLED notifier supplemental port
301301
WLED_GLOBAL uint16_t udpRgbPort _INIT(19446); // Hyperion port
302-
WLED_GLOBAL bool liveHSVCorrection _INIT(false);
303-
WLED_GLOBAL uint16_t liveHSVSaturation _INIT(13);
304-
WLED_GLOBAL uint16_t liveHSVValue _INIT(10);
305302

306303
WLED_GLOBAL uint8_t syncGroups _INIT(0x01); // sync groups this instance syncs (bit mapped)
307304
WLED_GLOBAL uint8_t receiveGroups _INIT(0x01); // sync receive groups this instance belongs to (bit mapped)

wled00/xml.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -400,10 +400,6 @@ void getSettingsJS(byte subPage, char* dest)
400400
sappend('v',SET_F("GS"),syncGroups);
401401
sappend('v',SET_F("GR"),receiveGroups);
402402

403-
sappend('c',SET_F("HX"),liveHSVCorrection);
404-
sappend('v',SET_F("HS"),liveHSVSaturation);
405-
sappend('v',SET_F("HV"),liveHSVValue);
406-
407403
sappend('c',SET_F("RB"),receiveNotificationBrightness);
408404
sappend('c',SET_F("RC"),receiveNotificationColor);
409405
sappend('c',SET_F("RX"),receiveNotificationEffects);

0 commit comments

Comments
 (0)