Commit b13b1a6c authored by Eric Duminil's avatar Eric Duminil
Browse files

led_effects: rainbow wheel in both directions

parent 06467a3d
Pipeline #3593 passed with stage
in 1 minute and 40 seconds
......@@ -168,17 +168,18 @@ namespace led_effects {
}
}
void showRainbowWheel(uint16_t duration_ms, uint16_t hue_increment) {
void showRainbowWheel(uint16_t duration_ms) {
if (config::night_mode) {
return;
}
static uint16_t wheel_offset = 0;
static uint16_t sine_offset = 0;
unsigned long t0 = millis();
pixels.setBrightness(config::max_brightness);
while (millis() - t0 < duration_ms) {
for (int i = 0; i < NUMPIXELS; i++) {
pixels.setPixelColor(i, pixels.ColorHSV(i * 65535 / NUMPIXELS + wheel_offset));
wheel_offset += hue_increment;
wheel_offset += (pixels.sine8(sine_offset++ / 50) - 127) / 2;
}
pixels.show();
delay(10);
......
......@@ -29,7 +29,7 @@ namespace led_effects {
int countdownToZero();
void showWaitingLED(uint32_t color);
void showKITTWheel(uint32_t color, uint16_t duration_s = 2);
void showRainbowWheel(uint16_t duration_ms = 1000, uint16_t hue_increment = 50);
void showRainbowWheel(uint16_t duration_ms = 1000);
void displayCO2color(uint16_t co2);
}
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment