Skip to content

Commit

Permalink
Fixed issues causing ESP to restart
Browse files Browse the repository at this point in the history
  • Loading branch information
styropyr0 committed Dec 15, 2024
1 parent 5723d82 commit 4fbc532
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 18 deletions.
24 changes: 8 additions & 16 deletions Drawable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ const char *Circle::type() const

Circle::~Circle()
{
if (this != nullptr)
delete this;
// delete this;
}

Rectangle::Rectangle(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t cornerRadius, uint8_t thickness)
Expand All @@ -39,8 +38,7 @@ const char *Rectangle::type() const

Rectangle::~Rectangle()
{
if (this != nullptr)
delete this;
// delete this;
}

Line::Line(uint8_t startX, uint8_t startY, uint8_t endX, uint8_t endY, uint8_t thickness)
Expand All @@ -58,8 +56,7 @@ const char *Line::type() const

Line::~Line()
{
if (this != nullptr)
delete this;
// delete this;
}

Bitmap::Bitmap(const uint8_t *dataSet, uint8_t x, uint8_t y, uint8_t width, uint8_t height)
Expand All @@ -77,8 +74,7 @@ const char *Bitmap::type() const

Bitmap::~Bitmap()
{
if (this != nullptr)
delete this;
// delete this;
}

Text::Text(String text, uint8_t x, uint8_t y)
Expand All @@ -96,8 +92,7 @@ const char *Text::type() const

Text::~Text()
{
if (this != nullptr)
delete this;
// delete this;
}

HighlightedText::HighlightedText(String text, uint8_t x, uint8_t y)
Expand All @@ -115,8 +110,7 @@ const char *HighlightedText::type() const

HighlightedText::~HighlightedText()
{
if (this != nullptr)
delete this;
// delete this;
}

AnimatedText::AnimatedText(String text, uint8_t x, uint8_t y, int delay, bool highlight)
Expand All @@ -134,8 +128,7 @@ const char *AnimatedText::type() const

AnimatedText::~AnimatedText()
{
if (this != nullptr)
delete this;
// delete this;
}

GridView::GridView(Drawable *drawable, uint8_t count, uint8_t countPerLine, uint8_t startX, uint8_t startY, uint8_t seperationX, uint8_t seperationY)
Expand Down Expand Up @@ -239,6 +232,5 @@ const char *GridView::type() const

GridView::~GridView()
{
if (this != nullptr)
delete this;
// delete this;
}
4 changes: 3 additions & 1 deletion Fragment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ void Fragment::add(Drawable *drawable)
for (int i = 0; i < drawableCount; ++i)
{
newDrawables[i] = drawables[i];
yield();
}
delete[] drawables;
if (drawables != nullptr)
delete[] drawables;
drawables = newDrawables;
}
drawables[drawableCount++] = drawable;
Expand Down
2 changes: 1 addition & 1 deletion Fragments.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ class Fragment
{
private:
FragmentManager &manager;
Drawable **drawables;
Drawable **drawables = nullptr;
uint8_t drawableCount;
uint8_t drawableCapacity;
uint8_t lastCount = 0;
Expand Down
1 change: 1 addition & 0 deletions SSD1306.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,7 @@ void OLED::circle(uint8_t centerX, uint8_t centerY, uint8_t radius, uint8_t thic
drawPixel(centerX - y, centerY + x);
drawPixel(centerX + y, centerY - x);
drawPixel(centerX - y, centerY - x);
yield();
}
radius--;
}
Expand Down

0 comments on commit 4fbc532

Please sign in to comment.