Merge branch 'master' into multi-button

This commit is contained in:
Blaž Kristan 2021-05-21 13:59:33 +02:00 committed by GitHub
commit 5f86a8a15b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 19 additions and 12 deletions

View File

@ -2,6 +2,13 @@
### Builds after release 0.12.0
#### Build 2105200
- Fixed WS281x output on ESP32
- Fixed potential out-of-bounds write in MQTT
- Fixed IR pin not changeable if IR disabled
- Fixed XML API <wv> containing -1 on Manual only RGBW mode (see #888, #1783)
#### Build 2105171
- Always copy MQTT payloads to prevent non-0-terminated strings

View File

@ -837,7 +837,7 @@ class PolyBus {
}
//gives back the internal type index (I_XX_XXX_X above) for the input
static uint8_t getI(uint8_t busType, uint8_t* pins, uint8_t num = 0, bool rgbwOverride = false) {
static uint8_t getI(uint8_t busType, uint8_t* pins, uint8_t num = 0) {
if (!IS_DIGITAL(busType)) return I_NONE;
if (IS_2PIN(busType)) { //SPI LED chips
bool isHSPI = false;
@ -863,7 +863,7 @@ class PolyBus {
switch (busType) {
case TYPE_WS2812_RGB:
case TYPE_WS2812_WWA:
return (rgbwOverride ? I_8266_U0_NEO_4 : I_8266_U0_NEO_3) + offset;
return I_8266_U0_NEO_3 + offset;
case TYPE_SK6812_RGBW:
return I_8266_U0_NEO_4 + offset;
case TYPE_WS2811_400KHZ:
@ -877,7 +877,7 @@ class PolyBus {
switch (busType) {
case TYPE_WS2812_RGB:
case TYPE_WS2812_WWA:
return (rgbwOverride ? I_32_R0_NEO_3 : I_32_R0_NEO_4) + offset;
return I_32_R0_NEO_3 + offset;
case TYPE_SK6812_RGBW:
return I_32_R0_NEO_4 + offset;
case TYPE_WS2811_400KHZ:

View File

@ -165,7 +165,6 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
}
CJSON(touchThreshold,hw[F("btn")][F("tt")]);
#ifndef WLED_DISABLE_INFRARED
int hw_ir_pin = hw["ir"]["pin"] | -2; // 4
if (hw_ir_pin > -2) {
if (pinManager.allocatePin(hw_ir_pin,false)) {
@ -174,7 +173,6 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
irPin = -1;
}
}
#endif
CJSON(irEnabled, hw["ir"]["type"]);
JsonObject relay = hw[F("relay")];
@ -555,7 +553,7 @@ void serializeConfig() {
JsonObject hw_ir = hw.createNestedObject("ir");
hw_ir["pin"] = irPin;
hw_ir["type"] = irEnabled; // the byte 'irEnabled' does contain the IR-Remote Type ( 0=disabled )
hw_ir[F("type")] = irEnabled; // the byte 'irEnabled' does contain the IR-Remote Type ( 0=disabled )
JsonObject hw_relay = hw.createNestedObject(F("relay"));
hw_relay["pin"] = rlyPin;

View File

@ -64,9 +64,9 @@ void onMqttMessage(char* topic, char* payload, AsyncMqttClientMessageProperties
}
//make a copy of the payload to 0-terminate it
char* payloadStr = new char[len+1];
if (payloadStr == nullptr) return; //no mem
strncpy(payloadStr, payload, len);
payloadStr[len] = '\0';
if (payloadStr == nullptr) return; //no mem
DEBUG_PRINTLN(payloadStr);
size_t topicPrefixLen = strlen(mqttDeviceTopic);

View File

@ -78,9 +78,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
int t = 0;
if (rlyPin>=0 && pinManager.isPinAllocated(rlyPin)) pinManager.deallocatePin(rlyPin);
#ifndef WLED_DISABLE_INFRARED
if (irPin>=0 && pinManager.isPinAllocated(irPin)) pinManager.deallocatePin(irPin);
#endif
for (uint8_t s=0; s<WLED_MAX_BUTTONS; s++)
if (btnPin[s]>=0 && pinManager.isPinAllocated(btnPin[s]))
pinManager.deallocatePin(btnPin[s]);

View File

@ -8,7 +8,7 @@
*/
// version code in format yymmddb (b = daily build)
#define VERSION 2105171
#define VERSION 2105200
//uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG
@ -224,7 +224,11 @@ WLED_GLOBAL bool rlyMde _INIT(true);
WLED_GLOBAL bool rlyMde _INIT(RLYMDE);
#endif
#ifndef IRPIN
WLED_GLOBAL int8_t irPin _INIT(-1);
#ifdef WLED_DISABLE_INFRARED
WLED_GLOBAL int8_t irPin _INIT(-1);
#else
WLED_GLOBAL int8_t irPin _INIT(4);
#endif
#else
WLED_GLOBAL int8_t irPin _INIT(IRPIN);
#endif

View File

@ -51,7 +51,7 @@ void XML_response(AsyncWebServerRequest *request, char* dest)
oappend(SET_F("</ix><fp>"));
oappendi(effectPalette);
oappend(SET_F("</fp><wv>"));
if (strip.rgbwMode) {
if (strip.isRgbw) {
oappendi(col[3]);
} else {
oappend("-1");