mirror of
https://github.com/wled/WLED.git
synced 2025-07-19 08:46:34 +00:00
Skip first led cleanup.
This commit is contained in:
parent
0e2168392c
commit
7078c91f7d
@ -17,17 +17,17 @@
|
|||||||
//temporary struct for passing bus configuration to bus
|
//temporary struct for passing bus configuration to bus
|
||||||
struct BusConfig {
|
struct BusConfig {
|
||||||
uint8_t type = TYPE_WS2812_RGB;
|
uint8_t type = TYPE_WS2812_RGB;
|
||||||
uint16_t count = 1;
|
uint16_t count;
|
||||||
uint16_t start = 0;
|
uint16_t start;
|
||||||
uint8_t colorOrder = COL_ORDER_GRB;
|
uint8_t colorOrder;
|
||||||
bool reversed = false;
|
bool reversed;
|
||||||
bool skipFirst = false;
|
uint8_t skipAmount;
|
||||||
bool rgbwOverride = false;
|
bool rgbwOverride;
|
||||||
uint8_t pins[5] = {LEDPIN, 255, 255, 255, 255};
|
uint8_t pins[5] = {LEDPIN, 255, 255, 255, 255};
|
||||||
BusConfig(uint8_t busType, uint8_t* ppins, uint16_t pstart, uint16_t len = 1, uint8_t pcolorOrder = COL_ORDER_GRB, bool rev = false, bool skip = false) {
|
BusConfig(uint8_t busType, uint8_t* ppins, uint16_t pstart, uint16_t len = 1, uint8_t pcolorOrder = COL_ORDER_GRB, bool rev = false, uint8_t skip = 0) {
|
||||||
rgbwOverride = (bool) GET_BIT(busType,7);
|
rgbwOverride = (bool) GET_BIT(busType,7);
|
||||||
type = busType & 0x7F; // bit 7 is hacked to include RGBW info (1=RGBW, 0=RGB)
|
type = busType & 0x7F; // bit 7 is hacked to include RGBW info (1=RGBW, 0=RGB)
|
||||||
count = len; start = pstart; colorOrder = pcolorOrder; reversed = rev; skipFirst = skip;
|
count = len; start = pstart; colorOrder = pcolorOrder; reversed = rev; skipAmount = skip;
|
||||||
uint8_t nPins = 1;
|
uint8_t nPins = 1;
|
||||||
if (type > 47) nPins = 2;
|
if (type > 47) nPins = 2;
|
||||||
else if (type > 41 && type < 46) nPins = NUM_PWM_PINS(type);
|
else if (type > 41 && type < 46) nPins = NUM_PWM_PINS(type);
|
||||||
@ -81,8 +81,8 @@ class Bus {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool skipFirstLed() {
|
virtual uint8_t skipFirstLed() {
|
||||||
return false;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint8_t getType() {
|
inline uint8_t getType() {
|
||||||
@ -116,10 +116,10 @@ class BusDigital : public Bus {
|
|||||||
cleanup(); return;
|
cleanup(); return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_skip = bc.skipFirst ? LED_SKIP_AMOUNT : 0; //sacrificial pixels
|
|
||||||
_len = bc.count + _skip;
|
|
||||||
reversed = bc.reversed;
|
reversed = bc.reversed;
|
||||||
_rgbw = bc.rgbwOverride; // RGBW override in bit 7
|
_skip = bc.skipAmount; //sacrificial pixels
|
||||||
|
_len = bc.count + _skip;
|
||||||
|
_rgbw = bc.rgbwOverride; // RGBW override in bit 7
|
||||||
_iType = PolyBus::getI(type, _pins, nr, _rgbw);
|
_iType = PolyBus::getI(type, _pins, nr, _rgbw);
|
||||||
if (_iType == I_NONE) return;
|
if (_iType == I_NONE) return;
|
||||||
_busPtr = PolyBus::create(_iType, _pins, _len);
|
_busPtr = PolyBus::create(_iType, _pins, _len);
|
||||||
@ -181,8 +181,8 @@ class BusDigital : public Bus {
|
|||||||
return _rgbw;
|
return _rgbw;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool skipFirstLed() {
|
inline uint8_t skipFirstLed() {
|
||||||
return (bool)_skip;
|
return _skip;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void reinit() {
|
inline void reinit() {
|
||||||
|
@ -102,7 +102,6 @@ void deserializeConfig() {
|
|||||||
|
|
||||||
JsonArray ins = hw_led["ins"];
|
JsonArray ins = hw_led["ins"];
|
||||||
uint8_t s = 0; // bus iterator
|
uint8_t s = 0; // bus iterator
|
||||||
bool skipFirst = false;
|
|
||||||
strip.isRgbw = false;
|
strip.isRgbw = false;
|
||||||
busses.removeAll();
|
busses.removeAll();
|
||||||
uint32_t mem = 0;
|
uint32_t mem = 0;
|
||||||
@ -123,9 +122,8 @@ void deserializeConfig() {
|
|||||||
if (start >= lC+length) continue; // something is very wrong :)
|
if (start >= lC+length) continue; // something is very wrong :)
|
||||||
//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 colorOrder = (int)elm[F("order")];
|
uint8_t colorOrder = elm[F("order")];
|
||||||
//(this shouldn't have been in ins obj. but remains here for compatibility)
|
uint8_t skipFirst = elm[F("skip")];
|
||||||
skipFirst = (bool) elm[F("skip")];
|
|
||||||
uint8_t ledType = elm["type"] | TYPE_WS2812_RGB;
|
uint8_t ledType = elm["type"] | TYPE_WS2812_RGB;
|
||||||
bool reversed = elm["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
|
||||||
@ -144,7 +142,7 @@ void deserializeConfig() {
|
|||||||
JsonObject hw_btn_ins_0 = hw[F("btn")][F("ins")][0];
|
JsonObject hw_btn_ins_0 = hw[F("btn")][F("ins")][0];
|
||||||
CJSON(buttonEnabled, hw_btn_ins_0["type"]);
|
CJSON(buttonEnabled, hw_btn_ins_0["type"]);
|
||||||
int hw_btn_pin = hw_btn_ins_0["pin"][0];
|
int hw_btn_pin = hw_btn_ins_0["pin"][0];
|
||||||
if (pinManager.allocatePin(hw_btn_pin,false)) {
|
if (hw_btn_pin>=0 && pinManager.allocatePin(hw_btn_pin,false)) {
|
||||||
btnPin = hw_btn_pin;
|
btnPin = hw_btn_pin;
|
||||||
pinMode(btnPin, INPUT_PULLUP);
|
pinMode(btnPin, INPUT_PULLUP);
|
||||||
} else {
|
} else {
|
||||||
@ -160,7 +158,7 @@ void deserializeConfig() {
|
|||||||
|
|
||||||
#ifndef WLED_DISABLE_INFRARED
|
#ifndef WLED_DISABLE_INFRARED
|
||||||
int hw_ir_pin = hw["ir"]["pin"] | -1; // 4
|
int hw_ir_pin = hw["ir"]["pin"] | -1; // 4
|
||||||
if (pinManager.allocatePin(hw_ir_pin,false)) {
|
if (hw_ir_pin >=0 && pinManager.allocatePin(hw_ir_pin,false)) {
|
||||||
irPin = hw_ir_pin;
|
irPin = hw_ir_pin;
|
||||||
} else {
|
} else {
|
||||||
irPin = -1;
|
irPin = -1;
|
||||||
@ -169,8 +167,8 @@ void deserializeConfig() {
|
|||||||
CJSON(irEnabled, hw["ir"]["type"]);
|
CJSON(irEnabled, hw["ir"]["type"]);
|
||||||
|
|
||||||
JsonObject relay = hw[F("relay")];
|
JsonObject relay = hw[F("relay")];
|
||||||
int hw_relay_pin = relay["pin"];
|
int hw_relay_pin = relay["pin"] | -1;
|
||||||
if (pinManager.allocatePin(hw_relay_pin,true)) {
|
if (hw_relay_pin>=0 && pinManager.allocatePin(hw_relay_pin,true)) {
|
||||||
rlyPin = hw_relay_pin;
|
rlyPin = hw_relay_pin;
|
||||||
pinMode(rlyPin, OUTPUT);
|
pinMode(rlyPin, OUTPUT);
|
||||||
} else {
|
} else {
|
||||||
|
@ -83,9 +83,9 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
|||||||
#endif
|
#endif
|
||||||
if (btnPin>=0 && pinManager.isPinAllocated(btnPin)) pinManager.deallocatePin(btnPin);
|
if (btnPin>=0 && pinManager.isPinAllocated(btnPin)) pinManager.deallocatePin(btnPin);
|
||||||
|
|
||||||
bool skip = request->hasArg(F("SL"));
|
|
||||||
strip.isRgbw = false;
|
strip.isRgbw = false;
|
||||||
|
|
||||||
|
uint8_t skip = request->hasArg(F("SL")) ? LED_SKIP_AMOUNT : 0;
|
||||||
uint8_t colorOrder, type;
|
uint8_t colorOrder, type;
|
||||||
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};
|
||||||
@ -99,7 +99,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
|||||||
char cv[4] = "CV"; cv[2] = 48+s; cv[3] = 0; //strip reverse
|
char cv[4] = "CV"; cv[2] = 48+s; cv[3] = 0; //strip reverse
|
||||||
char ew[4] = "EW"; ew[2] = 48+s; ew[3] = 0; //strip RGBW override
|
char ew[4] = "EW"; ew[2] = 48+s; ew[3] = 0; //strip RGBW override
|
||||||
if (!request->hasArg(lp)) {
|
if (!request->hasArg(lp)) {
|
||||||
DEBUG_PRINTLN("No data."); break;
|
DEBUG_PRINTLN(F("No data.")); break;
|
||||||
}
|
}
|
||||||
for (uint8_t i = 0; i < 5; i++) {
|
for (uint8_t i = 0; i < 5; i++) {
|
||||||
lp[1] = 48+i;
|
lp[1] = 48+i;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// version code in format yymmddb (b = daily build)
|
// version code in format yymmddb (b = daily build)
|
||||||
#define VERSION 2103312
|
#define VERSION 2104011
|
||||||
|
|
||||||
//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
|
||||||
@ -168,7 +168,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Global Variable definitions
|
// Global Variable definitions
|
||||||
WLED_GLOBAL char versionString[] _INIT("0.12.0-b5");
|
WLED_GLOBAL char versionString[] _INIT("0.12.0-b6");
|
||||||
#define WLED_CODENAME "Hikari"
|
#define WLED_CODENAME "Hikari"
|
||||||
|
|
||||||
// AP and OTA default passwords (for maximum security change them!)
|
// AP and OTA default passwords (for maximum security change them!)
|
||||||
|
@ -345,7 +345,7 @@ void getSettingsJS(byte subPage, char* dest)
|
|||||||
sappend('v',ls,bus->getStart());
|
sappend('v',ls,bus->getStart());
|
||||||
sappend('c',cv,bus->reversed);
|
sappend('c',cv,bus->reversed);
|
||||||
sappend('c',ew,bus->isRgbw());
|
sappend('c',ew,bus->isRgbw());
|
||||||
skip = skip || bus->skipFirstLed();
|
if (!skip) skip = bus->skipFirstLed()>0;
|
||||||
}
|
}
|
||||||
sappend('v',SET_F("MA"),strip.ablMilliampsMax);
|
sappend('v',SET_F("MA"),strip.ablMilliampsMax);
|
||||||
sappend('v',SET_F("LA"),strip.milliampsPerLed);
|
sappend('v',SET_F("LA"),strip.milliampsPerLed);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user