Latest ZAM changes

This commit is contained in:
Thomas Kolb 2023-07-27 22:20:22 +02:00
parent c9471331d3
commit e3fcd485f9
3 changed files with 9 additions and 4 deletions

View file

@ -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:

View file

@ -63,14 +63,19 @@ RacerAnimation::RacerAnimation(Fader *fader, uint32_t racer_count)
std::uniform_int_distribution<int32_t> posRng(0, maxpos);
std::uniform_int_distribution<int32_t> speedRng(-128, 128);
std::uniform_int_distribution<int16_t> colorRng(0, 255);
std::uniform_int_distribution<int16_t> whiteRng(0, 64);
std::uniform_int_distribution<int16_t> 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),

View file

@ -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;