| 72 | } |
| 73 | |
| 74 | void loop() { |
| 75 | // Allow the waveSimulator to respond to the current slider value each frame. |
| 76 | waveSim.setSpeed(slider); |
| 77 | waveSim.setDampening(dampening); |
| 78 | // Pretty much you always want half duplex to be true, otherwise you get a gray |
| 79 | // wave effect that doesn't look good. |
| 80 | waveSim.setHalfDuplex(halfDuplex); |
| 81 | waveSim.setSuperSample(getSuperSample()); |
| 82 | static int x = 0; // okay static in header |
| 83 | if (button.clicked()) { |
| 84 | // If button click then select a random position in the wave. |
| 85 | x = random(NUM_LEDS); |
| 86 | } |
| 87 | if (button.isPressed()) { |
| 88 | FL_WARN("Button is pressed at " << x); |
| 89 | triggerRipple(waveSim, x); |
| 90 | } |
| 91 | waveSim.update(); |
| 92 | for (int i = 0; i < extraFrames.value(); i++) { |
| 93 | waveSim.update(); |
| 94 | } |
| 95 | for (int x = 0; x < NUM_LEDS; x++) { |
| 96 | // float value = waveSim.get(x); |
| 97 | uint8_t value8 = waveSim.getu8(x); |
| 98 | leds[x] = fl::CRGB(value8, value8, value8); |
| 99 | } |
| 100 | FastLED.show(); |
| 101 | } |
nothing calls this directly
no test coverage detected