| 121 | } |
| 122 | |
| 123 | void loop() { |
| 124 | uint32_t now = fl::millis(); |
| 125 | FastLED.setBrightness(!isOff ? brightness.as<uint8_t>() : 0); |
| 126 | noisePalette.setSpeed(speed); |
| 127 | noisePalette.setScale(scale); |
| 128 | fxEngine.setSpeed(timeSpeed); |
| 129 | |
| 130 | if (changeFx) { |
| 131 | fxEngine.nextFx(); |
| 132 | } |
| 133 | // We use the dynamic version here which allows the change time to respond |
| 134 | // to changes from the UI element. |
| 135 | EVERY_N_MILLISECONDS_DYNAMIC(changePalletTime.as<int>() * 1000) { |
| 136 | if (changePallete) { |
| 137 | noisePalette.changeToRandomPalette(); |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | if (changePalette) { |
| 142 | noisePalette.changeToRandomPalette(); |
| 143 | |
| 144 | } |
| 145 | |
| 146 | // Do a change of palette if the button is pressed. |
| 147 | static int lastFxIndex = -1; |
| 148 | if (fxIndex.value() != lastFxIndex) { |
| 149 | lastFxIndex = fxIndex; |
| 150 | animartrix.fxSet(fxIndex); |
| 151 | } |
| 152 | |
| 153 | |
| 154 | fxEngine.draw(now, leds); |
| 155 | FastLED.show(); |
| 156 | } |
nothing calls this directly
no test coverage detected