Skip to content

Commit

Permalink
Use rotationSpeed for runningPalette
Browse files Browse the repository at this point in the history
  • Loading branch information
CWempe committed Dec 5, 2018
1 parent 2d457ce commit 4c66ccc
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions src/led_patterns.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,23 +68,26 @@ void runningPalette()
static uint8_t startIndex = 0;
invert = false;

// increase startIndex everytime this function is called
startIndex = startIndex + 1;

// define if the palette should be started inverted
// and change this behavier every time startIndex is 0
if ( paletteRotationable == false) {
if ( startIndex == 0 && startPaletteInverted == false) {
startPaletteInverted = true;
} else if ( startIndex == 0 && startPaletteInverted == true) {

EVERY_N_MILLIS_I(runningPalette, rotationSpeedMs) {
// increase startIndex everytime this function is called
startIndex = startIndex + 1;

// define if the palette should be started inverted
// and change this behavier every time startIndex is 0
if ( paletteRotationable == false) {
if ( startIndex == 0 && startPaletteInverted == false) {
startPaletteInverted = true;
} else if ( startIndex == 0 && startPaletteInverted == true) {
startPaletteInverted = false;
}
} else {
startPaletteInverted = false;
}
} else {
startPaletteInverted = false;

// generade led array based on the current startIndex
showPalette(startIndex);
}

// generade led array based on the current startIndex
showPalette(startIndex);
}


Expand Down

0 comments on commit 4c66ccc

Please sign in to comment.