diff --git a/src/effect_cycle.cpp b/src/effect_cycle.cpp index 5d56279..4167a96 100644 --- a/src/effect_cycle.cpp +++ b/src/effect_cycle.cpp @@ -2,13 +2,18 @@ void CycleEffect::changeEffect() { int new_id; - do { - new_id = random8(cycle_effects->size()); - } while (new_id == effect_id); - LOG("CycleEffect * Changing effect to #"); LOGln(new_id); + if (EFFECT_CYCLE_RANDOM) { + do { + new_id = random8(cycle_effects->size()); + } while (new_id == effect_id); + } else { + new_id = (effect_id + 1) % cycle_effects->size(); + } + LOG("CycleEffect * Changing effect from #"); LOG(effect_id); LOG(" to #"); LOGln(new_id); if (effect) effect->stop(); effect = cycle_effects->get(new_id); effect->start(); + effect_id = new_id; effectSince = millis(); }