@@ -830,7 +830,7 @@ AnimationReturnType Animation_VoltageWarning(const bool startNewAnimation, CRGBS
830830AnimationReturnType Animation_Webstream (const bool startNewAnimation, CRGBSet &leds) {
831831 // return values
832832 bool animationActive = false ;
833- bool refresh = false ;
833+ bool animationRefresh = false ;
834834 int32_t animationDelay = 0 ;
835835 // static vars
836836 static uint8_t ledPosWebstream = 0 ;
@@ -852,7 +852,7 @@ AnimationReturnType Animation_Webstream(const bool startNewAnimation, CRGBSet &l
852852 }
853853 animationDelay = 10 ;
854854 timerProgress = 0 ; // directly show new animation after pause
855- refresh = true ;
855+ animationRefresh = true ;
856856 } else {
857857 if (startNewAnimation || timerProgress == 0 ) {
858858 leds = CRGB ::Black;
@@ -880,15 +880,15 @@ AnimationReturnType Animation_Webstream(const bool startNewAnimation, CRGBSet &l
880880 }
881881 }
882882 }
883- refresh = true ;
883+ animationRefresh = true ;
884884 }
885885 timerProgress--;
886886 animationDelay = 45 ;
887887 if (timerProgress > 0 ) {
888888 animationActive = true ;
889889 }
890890 }
891- return AnimationReturnType (animationActive, animationDelay, refresh );
891+ return AnimationReturnType (animationActive, animationDelay, animationRefresh );
892892}
893893
894894// --------------------------------
@@ -897,7 +897,7 @@ AnimationReturnType Animation_Webstream(const bool startNewAnimation, CRGBSet &l
897897AnimationReturnType Animation_Rewind (const bool startNewAnimation, CRGBSet &leds) {
898898 // return values
899899 bool animationActive = false ;
900- bool refresh = false ;
900+ bool animationRefresh = false ;
901901 int32_t animationDelay = 0 ;
902902 // static vars
903903 static uint16_t animationIndex = 0 ;
@@ -910,48 +910,44 @@ AnimationReturnType Animation_Rewind(const bool startNewAnimation, CRGBSet &leds
910910
911911 if (animationIndex < (leds.size ())) {
912912 leds[Led_Address (leds.size () - 1 - animationIndex)] = CRGB ::Black;
913- refresh = true ;
913+ animationRefresh = true ;
914914 animationDelay = 30 ;
915915 animationIndex++;
916916 } else {
917917 animationActive = false ;
918918 }
919919 }
920- return AnimationReturnType (animationActive, animationDelay, refresh );
920+ return AnimationReturnType (animationActive, animationDelay, animationRefresh );
921921}
922922
923923// --------------------------------
924924// Idle Animation
925925// --------------------------------
926926AnimationReturnType Animation_Idle (const bool startNewAnimation, CRGBSet &leds) {
927927 // return values
928- int32_t animationDelay = 0 ;
928+ int32_t animationDelay = 120 ;
929929 bool animationActive = true ;
930- bool refresh = true ;
930+ bool animationRefresh = true ;
931+
931932 // static vars
932- static int16_t ledIndex = 0 ;
933- // this can be removed to always continue on the last position in idle
933+ static int16_t step = 0 ;
934+
934935 if (startNewAnimation) {
935- ledIndex = 0 ;
936+ step = 0 ;
936937 }
937938
938- if (ledIndex < leds.size ()) {
939- CRGB ::HTMLColorCode idleColor = Led_GetIdleColor ();
940- leds = CRGB ::Black;
941- Led_DrawIdleDots (leds, ledIndex, idleColor);
942- if (OPMODE_BLUETOOTH_SOURCE == System_GetOperationMode ()) {
943- // animate a bit faster in BT-Source to distinguish between the bluetooth modes
944- animationDelay = 30 * 10 ;
945- } else {
946- animationDelay = 50 * 10 ;
939+ CRGB idleColor = (CRGB )Led_GetIdleColor ();
940+
941+ leds.fadeToBlackBy (40 );
942+ if (leds.size () > 0 ) {
943+ int16_t idx = (leds.size () - 1 ) - (step % leds.size ());
944+ if (idx >= 0 && idx < leds.size ()) {
945+ leds[idx] = idleColor;
947946 }
948- ledIndex++;
949- } else {
950- animationActive = false ;
951- refresh = false ;
952- ledIndex = 0 ;
947+ step = (step + 1 ) % leds.size ();
953948 }
954- return AnimationReturnType (animationActive, animationDelay, refresh);
949+
950+ return AnimationReturnType (animationActive, animationDelay, animationRefresh);
955951}
956952
957953// --------------------------------
@@ -1245,7 +1241,7 @@ AnimationReturnType Animation_PlaylistProgress(const bool startNewAnimation, CRG
12451241AnimationReturnType Animation_BatteryMeasurement (const bool startNewAnimation, CRGBSet &leds) {
12461242 // return-values
12471243 static bool animationActive = false ;
1248- bool refresh = false ;
1244+ bool animationRefresh = false ;
12491245 int32_t animationDelay = 0 ;
12501246 // static variables for animation
12511247 static float staticBatteryLevel = 0 .0f ; // variable to store the measured battery-voltage
@@ -1267,7 +1263,7 @@ AnimationReturnType Animation_BatteryMeasurement(const bool startNewAnimation, C
12671263 filledLedCount = 0 ;
12681264 animationActive = true ;
12691265 leds = CRGB ::Black;
1270- refresh = true ;
1266+ animationRefresh = true ;
12711267 }
12721268 if (gLedSettings .numIndicatorLeds == 1 ) {
12731269 if (staticBatteryLevel < 0.3 ) {
@@ -1277,7 +1273,7 @@ AnimationReturnType Animation_BatteryMeasurement(const bool startNewAnimation, C
12771273 } else {
12781274 leds[0 ] = CRGB ::Green;
12791275 }
1280- refresh = true ;
1276+ animationRefresh = true ;
12811277
12821278 animationDelay = 20 * 100 ;
12831279 animationActive = false ;
@@ -1293,7 +1289,7 @@ AnimationReturnType Animation_BatteryMeasurement(const bool startNewAnimation, C
12931289 } else {
12941290 leds[Led_Address (filledLedCount)] = CRGB ::Green;
12951291 }
1296- refresh = true ;
1292+ animationRefresh = true ;
12971293
12981294 filledLedCount++;
12991295 animationDelay = 20 ;
@@ -1302,7 +1298,7 @@ AnimationReturnType Animation_BatteryMeasurement(const bool startNewAnimation, C
13021298 animationActive = false ;
13031299 }
13041300 }
1305- return AnimationReturnType (animationActive, animationDelay, refresh );
1301+ return AnimationReturnType (animationActive, animationDelay, animationRefresh );
13061302}
13071303#endif
13081304
0 commit comments