Merge branch 'master' into dev

Excluded modifications to ir.cpp
Changed default segment creation logic.
This commit is contained in:
Blaz Kristan 2021-09-12 01:00:54 +02:00
commit d4beb2f79b
13 changed files with 71 additions and 38 deletions

View File

@ -2,6 +2,13 @@
### Builds after release 0.12.0 ### Builds after release 0.12.0
#### Build 2109100
- Added an auto create segments per bus setting
- Added 15 new palettes from SR branch (PR #2134)
- Fixed segment runtime not reset on FX change via HTTP API
- Changed AsyncTCP dependency to pbolduc fork v1.2.0
#### Build 2108250 #### Build 2108250
- Added Sync groups (PR #2150) - Added Sync groups (PR #2150)

View File

@ -205,11 +205,12 @@ lib_deps =
build_flags = -g build_flags = -g
-DARDUINO_ARCH_ESP32 -DARDUINO_ARCH_ESP32
-DCONFIG_LITTLEFS_FOR_IDF_3_2 -DCONFIG_LITTLEFS_FOR_IDF_3_2
-D CONFIG_ASYNC_TCP_USE_WDT=0
lib_deps = lib_deps =
${env.lib_deps} ${env.lib_deps}
makuna/NeoPixelBus @ 2.6.7 makuna/NeoPixelBus @ 2.6.7
AsyncTCP @ 1.0.3 https://github.com/pbolduc/AsyncTCP.git @ 1.2.0
[esp32s2] [esp32s2]
build_flags = -g build_flags = -g
@ -217,11 +218,13 @@ build_flags = -g
-DCONFIG_LITTLEFS_FOR_IDF_3_2 -DCONFIG_LITTLEFS_FOR_IDF_3_2
-DARDUINO_ARCH_ESP32S2 -DARDUINO_ARCH_ESP32S2
-DCONFIG_IDF_TARGET_ESP32S2 -DCONFIG_IDF_TARGET_ESP32S2
-D CONFIG_ASYNC_TCP_USE_WDT=0
-DCO
lib_deps = lib_deps =
${env.lib_deps} ${env.lib_deps}
makuna/NeoPixelBus @ 2.6.7 makuna/NeoPixelBus @ 2.6.7
AsyncTCP @ 1.0.3 https://github.com/pbolduc/AsyncTCP.git @ 1.2.0
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# WLED BUILDS # WLED BUILDS

View File

@ -4,7 +4,7 @@
<a href="https://raw.githubusercontent.com/Aircoookie/WLED/master/LICENSE"><img src="https://img.shields.io/github/license/Aircoookie/wled?color=blue&style=flat-square"></a> <a href="https://raw.githubusercontent.com/Aircoookie/WLED/master/LICENSE"><img src="https://img.shields.io/github/license/Aircoookie/wled?color=blue&style=flat-square"></a>
<a href="https://wled.discourse.group"><img src="https://img.shields.io/discourse/topics?colorB=blue&label=forum&server=https%3A%2F%2Fwled.discourse.group%2F&style=flat-square"></a> <a href="https://wled.discourse.group"><img src="https://img.shields.io/discourse/topics?colorB=blue&label=forum&server=https%3A%2F%2Fwled.discourse.group%2F&style=flat-square"></a>
<a href="https://discord.gg/KuqP7NE"><img src="https://img.shields.io/discord/473448917040758787.svg?colorB=blue&label=discord&style=flat-square"></a> <a href="https://discord.gg/KuqP7NE"><img src="https://img.shields.io/discord/473448917040758787.svg?colorB=blue&label=discord&style=flat-square"></a>
<a href="https://github.com/Aircoookie/WLED/wiki"><img src="https://img.shields.io/badge/quick_start-wiki-blue.svg?style=flat-square"></a> <a href="https://kno.wled.ge"><img src="https://img.shields.io/badge/quick_start-wiki-blue.svg?style=flat-square"></a>
<a href="https://github.com/Aircoookie/WLED-App"><img src="https://img.shields.io/badge/app-wled-blue.svg?style=flat-square"></a> <a href="https://github.com/Aircoookie/WLED-App"><img src="https://img.shields.io/badge/app-wled-blue.svg?style=flat-square"></a>
<a href="https://gitpod.io/#https://github.com/Aircoookie/WLED"><img src="https://img.shields.io/badge/Gitpod-ready--to--code-blue?style=flat-square&logo=gitpod"></a> <a href="https://gitpod.io/#https://github.com/Aircoookie/WLED"><img src="https://img.shields.io/badge/Gitpod-ready--to--code-blue?style=flat-square&logo=gitpod"></a>

View File

@ -100,12 +100,9 @@ void WS2812FX::finalizeInit(void)
isOffRefreshRequred |= BusManager::isOffRefreshRequred(bus->getType()); isOffRefreshRequred |= BusManager::isOffRefreshRequred(bus->getType());
_length += bus->getLength(); _length += bus->getLength();
} }
ledCount = _length; // or we can use busses.getTotalLength() ledCount = _length;
/*
//make segment 0 cover the entire strip // We will create default segments im populateDefaultSegments()
_segments[0].start = 0;
_segments[0].stop = _length;
*/
setBrightness(_brightness); setBrightness(_brightness);
@ -626,6 +623,7 @@ void WS2812FX::resetSegments() {
void WS2812FX::populateDefaultSegments() { void WS2812FX::populateDefaultSegments() {
uint16_t length = 0; uint16_t length = 0;
if (autoSegments) {
for (uint8_t i=0; i<busses.getNumBusses(); i++) { for (uint8_t i=0; i<busses.getNumBusses(); i++) {
Bus *bus = busses.getBus(i); Bus *bus = busses.getBus(i);
if (bus == nullptr) continue; if (bus == nullptr) continue;
@ -641,6 +639,18 @@ void WS2812FX::populateDefaultSegments() {
_segments[i].setOption(SEG_OPTION_ON, 1); _segments[i].setOption(SEG_OPTION_ON, 1);
_segments[i].opacity = 255; _segments[i].opacity = 255;
} }
} else {
_segments[0].start = 0;
_segments[0].stop = _length;
_segments[0].mode = DEFAULT_MODE;
_segments[0].colors[0] = DEFAULT_COLOR;
_segments[0].speed = DEFAULT_SPEED;
_segments[0].intensity = DEFAULT_INTENSITY;
_segments[0].grouping = 1;
_segments[0].setOption(SEG_OPTION_SELECTED, 1);
_segments[0].setOption(SEG_OPTION_ON, 1);
_segments[0].opacity = 255;
}
} }
//After this function is called, setPixelColor() will use that segment (offsets, grouping, ... will apply) //After this function is called, setPixelColor() will use that segment (offsets, grouping, ... will apply)

View File

@ -215,6 +215,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
JsonObject light = doc[F("light")]; JsonObject light = doc[F("light")];
CJSON(briMultiplier, light[F("scale-bri")]); CJSON(briMultiplier, light[F("scale-bri")]);
CJSON(strip.paletteBlend, light[F("pal-mode")]); CJSON(strip.paletteBlend, light[F("pal-mode")]);
CJSON(autoSegments, light[F("aseg")]);
float light_gc_bri = light["gc"]["bri"]; float light_gc_bri = light["gc"]["bri"];
float light_gc_col = light["gc"]["col"]; // 2.8 float light_gc_col = light["gc"]["col"]; // 2.8
@ -599,6 +600,7 @@ void serializeConfig() {
JsonObject light = doc.createNestedObject(F("light")); JsonObject light = doc.createNestedObject(F("light"));
light[F("scale-bri")] = briMultiplier; light[F("scale-bri")] = briMultiplier;
light[F("pal-mode")] = strip.paletteBlend; light[F("pal-mode")] = strip.paletteBlend;
light[F("aseg")] = autoSegments;
JsonObject light_gc = light.createNestedObject("gc"); JsonObject light_gc = light.createNestedObject("gc");
light_gc["bri"] = (strip.gammaCorrectBri) ? 2.8 : 1.0; light_gc["bri"] = (strip.gammaCorrectBri) ? 2.8 : 1.0;

View File

@ -215,7 +215,7 @@
#define ERR_FS_BEGIN 10 // Could not init filesystem (no partition?) #define ERR_FS_BEGIN 10 // Could not init filesystem (no partition?)
#define ERR_FS_QUOTA 11 // The FS is full or the maximum file size is reached #define ERR_FS_QUOTA 11 // The FS is full or the maximum file size is reached
#define ERR_FS_PLOAD 12 // It was attempted to load a preset that does not exist #define ERR_FS_PLOAD 12 // It was attempted to load a preset that does not exist
#define ERR_FS_IRLOAD 13 // Loading of ir.json failed #define ERR_FS_IRLOAD 13 // It was attempted to load an IR JSON cmd, but the "ir.json" file does not exist
#define ERR_FS_GENERAL 19 // A general unspecified filesystem error occured #define ERR_FS_GENERAL 19 // A general unspecified filesystem error occured
#define ERR_OVERTEMP 30 // An attached temperature sensor has measured above threshold temperature (not implemented) #define ERR_OVERTEMP 30 // An attached temperature sensor has measured above threshold temperature (not implemented)
#define ERR_OVERCURRENT 31 // An attached current sensor has measured a current above the threshold (not implemented) #define ERR_OVERCURRENT 31 // An attached current sensor has measured a current above the threshold (not implemented)

View File

@ -389,7 +389,9 @@ Reverse (rotated 180°): <input type="checkbox" name="CV${i}">
<div id="ledwarning" style="color: orange; display: none;"> <div id="ledwarning" style="color: orange; display: none;">
&#9888; You might run into stability or lag issues.<br> &#9888; You might run into stability or lag issues.<br>
Use less than <span id="wreason">800 LEDs per pin</span> for the best experience!<br> Use less than <span id="wreason">800 LEDs per pin</span> for the best experience!<br>
</div><hr style="width:260px"> </div>
Make a segment for each output: <input type="checkbox" name="MS"> <br>
<hr style="width:260px">
<div id="btns"></div> <div id="btns"></div>
Touch threshold: <input type="number" min="0" max="100" name="TT" required><br> Touch threshold: <input type="number" min="0" max="100" name="TT" required><br>
IR GPIO: <input type="number" min="-1" max="40" name="IR" onchange="UI()" class="s"><select name="IT" onchange="UI()"> IR GPIO: <input type="number" min="-1" max="40" name="IR" onchange="UI()" class="s"><select name="IT" onchange="UI()">

View File

@ -112,7 +112,8 @@ onclick="addLEDs(-1)">-</button><br>LED Memory Usage: <span id="m0">0</span> /
style="display:inline-block;width:100px;height:10px;border-radius:20px"></div> style="display:inline-block;width:100px;height:10px;border-radius:20px"></div>
<br><div id="ledwarning" style="color:orange;display:none"> <br><div id="ledwarning" style="color:orange;display:none">
&#9888; You might run into stability or lag issues.<br>Use less than <span &#9888; You might run into stability or lag issues.<br>Use less than <span
id="wreason">800 LEDs per pin</span> for the best experience!<br></div><hr id="wreason">800 LEDs per pin</span> for the best experience!<br></div>
Make a segment for each output: <input type="checkbox" name="MS"><br><hr
style="width:260px"><div id="btns"></div>Touch threshold: <input type="number" style="width:260px"><div id="btns"></div>Touch threshold: <input type="number"
min="0" max="100" name="TT" required><br>IR GPIO: <input type="number" min="-1" min="0" max="100" name="TT" required><br>IR GPIO: <input type="number" min="-1"
max="40" name="IR" onchange="UI()" class="s"><select name="IT" onchange="UI()"> max="40" name="IR" onchange="UI()" class="s"><select name="IT" onchange="UI()">

View File

@ -119,7 +119,7 @@ void onHueData(void* arg, AsyncClient* client, void *data, size_t len)
const char* apikey = root[0][F("success")][F("username")]; const char* apikey = root[0][F("success")][F("username")];
if (apikey != nullptr && strlen(apikey) < sizeof(hueApiKey)) if (apikey != nullptr && strlen(apikey) < sizeof(hueApiKey))
{ {
strcpy(hueApiKey, apikey); strlcpy(hueApiKey, apikey, sizeof(hueApiKey));
hueAuthRequired = false; hueAuthRequired = false;
hueNewKey = true; hueNewKey = true;
} }

View File

@ -26,21 +26,21 @@ void onMqttConnect(bool sessionPresent)
char subuf[38]; char subuf[38];
if (mqttDeviceTopic[0] != 0) { if (mqttDeviceTopic[0] != 0) {
strcpy(subuf, mqttDeviceTopic); strlcpy(subuf, mqttDeviceTopic, 33);
mqtt->subscribe(subuf, 0); mqtt->subscribe(subuf, 0);
strcat_P(subuf, PSTR("/col")); strcat_P(subuf, PSTR("/col"));
mqtt->subscribe(subuf, 0); mqtt->subscribe(subuf, 0);
strcpy(subuf, mqttDeviceTopic); strlcpy(subuf, mqttDeviceTopic, 33);
strcat_P(subuf, PSTR("/api")); strcat_P(subuf, PSTR("/api"));
mqtt->subscribe(subuf, 0); mqtt->subscribe(subuf, 0);
} }
if (mqttGroupTopic[0] != 0) { if (mqttGroupTopic[0] != 0) {
strcpy(subuf, mqttGroupTopic); strlcpy(subuf, mqttGroupTopic, 33);
mqtt->subscribe(subuf, 0); mqtt->subscribe(subuf, 0);
strcat_P(subuf, PSTR("/col")); strcat_P(subuf, PSTR("/col"));
mqtt->subscribe(subuf, 0); mqtt->subscribe(subuf, 0);
strcpy(subuf, mqttGroupTopic); strlcpy(subuf, mqttGroupTopic, 33);
strcat_P(subuf, PSTR("/api")); strcat_P(subuf, PSTR("/api"));
mqtt->subscribe(subuf, 0); mqtt->subscribe(subuf, 0);
} }
@ -122,22 +122,22 @@ void publishMqtt()
char subuf[38]; char subuf[38];
sprintf_P(s, PSTR("%u"), bri); sprintf_P(s, PSTR("%u"), bri);
strcpy(subuf, mqttDeviceTopic); strlcpy(subuf, mqttDeviceTopic, 33);
strcat_P(subuf, PSTR("/g")); strcat_P(subuf, PSTR("/g"));
mqtt->publish(subuf, 0, true, s); // retain message mqtt->publish(subuf, 0, true, s); // retain message
sprintf_P(s, PSTR("#%06X"), (col[3] << 24) | (col[0] << 16) | (col[1] << 8) | (col[2])); sprintf_P(s, PSTR("#%06X"), (col[3] << 24) | (col[0] << 16) | (col[1] << 8) | (col[2]));
strcpy(subuf, mqttDeviceTopic); strlcpy(subuf, mqttDeviceTopic, 33);
strcat_P(subuf, PSTR("/c")); strcat_P(subuf, PSTR("/c"));
mqtt->publish(subuf, 0, true, s); // retain message mqtt->publish(subuf, 0, true, s); // retain message
strcpy(subuf, mqttDeviceTopic); strlcpy(subuf, mqttDeviceTopic, 33);
strcat_P(subuf, PSTR("/status")); strcat_P(subuf, PSTR("/status"));
mqtt->publish(subuf, 0, true, "online"); // retain message for a LWT mqtt->publish(subuf, 0, true, "online"); // retain message for a LWT
char apires[1024]; // allocating 1024 bytes from stack can be risky char apires[1024]; // allocating 1024 bytes from stack can be risky
XML_response(nullptr, apires); XML_response(nullptr, apires);
strcpy(subuf, mqttDeviceTopic); strlcpy(subuf, mqttDeviceTopic, 33);
strcat_P(subuf, PSTR("/v")); strcat_P(subuf, PSTR("/v"));
mqtt->publish(subuf, 0, false, apires); // do not retain message mqtt->publish(subuf, 0, false, apires); // do not retain message
} }
@ -167,7 +167,7 @@ bool initMqtt()
mqtt->setClientId(mqttClientID); mqtt->setClientId(mqttClientID);
if (mqttUser[0] && mqttPass[0]) mqtt->setCredentials(mqttUser, mqttPass); if (mqttUser[0] && mqttPass[0]) mqtt->setCredentials(mqttUser, mqttPass);
strcpy(mqttStatusTopic, mqttDeviceTopic); strlcpy(mqttStatusTopic, mqttDeviceTopic, 33);
strcat_P(mqttStatusTopic, PSTR("/status")); strcat_P(mqttStatusTopic, PSTR("/status"));
mqtt->setWill(mqttStatusTopic, 0, true, "offline"); // LWT message mqtt->setWill(mqttStatusTopic, 0, true, "offline"); // LWT message
mqtt->setKeepAlive(MQTT_KEEP_ALIVE_TIME); mqtt->setKeepAlive(MQTT_KEEP_ALIVE_TIME);

View File

@ -94,6 +94,8 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
uint16_t length, start; uint16_t length, start;
uint8_t pins[5] = {255, 255, 255, 255, 255}; uint8_t pins[5] = {255, 255, 255, 255, 255};
autoSegments = request->hasArg(F("MS"));
for (uint8_t s = 0; s < WLED_MAX_BUSSES; s++) { for (uint8_t s = 0; s < WLED_MAX_BUSSES; s++) {
char lp[4] = "L0"; lp[2] = 48+s; lp[3] = 0; //ascii 0-9 //strip data pin char lp[4] = "L0"; lp[2] = 48+s; lp[3] = 0; //ascii 0-9 //strip data pin
char lc[4] = "LC"; lc[2] = 48+s; lc[3] = 0; //strip length char lc[4] = "LC"; lc[2] = 48+s; lc[3] = 0; //strip length
@ -333,7 +335,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
analogClockSecondsTrail = request->hasArg(F("OS")); analogClockSecondsTrail = request->hasArg(F("OS"));
#ifndef WLED_DISABLE_CRONIXIE #ifndef WLED_DISABLE_CRONIXIE
strcpy(cronixieDisplay,request->arg(F("CX")).c_str()); strlcpy(cronixieDisplay,request->arg(F("CX")).c_str(),7);
cronixieBacklight = request->hasArg(F("CB")); cronixieBacklight = request->hasArg(F("CB"));
#endif #endif
countdownMode = request->hasArg(F("CE")); countdownMode = request->hasArg(F("CE"));

View File

@ -8,7 +8,7 @@
*/ */
// version code in format yymmddb (b = daily build) // version code in format yymmddb (b = daily build)
#define VERSION 2109111 #define VERSION 2109112
//uncomment this if you have a "my_config.h" file you'd like to use //uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG //#define WLED_USE_MY_CONFIG
@ -268,6 +268,11 @@ WLED_GLOBAL uint16_t ledCount _INIT(0); // overcurrent prevented by AB
WLED_GLOBAL bool turnOnAtBoot _INIT(true); // turn on LEDs at power-up WLED_GLOBAL bool turnOnAtBoot _INIT(true); // turn on LEDs at power-up
WLED_GLOBAL byte bootPreset _INIT(0); // save preset to load after power-up WLED_GLOBAL byte bootPreset _INIT(0); // save preset to load after power-up
//if true, a segment per bus will be created on boot and LED settings save
//if false, only one segment spanning the total LEDs is created,
//but not on LED settings save if there is more than one segment currently
WLED_GLOBAL bool autoSegments _INIT(false);
WLED_GLOBAL byte col[] _INIT_N(({ 255, 160, 0, 0 })); // current RGB(W) primary color. col[] should be updated if you want to change the color. WLED_GLOBAL byte col[] _INIT_N(({ 255, 160, 0, 0 })); // current RGB(W) primary color. col[] should be updated if you want to change the color.
WLED_GLOBAL byte colSec[] _INIT_N(({ 0, 0, 0, 0 })); // current RGB(W) secondary color WLED_GLOBAL byte colSec[] _INIT_N(({ 0, 0, 0, 0 })); // current RGB(W) secondary color
WLED_GLOBAL byte briS _INIT(128); // default brightness WLED_GLOBAL byte briS _INIT(128); // default brightness

View File

@ -344,6 +344,7 @@ void getSettingsJS(byte subPage, char* dest)
oappend(SET_F(");")); oappend(SET_F(");"));
sappend('v',SET_F("LC"),ledCount); sappend('v',SET_F("LC"),ledCount);
sappend('c',SET_F("MS"),autoSegments);
for (uint8_t s=0; s < busses.getNumBusses(); s++) { for (uint8_t s=0; s < busses.getNumBusses(); s++) {
Bus* bus = busses.getBus(s); Bus* bus = busses.getBus(s);