Fixed relay mode inverted when upgrading from 0.11.0

This commit is contained in:
cschwinne 2021-03-04 12:10:18 +01:00
parent 195af002cf
commit c0dd98b6d7
4 changed files with 32 additions and 13 deletions

View File

@ -2,6 +2,20 @@
### Development versions after 0.11.1 release ### Development versions after 0.11.1 release
#### Build 2103040
- Fixed relay mode inverted when upgrading from 0.11.0
- Fixed no more than 2 pins per bus configurable in UI
- Changed to non-linear IR brightness steps (PR #1742)
- Fixed various warnings (PR #1744)
- Added UDP DNRGBW Mode (PR #1704)
- Added dynamic LED mapping with ledmap.json file (PR #1738)
- Added support for QuinLED-ESP32-Ethernet board
- Added support for WESP32 ethernet board (PR #1764)
- Added Caching for main UI (PR #1704)
- Added Tetrix mode (PR #1729)
- Added memory check on Bus creation
#### Build 2102050 #### Build 2102050
- Version bump to 0.12.0-a0 "Hikari" - Version bump to 0.12.0-a0 "Hikari"

View File

@ -30,8 +30,8 @@ void deserializeConfig() {
return; return;
} }
//int rev_major = doc[F("rev")][0]; // 1 //int rev_major = doc["rev"][0]; // 1
//int rev_minor = doc[F("rev")][1]; // 0 //int rev_minor = doc["rev"][1]; // 0
//long vid = doc[F("vid")]; // 2010020 //long vid = doc[F("vid")]; // 2010020
@ -95,7 +95,7 @@ void deserializeConfig() {
CJSON(strip.ablMilliampsMax, hw_led[F("maxpwr")]); CJSON(strip.ablMilliampsMax, hw_led[F("maxpwr")]);
CJSON(strip.milliampsPerLed, hw_led[F("ledma")]); CJSON(strip.milliampsPerLed, hw_led[F("ledma")]);
CJSON(strip.reverseMode, hw_led[F("rev")]); CJSON(strip.reverseMode, hw_led["rev"]);
CJSON(strip.rgbwMode, hw_led[F("rgbwm")]); CJSON(strip.rgbwMode, hw_led[F("rgbwm")]);
JsonArray ins = hw_led["ins"]; JsonArray ins = hw_led["ins"];
@ -126,7 +126,7 @@ void deserializeConfig() {
//limit length of strip if it would exceed total configured LEDs //limit length of strip if it would exceed total configured LEDs
if (start + length > ledCount) length = ledCount - start; if (start + length > ledCount) length = ledCount - start;
uint8_t ledType = elm[F("type")] | TYPE_WS2812_RGB; uint8_t ledType = elm[F("type")] | TYPE_WS2812_RGB;
bool reversed = elm[F("rev")]; bool reversed = elm["rev"];
//RGBW mode is enabled if at least one of the strips is RGBW //RGBW mode is enabled if at least one of the strips is RGBW
useRGBW = (useRGBW || BusManager::isRgbw(ledType)); useRGBW = (useRGBW || BusManager::isRgbw(ledType));
s++; s++;
@ -163,14 +163,18 @@ void deserializeConfig() {
#endif #endif
CJSON(irEnabled, hw[F("ir")][F("type")]); CJSON(irEnabled, hw[F("ir")][F("type")]);
int hw_relay_pin = hw[F("relay")][F("pin")]; JsonObject relay = hw[F("relay")];
int hw_relay_pin = relay[F("pin")];
if (pinManager.allocatePin(hw_relay_pin,true)) { if (pinManager.allocatePin(hw_relay_pin,true)) {
rlyPin = hw_relay_pin; rlyPin = hw_relay_pin;
pinMode(rlyPin, OUTPUT); pinMode(rlyPin, OUTPUT);
} else { } else {
rlyPin = -1; rlyPin = -1;
} }
CJSON(rlyMde, hw[F("relay")][F("rev")]); if (relay.containsKey("rev")) {
rlyMde = !relay["rev"];
}
//int hw_status_pin = hw[F("status")][F("pin")]; // -1 //int hw_status_pin = hw[F("status")][F("pin")]; // -1
@ -443,7 +447,7 @@ void serializeConfig() {
hw_led[F("total")] = ledCount; hw_led[F("total")] = ledCount;
hw_led[F("maxpwr")] = strip.ablMilliampsMax; hw_led[F("maxpwr")] = strip.ablMilliampsMax;
hw_led[F("ledma")] = strip.milliampsPerLed; hw_led[F("ledma")] = strip.milliampsPerLed;
hw_led[F("rev")] = strip.reverseMode; hw_led["rev"] = strip.reverseMode;
hw_led[F("rgbwm")] = strip.rgbwMode; hw_led[F("rgbwm")] = strip.rgbwMode;
JsonArray hw_led_ins = hw_led.createNestedArray("ins"); JsonArray hw_led_ins = hw_led.createNestedArray("ins");
@ -460,7 +464,7 @@ void serializeConfig() {
uint8_t nPins = bus->getPins(pins); uint8_t nPins = bus->getPins(pins);
for (uint8_t i = 0; i < nPins; i++) ins_pin.add(pins[i]); for (uint8_t i = 0; i < nPins; i++) ins_pin.add(pins[i]);
ins[F("order")] = bus->getColorOrder(); ins[F("order")] = bus->getColorOrder();
ins[F("rev")] = bus->reversed; ins["rev"] = bus->reversed;
ins[F("skip")] = (skipFirstLed && s == 0) ? 1 : 0; ins[F("skip")] = (skipFirstLed && s == 0) ? 1 : 0;
ins[F("type")] = bus->getType(); ins[F("type")] = bus->getType();
} }
@ -491,7 +495,7 @@ void serializeConfig() {
JsonObject hw_relay = hw.createNestedObject("relay"); JsonObject hw_relay = hw.createNestedObject("relay");
hw_relay[F("pin")] = rlyPin; hw_relay[F("pin")] = rlyPin;
hw_relay[F("rev")] = rlyMde; hw_relay["rev"] = !rlyMde;
//JsonObject hw_status = hw.createNestedObject("status"); //JsonObject hw_status = hw.createNestedObject("status");
//hw_status[F("pin")] = -1; //hw_status[F("pin")] = -1;

View File

@ -87,7 +87,7 @@ void deserializeSegment(JsonObject elem, byte it)
//if (pal != seg.palette && pal < strip.getPaletteCount()) strip.setPalette(pal); //if (pal != seg.palette && pal < strip.getPaletteCount()) strip.setPalette(pal);
seg.setOption(SEG_OPTION_SELECTED, elem[F("sel")] | seg.getOption(SEG_OPTION_SELECTED)); seg.setOption(SEG_OPTION_SELECTED, elem[F("sel")] | seg.getOption(SEG_OPTION_SELECTED));
seg.setOption(SEG_OPTION_REVERSED, elem[F("rev")] | seg.getOption(SEG_OPTION_REVERSED)); seg.setOption(SEG_OPTION_REVERSED, elem["rev"] | seg.getOption(SEG_OPTION_REVERSED));
seg.setOption(SEG_OPTION_MIRROR , elem[F("mi")] | seg.getOption(SEG_OPTION_MIRROR )); seg.setOption(SEG_OPTION_MIRROR , elem[F("mi")] | seg.getOption(SEG_OPTION_MIRROR ));
//temporary, strip object gets updated via colorUpdated() //temporary, strip object gets updated via colorUpdated()
@ -327,7 +327,7 @@ void serializeSegment(JsonObject& root, WS2812FX::Segment& seg, byte id, bool fo
root[F("ix")] = seg.intensity; root[F("ix")] = seg.intensity;
root[F("pal")] = seg.palette; root[F("pal")] = seg.palette;
root[F("sel")] = seg.isSelected(); root[F("sel")] = seg.isSelected();
root[F("rev")] = seg.getOption(SEG_OPTION_REVERSED); root["rev"] = seg.getOption(SEG_OPTION_REVERSED);
root[F("mi")] = seg.getOption(SEG_OPTION_MIRROR); root[F("mi")] = seg.getOption(SEG_OPTION_MIRROR);
} }

View File

@ -8,7 +8,7 @@
*/ */
// version code in format yymmddb (b = daily build) // version code in format yymmddb (b = daily build)
#define VERSION 2102050 #define VERSION 2103040
//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
@ -197,8 +197,9 @@ WLED_GLOBAL int8_t rlyPin _INIT(-1);
#else #else
WLED_GLOBAL int8_t rlyPin _INIT(RLYPIN); WLED_GLOBAL int8_t rlyPin _INIT(RLYPIN);
#endif #endif
//Relay mode (1 = active high, 0 = active low, flipped in cfg.json)
#ifndef RLYMDE #ifndef RLYMDE
WLED_GLOBAL bool rlyMde _INIT(1); WLED_GLOBAL bool rlyMde _INIT(true);
#else #else
WLED_GLOBAL bool rlyMde _INIT(RLYMDE); WLED_GLOBAL bool rlyMde _INIT(RLYMDE);
#endif #endif