diff --git a/platformio.ini b/platformio.ini index cfb97dab0..ca3fc3aed 100644 --- a/platformio.ini +++ b/platformio.ini @@ -421,6 +421,13 @@ board_build.ldscript = ${common.ldscript_2m512k} build_flags = ${common.build_flags_esp8266} -D LEDPIN=3 -D BTNPIN=1 lib_deps = ${esp8266.lib_deps} +[env:sp511e] +board = esp_wroom_02 +platform = ${common.platform_wled_default} +board_build.ldscript = ${common.ldscript_2m512k} +build_flags = ${common.build_flags_esp8266} -D LEDPIN=3 -D BTNPIN=2 -D IRPIN=5 -D WLED_MAX_BUTTONS=3 +lib_deps = ${esp8266.lib_deps} + # ------------------------------------------------------------------------------ # travis test board configurations # ------------------------------------------------------------------------------ diff --git a/wled00/cfg.cpp b/wled00/cfg.cpp index 1aa64202e..ebdd01bdb 100644 --- a/wled00/cfg.cpp +++ b/wled00/cfg.cpp @@ -290,10 +290,6 @@ bool deserializeConfig(JsonObject doc, bool fromFS) { CJSON(arlsDisableGammaCorrection, if_live[F("no-gc")]); // false CJSON(arlsOffset, if_live[F("offset")]); // 0 - CJSON(liveHSVCorrection, if_live[F("corr")]); - CJSON(liveHSVSaturation, if_live[F("hsvsat")]); - CJSON(liveHSVValue, if_live[F("hsvval")]); - CJSON(alexaEnabled, interfaces["va"][F("alexa")]); // false CJSON(macroAlexaOn, interfaces["va"]["macros"][0]); @@ -662,9 +658,6 @@ void serializeConfig() { if_live[F("maxbri")] = arlsForceMaxBri; if_live[F("no-gc")] = arlsDisableGammaCorrection; if_live[F("offset")] = arlsOffset; - if_live[F("corr")] = liveHSVCorrection; - if_live[F("hsvsat")] = liveHSVSaturation; - if_live[F("hsvval")] = liveHSVValue; JsonObject if_va = interfaces.createNestedObject("va"); if_va[F("alexa")] = alexaEnabled; diff --git a/wled00/colors.cpp b/wled00/colors.cpp index 6c053b969..dfdd53e07 100644 --- a/wled00/colors.cpp +++ b/wled00/colors.cpp @@ -47,63 +47,6 @@ void relativeChangeWhite(int8_t amount, byte lowerBoundary) col[3] = new_val; } -void colorHSVtoRGB(float hue, float saturation, float value, byte& r, byte& g, byte& b) -{ - uint8_t i = hue * 6.0; - float f = hue * 6.0 - i; - value *= 255.0; - float p = value * (1.0 - saturation); - float q = value * (1.0 - f * saturation); - float t = value * (1.0 - (1.0 - f) * saturation); - - switch (i % 6) { - case 0: r = value, g = t, b = p; break; - case 1: r = q, g = value, b = p; break; - case 2: r = p, g = value, b = t; break; - case 3: r = p, g = q, b = value; break; - case 4: r = t, g = p, b = value; break; - case 5: r = value, g = p, b = q; break; - } -} - -void colorRGBtoHSV(byte red, byte green, byte blue, float& hue, float& saturation, float& value) -{ - float rd = red/255.0, gd = green/255.0, bd = blue/255.0; - float max = std::max({ rd, gd, bd }), min = std::min({ rd, gd, bd }); - - value = max; - - float d = max - min; - saturation = max == 0.0 ? 0.0 : d / max; - - hue = 0; - if (max != min) - { - if (max == rd) hue = (gd - bd) / d + (gd < bd ? 6.0 : 0.0); - else if (max == gd) hue = (bd - rd) / d + 2.0; - else if (max == bd) hue = (rd - gd) / d + 4.0; - hue /= 6.0; - } -} - -#define SATURATION_THRESHOLD 0.1 -#define MAX_HSV_VALUE 1 -#define MAX_HSV_SATURATION 1 - -//corrects the realtime colors. 10 is the unchanged saturation/value -//this feature might cause slowdowns with large LED counts -void correctColors(byte r, byte g, byte b, byte* rgb) { - float hsv[3] = { 0,0,0 }; - colorRGBtoHSV(r, g, b, hsv[0], hsv[1], hsv[2]); - float saturated = hsv[1] > SATURATION_THRESHOLD ? - hsv[1] * ((float)liveHSVSaturation / 10) : hsv[1]; - float saturation = saturated < MAX_HSV_SATURATION ? saturated : MAX_HSV_SATURATION; - - float valued = hsv[2] * ((float)liveHSVValue/10); - float value = valued < MAX_HSV_VALUE ? valued : MAX_HSV_VALUE; - colorHSVtoRGB(hsv[0], saturation, value, rgb[0], rgb[1], rgb[2]); -} - void colorHStoRGB(uint16_t hue, byte sat, byte* rgb) //hue, sat to rgb { float h = ((float)hue)/65535.0; diff --git a/wled00/data/settings_sync.htm b/wled00/data/settings_sync.htm index 52c55ae5b..edfa86328 100644 --- a/wled00/data/settings_sync.htm +++ b/wled00/data/settings_sync.htm @@ -125,10 +125,7 @@ DMX mode: Timeout: ms
Force max brightness:
Disable realtime gamma correction:
-Realtime LED offset:

-Realtime HSV color correction:
-Saturation (1-30):
-Value (1-60): +Realtime LED offset:

Alexa Voice Assistant

Emulate Alexa device:
Alexa invocation name: diff --git a/wled00/fcn_declare.h b/wled00/fcn_declare.h index 21c08c23b..06f80cfc8 100644 --- a/wled00/fcn_declare.h +++ b/wled00/fcn_declare.h @@ -60,9 +60,6 @@ void colorFromUint32(uint32_t in, bool secondary = false); void colorFromUint24(uint32_t in, bool secondary = false); uint32_t colorFromRgbw(byte* rgbw); void relativeChangeWhite(int8_t amount, byte lowerBoundary = 0); -void colorHSVtoRGB(float hue, float saturation, float value, byte& red, byte& green, byte& blue); -void colorRGBtoHSV(byte red, byte green, byte blue, float& hue, float& saturation, float& value); -void correctColors(byte r, byte g, byte b, byte* rgb); void colorHStoRGB(uint16_t hue, byte sat, byte* rgb); //hue, sat to rgb void colorKtoRGB(uint16_t kelvin, byte* rgb); void colorCTtoRGB(uint16_t mired, byte* rgb); //white spectrum to rgb diff --git a/wled00/html_settings.h b/wled00/html_settings.h index 73c59be3e..322a6c4d9 100644 --- a/wled00/html_settings.h +++ b/wled00/html_settings.h @@ -293,12 +293,9 @@ E1.31 info
Timeout: ms
Force max brightness:
Disable realtime gamma correction:
Realtime LED offset:

Realtime HSV color correction:
Saturation (1-30):
Value (1-60):

Alexa Voice Assistant

-Emulate Alexa device:
-Alexa invocation name:

Blynk

+required>

Alexa Voice Assistant

Emulate Alexa device:
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.
diff --git a/wled00/ir.cpp b/wled00/ir.cpp index b39964e99..c7dc71467 100644 --- a/wled00/ir.cpp +++ b/wled00/ir.cpp @@ -573,66 +573,65 @@ void decodeIRJson(uint32_t code) char objKey[10]; String cmdStr; DynamicJsonDocument irDoc(JSON_BUFFER_SIZE); - JsonObject fdo = irDoc.createNestedObject("cmd"); + JsonObject fdo; + JsonObject jsonCmdObj; - lastValidCode = 0; sprintf_P(objKey, PSTR("\"0x%lX\":"), (unsigned long)code); // attempt to read command from ir.json // this may fail for two reasons: ir.json does not exist or IR code not found // if the IR code is not found readObjectFromFile() will clean() irDoc JSON document // so we can differentiate between the two - errorFlag = readObjectFromFile("/ir.json", objKey, &irDoc) ? ERR_NONE : ERR_FS_IRLOAD; - if (irDoc["cmd"].isNull()) { - errorFlag = ERR_NONE; + readObjectFromFile("/ir.json", objKey, &irDoc); + fdo = irDoc.as(); + lastValidCode = 0; + if (fdo.isNull()) { + //the received code does not exist + if (!WLED_FS.exists("/ir.json")) errorFlag = ERR_FS_IRLOAD; //warn if IR file itself doesn't exist return; } - if (!errorFlag) { - fdo = irDoc.as(); + cmdStr = fdo["cmd"].as();; + jsonCmdObj = fdo["cmd"]; //object - JsonObject jsonCmdObj = fdo["cmd"]; - cmdStr = fdo["cmd"].as(); - - if (!cmdStr.isEmpty()) { - - if (cmdStr.startsWith("!")) { - // call limited set of C functions - if (cmdStr.startsWith(F("!incBri"))) { - lastValidCode = code; - incBrightness(); - } else if (cmdStr.startsWith(F("!decBri"))) { - lastValidCode = code; - decBrightness(); - } else if (cmdStr.startsWith(F("!presetF"))) { //!presetFallback - uint8_t p1 = fdo["PL"] ? fdo["PL"] : 1; - uint8_t p2 = fdo["FX"] ? fdo["FX"] : random8(MODE_COUNT); - uint8_t p3 = fdo["FP"] ? fdo["FP"] : 0; - presetFallback(p1, p2, p3); - } - } else { - // HTTP API command - if (cmdStr.indexOf("~") || fdo[F("rpt")]) - { - // repeatable action - lastValidCode = code; - } - if (effectCurrent == 0 && cmdStr.indexOf("FP=") > -1) { - // setting palette but it wont show because effect is solid - effectCurrent = FX_MODE_GRADIENT; - } - if (!cmdStr.startsWith("win&")) { - cmdStr = "win&" + cmdStr; - } - handleSet(nullptr, cmdStr, false); - } - } else if (!jsonCmdObj.isNull()) { - // command is JSON object - //allow applyPreset() to reuse JSON buffer, or it would alloc. a second buffer and run out of mem. - fileDoc = &irDoc; - deserializeState(jsonCmdObj, CALL_MODE_BUTTON); - fileDoc = nullptr; + if (!cmdStr.isEmpty()) + { + if (cmdStr.startsWith("!")) { + // call limited set of C functions + if (cmdStr.startsWith(F("!incBri"))) { + lastValidCode = code; + incBrightness(); + } else if (cmdStr.startsWith(F("!decBri"))) { + lastValidCode = code; + decBrightness(); + } else if (cmdStr.startsWith(F("!presetF"))) { //!presetFallback + uint8_t p1 = fdo["PL"] ? fdo["PL"] : 1; + uint8_t p2 = fdo["FX"] ? fdo["FX"] : random8(MODE_COUNT); + uint8_t p3 = fdo["FP"] ? fdo["FP"] : 0; + presetFallback(p1, p2, p3); + } + } else { + // HTTP API command + if (cmdStr.indexOf("~") || fdo["rpt"]) + { + // repeatable action + lastValidCode = code; + } + if (effectCurrent == 0 && cmdStr.indexOf("FP=") > -1) { + // setting palette but it wont show because effect is solid + effectCurrent = FX_MODE_GRADIENT; + } + if (!cmdStr.startsWith("win&")) { + cmdStr = "win&" + cmdStr; + } + handleSet(nullptr, cmdStr, false); } + } else if (!jsonCmdObj.isNull()) { + // command is JSON object + //allow applyPreset() to reuse JSON buffer, or it would alloc. a second buffer and run out of mem. + fileDoc = &irDoc; + deserializeState(jsonCmdObj, CALL_MODE_BUTTON); + fileDoc = nullptr; } } diff --git a/wled00/set.cpp b/wled00/set.cpp index 14f754a24..adc137038 100644 --- a/wled00/set.cpp +++ b/wled00/set.cpp @@ -233,10 +233,6 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage) notifyMacro = request->hasArg(F("SM")); notifyTwice = request->hasArg(F("S2")); - liveHSVCorrection = request->hasArg(F("HX")); - liveHSVSaturation = request->arg(F("HS")).toInt(); - liveHSVValue = request->arg(F("HV")).toInt(); - nodeListEnabled = request->hasArg(F("NL")); if (!nodeListEnabled) Nodes.clear(); nodeBroadcastEnabled = request->hasArg(F("NB")); diff --git a/wled00/udp.cpp b/wled00/udp.cpp index c0af11ceb..e006abd41 100644 --- a/wled00/udp.cpp +++ b/wled00/udp.cpp @@ -438,11 +438,6 @@ void setRealtimePixel(uint16_t i, byte r, byte g, byte b, byte w) uint16_t pix = i + arlsOffset; if (pix < ledCount) { - if (liveHSVCorrection) { - byte correctedColors[3] = {0,0,0}; - correctColors(r, g, b, correctedColors); - r = correctedColors[0]; g = correctedColors[1]; b = correctedColors[2]; - } if (!arlsDisableGammaCorrection && strip.gammaCorrectCol) { strip.setPixelColor(pix, strip.gamma8(r), strip.gamma8(g), strip.gamma8(b), strip.gamma8(w)); diff --git a/wled00/wled.h b/wled00/wled.h index a920f4d77..c319357b6 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2109181 +#define VERSION 2109182 //uncomment this if you have a "my_config.h" file you'd like to use //#define WLED_USE_MY_CONFIG @@ -302,9 +302,6 @@ WLED_GLOBAL byte irEnabled _INIT(0); // Infrared receiver WLED_GLOBAL uint16_t udpPort _INIT(21324); // WLED notifier default port WLED_GLOBAL uint16_t udpPort2 _INIT(65506); // WLED notifier supplemental port WLED_GLOBAL uint16_t udpRgbPort _INIT(19446); // Hyperion port -WLED_GLOBAL bool liveHSVCorrection _INIT(false); -WLED_GLOBAL uint16_t liveHSVSaturation _INIT(13); -WLED_GLOBAL uint16_t liveHSVValue _INIT(10); WLED_GLOBAL uint8_t syncGroups _INIT(0x01); // sync groups this instance syncs (bit mapped) WLED_GLOBAL uint8_t receiveGroups _INIT(0x01); // sync receive groups this instance belongs to (bit mapped) diff --git a/wled00/xml.cpp b/wled00/xml.cpp index 924a8d8c1..e16d1cbfd 100644 --- a/wled00/xml.cpp +++ b/wled00/xml.cpp @@ -425,10 +425,6 @@ void getSettingsJS(byte subPage, char* dest) sappend('v',SET_F("GS"),syncGroups); sappend('v',SET_F("GR"),receiveGroups); - sappend('c',SET_F("HX"),liveHSVCorrection); - sappend('v',SET_F("HS"),liveHSVSaturation); - sappend('v',SET_F("HV"),liveHSVValue); - sappend('c',SET_F("RB"),receiveNotificationBrightness); sappend('c',SET_F("RC"),receiveNotificationColor); sappend('c',SET_F("RX"),receiveNotificationEffects);