diff --git a/src/Animation/FireAnimation.cpp b/src/Animation/FireAnimation.cpp index 82129a5..7a441f6 100644 --- a/src/Animation/FireAnimation.cpp +++ b/src/Animation/FireAnimation.cpp @@ -94,6 +94,16 @@ void FireAnimation::loop(uint64_t frame) // pull energy from cell below std::uniform_int_distribution m_pullEnergyPctRNG(0, MAX_PULL_ENERGY_PCT); + // special energy removal handling of topmost row + for(std::size_t strip = 0; strip < nstrip; strip++) { + uint32_t &energy = m_energy[idx(strip,nled-1)]; + + uint32_t pulled_energy = m_pullEnergyPctRNG(m_gen) * energy / 100; + + energy -= pulled_energy; + } + + // normal rows for(std::size_t strip = 0; strip < nstrip; strip++) { for(std::size_t led = nled-1; led > 0; led--) { uint32_t &energy = m_energy[idx(strip,led)];