diff --git a/src/main.cpp b/src/main.cpp index 1e3030cf2de8b453e897fd6efdc9d1197d58d04e..616d9532732a3b7e5c1c43e6f2de4daabafda1bf 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -101,18 +101,12 @@ int state = STATE_PAUSE; void show() { pixels.clear(); if (state == STATE_PAUSE) { - for (int i = 0; i < greenLength; i++) { - pixels.setPixelColor(i, 0x00FF00); - } + pixels.fill(0x00FF00, 0, greenLength); if (singlePlayer) { - for (int i = NEOPIXEL_LEN / 2; i < NEOPIXEL_LEN; i++) { - pixels.setPixelColor(i, 0x0000FF); - } + pixels.fill(0x0000FF, NEOPIXEL_LEN / 2); } else { - for (int i = NEOPIXEL_LEN - greenLength - 1; i < NEOPIXEL_LEN; i++) { - pixels.setPixelColor(i, 0x00FF00); - } - + pixels.fill(0x00FF00, NEOPIXEL_LEN - greenLength - 1); + int points = pointsInternal; if (lastPointInternal && hideLastPoint) { points = max(0, points - 1); @@ -131,17 +125,11 @@ void show() { } } else if (state == STATE_FORWARD || state == STATE_BACKWARD) { - for (int i = 0; i < greenLength; i++) { - pixels.setPixelColor(i, 0x00FF00); - } + pixels.fill(0x00FF00, 0, greenLength); if (singlePlayer) { - for (int i = NEOPIXEL_LEN / 2; i < NEOPIXEL_LEN; i++) { - pixels.setPixelColor(i, 0x0000FF); - } + pixels.fill(0x0000FF, NEOPIXEL_LEN / 2); } else { - for (int i = NEOPIXEL_LEN - greenLength - 1; i < NEOPIXEL_LEN; i++) { - pixels.setPixelColor(i, 0x00FF00); - } + pixels.fill(0x00FF00, NEOPIXEL_LEN - greenLength - 1); } pixels.setPixelColor(position, 0xFFFFFF); } @@ -231,18 +219,14 @@ void handleButton() { void handleExternalMissedAnimation() { int step = (100 - taskExternalMissedAnimation.getIterations()) % 25; pixels.clear(); - for (int i = NEOPIXEL_LEN - 1 - 25; i < NEOPIXEL_LEN - 25 + step; i++) { - pixels.setPixelColor(i, 0xFF0000); - } + pixels.fill(0xFF0000, NEOPIXEL_LEN - 1 - 25, step + 1); pixels.show(); } void handleInternalMissedAnimation() { int step = (100 - taskInternalMissedAnimation.getIterations()) % 25; pixels.clear(); - for (int i = 25 - step; i < 25; i++) { - pixels.setPixelColor(i, 0xFF0000); - } + pixels.fill(0xFF0000, 25 - step, step + 1); pixels.show(); }