Skip to content
Permalink
Browse files

Fixed reverse

  • Loading branch information
Aircoookie committed Nov 30, 2019
1 parent be4019b commit 731550acb38fa5b2e84ae59f977c2c2585df80c7
Showing with 14 additions and 14 deletions.
  1. +2 −3 wled00/FX.h
  2. +9 −9 wled00/FX_fcn.cpp
  3. +2 −1 wled00/html_settings.h
  4. +1 −1 wled00/wled00.ino
@@ -386,8 +386,7 @@ class WS2812FX {

uint16_t
ablMilliampsMax,
currentMilliamps,
_usableCount;
currentMilliamps;

uint32_t
timebase,
@@ -508,7 +507,7 @@ class WS2812FX {
CRGBPalette16 targetPalette;

uint32_t now;
uint16_t _length;
uint16_t _length, _lengthRaw, _usableCount;
uint16_t _rand16seed;
uint8_t _brightness;

@@ -52,12 +52,12 @@ void WS2812FX::init(bool supportWhite, uint16_t countPixels, bool skipFirst, uin

uint8_t ty = 1;
if (supportWhite) ty =2;
uint16_t lengthRaw = _length;
_lengthRaw = _length;
if (_skipFirstMode) {
lengthRaw += LED_SKIP_AMOUNT;
_lengthRaw += LED_SKIP_AMOUNT;
}

bus->Begin((NeoPixelType)ty, lengthRaw);
bus->Begin((NeoPixelType)ty, _lengthRaw);

delete[] _locked;
_locked = new byte[_length];
@@ -116,7 +116,7 @@ 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 -actualPixelLocation + SEGMENT.start; //reverse just individual segment
if (IS_REVERSE) actualPixelLocation = SEGMENT.stop -1 -actualPixelLocation + SEGMENT.start; //reverse just individual segment
byte tmpg = g;
switch (colorOrder) //0 = Grb, default
{
@@ -127,16 +127,16 @@ void WS2812FX::setPixelColor(uint16_t i, byte r, byte g, byte b, byte w)
}
if (!_cronixieMode)
{
if (reverseMode) i = _usableCount -1 -i;
if (reverseMode) actualPixelLocation = _length -1 -actualPixelLocation;
if (_skipFirstMode)
{
if (i < LED_SKIP_AMOUNT) bus->SetPixelColor(i, RgbwColor(0,0,0,0));
i += LED_SKIP_AMOUNT;
if (actualPixelLocation < LED_SKIP_AMOUNT) bus->SetPixelColor(actualPixelLocation, RgbwColor(0,0,0,0));
actualPixelLocation += LED_SKIP_AMOUNT;
}
bus->SetPixelColor(actualPixelLocation, RgbwColor(r,g,b,w));
if (actualPixelLocation < _lengthRaw) 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));
if (actualPixelLocation < _lengthRaw) bus->SetPixelColor((actualPixelLocation+offCount+1), RgbwColor(0,0,0,0));
}
}
} else {
@@ -188,7 +188,8 @@ Palette blending:
</select><br>
Reverse LED order (rotate 180): <input type=checkbox name=RV><br>
Skip first LED: <input type=checkbox name=SL><br>
Disable repeating N LED: <input type=number min=0 max=255 name=DL>(Spaces out patterns by turning off leds between colors)<hr>
Disable repeating N LEDs: <input type=number min=0 max=255 name=DL><br>
(Turns off N LEDs between each lit one, spacing out effects)<hr>
<button type=button onclick=B()>Back</button><button type=submit>Save</button>
</form></body>
</html>)=====";
@@ -99,7 +99,7 @@


//version code in format yymmddb (b = daily build)
#define VERSION 1911301
#define VERSION 1911302
char versionString[] = "0.8.7-dev";


0 comments on commit 731550a

Please sign in to comment.
You can’t perform that action at this time.