Fixed reverse

This commit is contained in:
cschwinne 2019-11-30 11:46:31 +01:00
parent be4019b4d3
commit 731550acb3
4 changed files with 14 additions and 14 deletions

View File

@ -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;

View File

@ -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 {

View File

@ -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>)=====";

View File

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