From c816a739c7ede712fc6b822b5f21530c0cf2dee3 Mon Sep 17 00:00:00 2001 From: Sen Morgan Date: Sun, 8 Dec 2024 19:58:31 +0100 Subject: [PATCH] feat: set and reset LED brightness globally before and after progress indication --- src/leds.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/leds.cpp b/src/leds.cpp index 008c908..e359b68 100644 --- a/src/leds.cpp +++ b/src/leds.cpp @@ -74,6 +74,9 @@ void startProgressIndication() // Pause the task to prevent concurrent access vTaskSuspend(ledsTaskHandle); + // Set brightness + FastLED.setBrightness(PROGRESS_INDICATOR_BRIGHTNESS); + // Reset all LEDs resetLedsStates(); } @@ -86,6 +89,9 @@ void startProgressIndication() */ void stopProgressIndication() { + // Reset brightness + FastLED.setBrightness(255); + // Reset all LEDs resetLedsStates(); @@ -111,9 +117,6 @@ void progressIndicator(uint8_t progress, CRGB color) uint8_t totalLeds = sizeof(CIRCLE_LEDS_ARRAY) / sizeof(CIRCLE_LEDS_ARRAY[0]); uint8_t ledsToLight = (progress * totalLeds) / 100; - // Update brightness based on PROGRESS_INDICATOR_BRIGHTNESS - color.nscale8_video(PROGRESS_INDICATOR_BRIGHTNESS); - // Light up LEDs based on progress for (uint8_t i = 0; i < ledsToLight; i++) leds[CIRCLE_LEDS_ARRAY[i]] = color;