Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 0 additions & 134 deletions build_all.sh

This file was deleted.

1 change: 0 additions & 1 deletion build_results.csv

This file was deleted.

2 changes: 1 addition & 1 deletion include/effects/matrix/PatternAnimatedGIF.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class PatternAnimatedGIF : public LEDStripEffect
static void screenClearCallback(void)
{
auto& g = *(g_ptrSystem->EffectManager().g());
g.fillScreen(g.to16bit(g_gifDecoderState._bkColor));
g.Clear(g_gifDecoderState._bkColor);
}

// We decide when to update the screen, so this is a no-op
Expand Down
13 changes: 7 additions & 6 deletions include/effects/strip/fireeffect.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "musiceffect.h"
#include "soundanalyzer.h"
#include "systemcontainer.h"
#include <numeric>

class FireEffect : public LEDStripEffect
{
Expand Down Expand Up @@ -181,9 +182,9 @@ class FireEffect : public LEDStripEffect

for (int i = 0; i < LEDCount; i++)
{
auto sum = 0;
for (int j = 0; j < CellsPerLED; j++)
sum += heat[i*CellsPerLED + j];
auto begin = &heat[i * CellsPerLED];
auto end = begin + CellsPerLED;
int sum = std::accumulate(begin, end, 0);
auto avg = sum / CellsPerLED;

#if LANTERN
Expand Down Expand Up @@ -760,9 +761,9 @@ class BaseFireEffect : public LEDStripEffect
int cellsPerLED = CellCount / LEDCount;
for (int i = 0; i < LEDCount; i++)
{
int sum = 0;
for (int iCell = 0; iCell < cellsPerLED; iCell++)
sum += heat[i * cellsPerLED + iCell];
auto begin = &heat[i * cellsPerLED];
auto end = begin + cellsPerLED;
int sum = std::accumulate(begin, end, 0);
int avg = sum / cellsPerLED;
CRGB color = MapHeatToColor(heat[avg]);
int j = bReversed ? (LEDCount - 1 - i) : i;
Expand Down
40 changes: 23 additions & 17 deletions include/effects/strip/meteoreffect.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

#pragma once

#include "ledstripeffect.h"

class MeteorChannel
{
std::vector<float> hue;
Expand Down Expand Up @@ -98,19 +100,19 @@ class MeteorChannel
bLeft[iMeteor] = !bLeft[iMeteor];
}

virtual void Draw(std::shared_ptr<GFXBase> pGFX)
virtual void Draw(LEDStripEffect* owner)
{
auto pGFX = owner->g(0);
static CHSV hsv;
hsv.val = 255;
hsv.sat = 255;

for (int j = 0; j<pGFX->GetLEDCount(); j++) // fade brightness all LEDs one step
// Fade brightness on all channels
for (int j = 0; j < pGFX->GetLEDCount(); j++)
{
if ((!meteorRandomDecay) || (random_range(0, 10)>2)) // BUGBUG Was 5 for everything before atomlight
if ((!meteorRandomDecay) || (random_range(0, 10) > 2))
{
CRGB c = pGFX->getPixel(j);
c.fadeToBlackBy(meteorTrailDecay);
pGFX->setPixel(j, c);
owner->fadePixelToBlackOnAllChannelsBy(j, meteorTrailDecay);
}
}

Expand All @@ -123,32 +125,35 @@ class MeteorChannel
spd *= g_Analyzer.VURatio();
#endif

iPos[i] = (bLeft[i]) ? iPos[i]-spd : iPos[i]+spd;
if (iPos[i]< meteorSize)
iPos[i] = (bLeft[i]) ? iPos[i] - spd : iPos[i] + spd;
if (iPos[i] < meteorSize)
{
bLeft[i] = false;
iPos[i] = meteorSize;
}
if (iPos[i] >= pGFX->GetLEDCount())
{
bLeft[i] = true;
iPos[i] = pGFX->GetLEDCount()-1;
iPos[i] = pGFX->GetLEDCount() - 1;
}

for (int j = 0; j < meteorSize; j++) // Draw the meteor head
// Draw the meteor head across all channels
for (int j = 0; j < meteorSize; j++)
{
int x = iPos[i] - j;
if ((x <= pGFX->GetLEDCount()) && (x >= 1))
int x = static_cast<int>(iPos[i]) - j;
if ((x <= static_cast<int>(pGFX->GetLEDCount())) && (x >= 1))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I wonder if this is worth hoisting outside the loop, but we have so much CPU left. Over on our strip effects,. IDC

{
CRGB rgb;
hue[i] = hue[i] + 0.025f;
if (hue[i] > 255.0f)
hue[i] -= 255.0f;
hsv.hue = hue[i];
hsv.hue = static_cast<uint8_t>(hue[i]);
hsv2rgb_rainbow(hsv, rgb);

// Blend with current pixel from primary device, then set on all channels
CRGB c = pGFX->getPixel(x);
nblend(c, rgb , 75);
pGFX->setPixel(x, c);
nblend(c, rgb, 75);
owner->setPixelOnAllChannels(x, c);
}
}
}
Expand Down Expand Up @@ -223,7 +228,8 @@ class MeteorEffect : public LEDStripEffect

void Draw() override
{
for (int i = 0; i < _Meteors.size(); i++)
_Meteors[i].Draw(_GFX[i]);
// Draw once using channel 0 state while writing to all channels
if (!_Meteors.empty())
_Meteors[0].Draw(this);
}
};
Loading