diff --git a/.gitignore b/.gitignore
index 2116e6930..d88844492 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@
.pioenvs
.piolibdeps
.vscode
+platformio.ini
!.vscode/extensions.json
/wled00/Release
/wled00/extLibs
diff --git a/wled00/FX.cpp b/wled00/FX.cpp
index e4ee0aabf..867ef9f14 100644
--- a/wled00/FX.cpp
+++ b/wled00/FX.cpp
@@ -141,7 +141,7 @@ uint16_t WS2812FX::color_wipe(bool rev, bool useRandomColors) {
SEGENV.step = 0;
}
}
-
+
uint16_t ledIndex = (prog * SEGLEN) >> 15;
uint16_t rem = 0;
rem = (prog * SEGLEN) * 2; //mod 0xFFFF
@@ -2346,6 +2346,29 @@ uint16_t WS2812FX::mode_static_pattern()
return FRAMETIME;
}
+uint16_t WS2812FX::mode_tri_static_pattern()
+{
+ uint8_t segSize = (SEGMENT.intensity >> 5) +1;
+ uint8_t currSeg = 0;
+ uint16_t currSegCount = 0;
+
+ for (uint16_t i = SEGMENT.start; i < SEGMENT.stop; i++) {
+ if ( currSeg % 3 == 0 ) {
+ setPixelColor(i, SEGCOLOR(0));
+ } else if( currSeg % 3 == 1) {
+ setPixelColor(i, SEGCOLOR(1));
+ } else {
+ setPixelColor(i, (SEGCOLOR(2) > 0 ? SEGCOLOR(2) : WHITE));
+ }
+ currSegCount += 1;
+ if (currSegCount >= segSize) {
+ currSeg +=1;
+ currSegCount = 0;
+ }
+ }
+
+ return FRAMETIME;
+}
//American Police Light with all LEDs Red and Blue
uint16_t WS2812FX::mode_policeall()
diff --git a/wled00/FX.h b/wled00/FX.h
index 076bc0b9b..52a8ea5b0 100644
--- a/wled00/FX.h
+++ b/wled00/FX.h
@@ -84,7 +84,7 @@
#define IS_REVERSE ((SEGMENT.options & REVERSE ) == REVERSE )
#define IS_SELECTED ((SEGMENT.options & SELECTED) == SELECTED )
-#define MODE_COUNT 86
+#define MODE_COUNT 87
#define FX_MODE_STATIC 0
#define FX_MODE_BLINK 1
@@ -171,8 +171,9 @@
#define FX_MODE_TWINKLECAT 81
#define FX_MODE_HALLOWEEN_EYES 82
#define FX_MODE_STATIC_PATTERN 83
-#define FX_MODE_POLICE 84
-#define FX_MODE_POLICE_ALL 85
+#define FX_MODE_TRI_STATIC_PATTERN 84
+#define FX_MODE_POLICE 85
+#define FX_MODE_POLICE_ALL 86
class WS2812FX {
@@ -312,8 +313,9 @@ class WS2812FX {
_mode[FX_MODE_TWINKLECAT] = &WS2812FX::mode_twinklecat;
_mode[FX_MODE_HALLOWEEN_EYES] = &WS2812FX::mode_halloween_eyes;
_mode[FX_MODE_STATIC_PATTERN] = &WS2812FX::mode_static_pattern;
- _mode[FX_MODE_POLICE] = &WS2812FX::mode_police;
- _mode[FX_MODE_POLICE_ALL] = &WS2812FX::mode_policeall;
+ _mode[FX_MODE_TRI_STATIC_PATTERN] = &WS2812FX::mode_tri_static_pattern;
+ _mode[FX_MODE_POLICE] = &WS2812FX::mode_police;
+ _mode[FX_MODE_POLICE_ALL] = &WS2812FX::mode_policeall;
_brightness = DEFAULT_BRIGHTNESS;
currentPalette = CRGBPalette16(CRGB::Black);
@@ -328,7 +330,7 @@ class WS2812FX {
}
void
- init(bool supportWhite, uint16_t countPixels, bool skipFirs),
+ init(bool supportWhite, uint16_t countPixels, bool skipFirs, uint8_t disableNLeds),
service(void),
blur(uint8_t),
fade_out(uint8_t r),
@@ -370,6 +372,7 @@ class WS2812FX {
paletteBlend = 0,
colorOrder = 0,
milliampsPerLed = 55,
+ _disableNLeds = 0,
getBrightness(void),
getMode(void),
getSpeed(void),
@@ -383,7 +386,8 @@ class WS2812FX {
uint16_t
ablMilliampsMax,
- currentMilliamps;
+ currentMilliamps,
+ _usableCount;
uint32_t
timebase,
@@ -491,6 +495,7 @@ class WS2812FX {
mode_twinklecat(void),
mode_halloween_eyes(void),
mode_static_pattern(void),
+ mode_tri_static_pattern(void),
mode_police(void),
mode_policeall(void);
@@ -563,7 +568,7 @@ const char JSON_mode_names[] PROGMEM = R"=====([
"Out Out","Out In","Circus","Halloween","Tri Chase","Tri Wipe","Tri Fade","Lightning","ICU","Multi Comet",
"Dual Scanner","Stream 2","Oscillate","Pride 2015","Juggle","Palette","Fire 2012","Colorwaves","Bpm","Fill Noise",
"Noise 1","Noise 2","Noise 3","Noise 4","Colortwinkles","Lake","Meteor","Smooth Meteor","Railway","Ripple",
-"Twinklefox","Twinklecat","Halloween Eyes","Solid Pattern","Police","Police All"
+"Twinklefox","Twinklecat","Halloween Eyes","Solid Pattern","Tri Color Pattern", "Police","Police All"
])=====";
diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp
index 2fcca1ec4..9d521571c 100644
--- a/wled00/FX_fcn.cpp
+++ b/wled00/FX_fcn.cpp
@@ -30,25 +30,40 @@
#define LED_SKIP_AMOUNT 1
#define MIN_SHOW_DELAY 15
-void WS2812FX::init(bool supportWhite, uint16_t countPixels, bool skipFirst)
+void WS2812FX::init(bool supportWhite, uint16_t countPixels, bool skipFirst, uint8_t disableNLeds)
{
- if (supportWhite == _rgbwMode && countPixels == _length && _locked != NULL) return;
+ if (supportWhite == _rgbwMode && countPixels == _length && _locked != NULL && disableNLeds == _disableNLeds) return;
RESET_RUNTIME;
_rgbwMode = supportWhite;
_skipFirstMode = skipFirst;
_length = countPixels;
-
+
+ if (disableNLeds > 0) {
+ uint16_t groupCount = disableNLeds +1;
+ //since 1st led is lit, even partial group has a led lit, whereas int division truncates decimal.
+ bool hasExtraLight = _length % groupCount != 0;
+ _usableCount = _length/groupCount;
+ _usableCount += hasExtraLight ? 1 : 0;
+ } else {
+ _usableCount = _length;
+ }
+
+ _disableNLeds = disableNLeds;
+
uint8_t ty = 1;
if (supportWhite) ty =2;
uint16_t lengthRaw = _length;
- if (_skipFirstMode) lengthRaw += LED_SKIP_AMOUNT;
+ if (_skipFirstMode) {
+ lengthRaw += LED_SKIP_AMOUNT;
+ }
+
bus->Begin((NeoPixelType)ty, lengthRaw);
delete[] _locked;
_locked = new byte[_length];
_segments[0].start = 0;
- _segments[0].stop = _length;
+ _segments[0].stop = _usableCount;
unlockAll();
setBrightness(_brightness);
@@ -99,8 +114,9 @@ void WS2812FX::setPixelColor(uint16_t n, uint32_t c) {
void WS2812FX::setPixelColor(uint16_t i, byte r, byte g, byte b, byte w)
{
+ uint16_t actualPixelLocation = i * (_disableNLeds+1);
if (_locked[i] && !_modeUsesLock) return;
- if (IS_REVERSE) i = SEGMENT.stop -1 -i + SEGMENT.start; //reverse just individual segment
+ if (IS_REVERSE) i = SEGMENT.stop -1 -actualPixelLocation + SEGMENT.start; //reverse just individual segment
byte tmpg = g;
switch (colorOrder) //0 = Grb, default
{
@@ -111,14 +127,18 @@ void WS2812FX::setPixelColor(uint16_t i, byte r, byte g, byte b, byte w)
}
if (!_cronixieMode)
{
- if (reverseMode) i = _length -1 -i;
+ if (reverseMode) i = _usableCount -1 -i;
if (_skipFirstMode)
{
if (i < LED_SKIP_AMOUNT) bus->SetPixelColor(i, RgbwColor(0,0,0,0));
i += LED_SKIP_AMOUNT;
}
-
- bus->SetPixelColor(i, RgbwColor(r,g,b,w));
+ bus->SetPixelColor(actualPixelLocation, RgbwColor(r,g,b,w));
+ if (_disableNLeds > 0) {
+ for(uint16_t offCount=0; offCount < _disableNLeds; offCount++) {
+ bus->SetPixelColor((actualPixelLocation+offCount+1), RgbwColor(0,0,0,0));
+ }
+ }
} else {
if(i>6)return;
byte o = 10*i;
diff --git a/wled00/data/settings_leds.htm b/wled00/data/settings_leds.htm
index 253b96c85..ac36c6c9f 100644
Binary files a/wled00/data/settings_leds.htm and b/wled00/data/settings_leds.htm differ
diff --git a/wled00/html_settings.h b/wled00/html_settings.h
index f688c56d4..b16d2293b 100644
--- a/wled00/html_settings.h
+++ b/wled00/html_settings.h
@@ -187,7 +187,8 @@ Palette blending:
Reverse LED order (rotate 180):
-Skip first LED: