Some memory leaks fixed.
This commit is contained in:
parent
9eeb4b50fd
commit
0163bbef6c
@ -10,6 +10,7 @@ private:
|
||||
Window* window = new Window(0, LED_HEIGHT - 6, LED_WIDTH, 6);
|
||||
|
||||
public:
|
||||
~ClockEffect();
|
||||
void loop();
|
||||
void loop(boolean invert, CRGB fg_color, CRGB bg_color);
|
||||
};
|
||||
|
@ -17,6 +17,7 @@ private:
|
||||
bool is_direction_okay(uint8_t direction);
|
||||
public:
|
||||
SnakeEffect();
|
||||
~SnakeEffect();
|
||||
void loop();
|
||||
boolean valid_position(Coords c);
|
||||
Coords update_position(Coords c, uint8_t direction);
|
||||
|
@ -40,3 +40,7 @@ void ClockEffect::loop(boolean invert, CRGB fg_color, CRGB bg_color) {
|
||||
window->setPixel(7, 4, &fg_color);
|
||||
}
|
||||
}
|
||||
|
||||
ClockEffect::~ClockEffect() {
|
||||
delete window;
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ void GolEffect::_initialize() {
|
||||
GolEffect::~GolEffect() {
|
||||
delete[] _data;
|
||||
delete[] _old;
|
||||
delete window;
|
||||
}
|
||||
|
||||
void GolEffect::loop() {
|
||||
|
@ -10,6 +10,7 @@ PixelClockEffect::PixelClockEffect() {
|
||||
PixelClockEffect::~PixelClockEffect() {
|
||||
delete _color_seconds;
|
||||
delete _color_minutes;
|
||||
delete window;
|
||||
}
|
||||
|
||||
void PixelClockEffect::loop() {
|
||||
|
@ -6,6 +6,10 @@ SnakeEffect::SnakeEffect() {
|
||||
this->window = new Window(0, 0, LED_WIDTH, LED_HEIGHT-6);
|
||||
}
|
||||
|
||||
SnakeEffect::~SnakeEffect() {
|
||||
delete window;
|
||||
}
|
||||
|
||||
void SnakeEffect::loop() {
|
||||
if (run++ % EFFECT_SNAKE_SLOWDOWN == 0) { // Change the coordinates only on every n-th run.
|
||||
if (random8(EFFECT_SNAKE_DIRECTION_CHANGE)==0 || is_turn_needed()) turn_random();
|
||||
|
Loading…
Reference in New Issue
Block a user