From e3fcd485f955d70ab0a9019abc67cbf33d020e9d Mon Sep 17 00:00:00 2001 From: Thomas Kolb Date: Thu, 27 Jul 2023 22:20:22 +0200 Subject: [PATCH] Latest ZAM changes --- src/Animation/AnimationController.cpp | 2 +- src/Animation/RacerAnimation.cpp | 9 +++++++-- src/main.cpp | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Animation/AnimationController.cpp b/src/Animation/AnimationController.cpp index d51b53c..7a727a5 100644 --- a/src/Animation/AnimationController.cpp +++ b/src/Animation/AnimationController.cpp @@ -87,7 +87,7 @@ void AnimationController::changeAnimation(AnimationController::DefaultAnimation break; case RACERS: - anim.reset(new RacerAnimation(m_fader, m_fader->strips() * m_fader->modules_per_strip() / 10)); + anim.reset(new RacerAnimation(m_fader, m_fader->strips() * m_fader->modules_per_strip() / 8)); break; default: diff --git a/src/Animation/RacerAnimation.cpp b/src/Animation/RacerAnimation.cpp index 8f8d399..f59a251 100644 --- a/src/Animation/RacerAnimation.cpp +++ b/src/Animation/RacerAnimation.cpp @@ -63,14 +63,19 @@ RacerAnimation::RacerAnimation(Fader *fader, uint32_t racer_count) std::uniform_int_distribution posRng(0, maxpos); std::uniform_int_distribution speedRng(-128, 128); std::uniform_int_distribution colorRng(0, 255); - std::uniform_int_distribution whiteRng(0, 64); + std::uniform_int_distribution whiteRng(0, 48); m_racers.reserve(racer_count); for(size_t i = 0; i < racer_count; i++) { + int32_t speed = speedRng(m_gen); + if(speed == 0) { + speed++; + } + m_racers.emplace_back(Racer{ fader, posRng(m_gen), - speedRng(m_gen), + speed, Fader::Color{ colorRng(m_gen), colorRng(m_gen), diff --git a/src/main.cpp b/src/main.cpp index 479f082..2c4cfc7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -239,7 +239,7 @@ static void ledFSM(void) } // change to last used animation after some time - if((millis() - stateEnteredTime) > 60000) { + if((millis() - stateEnteredTime) > 20000) { // FIXME: does not work with transition because of restart() call in ANIMATION state animController.changeAnimation(loadSavedAnimation(), false); ledState = ANIMATION;