Add stop all (#147)

This commit is contained in:
Michael Miller
2016-12-16 19:09:24 -08:00
committed by GitHub
parent a672d4ce55
commit 5b48c48551
2 changed files with 12 additions and 0 deletions

View File

@@ -79,6 +79,8 @@ public:
void StartAnimation(uint16_t indexAnimation, uint16_t duration, AnimUpdateCallback animUpdate); void StartAnimation(uint16_t indexAnimation, uint16_t duration, AnimUpdateCallback animUpdate);
void StopAnimation(uint16_t indexAnimation); void StopAnimation(uint16_t indexAnimation);
void StopAll();
void RestartAnimation(uint16_t indexAnimation) void RestartAnimation(uint16_t indexAnimation)
{ {
if (indexAnimation >= _countAnimations || _animations[indexAnimation]._duration == 0) if (indexAnimation >= _countAnimations || _animations[indexAnimation]._duration == 0)

View File

@@ -108,6 +108,16 @@ void NeoPixelAnimator::StopAnimation(uint16_t indexAnimation)
} }
} }
void NeoPixelAnimator::StopAll()
{
for (uint16_t indexAnimation = 0; indexAnimation < _countAnimations; ++indexAnimation)
{
_animations[indexAnimation].StopAnimation();
}
_activeAnimations = 0;
}
void NeoPixelAnimator::UpdateAnimations() void NeoPixelAnimator::UpdateAnimations()
{ {
if (_isRunning) if (_isRunning)