Skip to content

Commit

Permalink
2023.9.1: Added check for array existence
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewjswan committed Oct 29, 2023
1 parent 144a5bc commit 00eadf0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion components/ehmtxv2/EHMTX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -778,12 +778,12 @@ namespace esphome
t->process(this->queue[i]->icon_name, infotext);
}
}
this->queue[i]->mode = MODE_EMPTY;
if (this->queue[i]->sbitmap != NULL)
{
delete [] this->queue[i]->sbitmap;
this->queue[i]->sbitmap = nullptr;
}
this->queue[i]->mode = MODE_EMPTY;
}
}
}
Expand Down
27 changes: 15 additions & 12 deletions components/ehmtxv2/EHMTX_queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,25 +299,28 @@ namespace esphome
this->config_->display->print(this->xpos() + xoffset, yoffset, font, color_, esphome::display::TextAlign::BASELINE_LEFT,
this->text.c_str());
#endif
if (this->config_->display_gauge)
if (this->sbitmap != NULL)
{
this->config_->display->line(10, 0, 10, 7, esphome::display::COLOR_OFF);
for (uint8_t x = 0; x < 8; x++)
if (this->config_->display_gauge)
{
for (uint8_t y = 0; y < 8; y++)
this->config_->display->line(10, 0, 10, 7, esphome::display::COLOR_OFF);
for (uint8_t x = 0; x < 8; x++)
{
this->config_->display->draw_pixel_at(x + 2, y, this->sbitmap[x + y * 8]);
for (uint8_t y = 0; y < 8; y++)
{
this->config_->display->draw_pixel_at(x + 2, y, this->sbitmap[x + y * 8]);
}
}
}
}
else
{
this->config_->display->line(8, 0, 8, 7, esphome::display::COLOR_OFF);
for (uint8_t x = 0; x < 8; x++)
else
{
for (uint8_t y = 0; y < 8; y++)
this->config_->display->line(8, 0, 8, 7, esphome::display::COLOR_OFF);
for (uint8_t x = 0; x < 8; x++)
{
this->config_->display->draw_pixel_at(x, y, this->sbitmap[x + y * 8]);
for (uint8_t y = 0; y < 8; y++)
{
this->config_->display->draw_pixel_at(x, y, this->sbitmap[x + y * 8]);
}
}
}
}
Expand Down

0 comments on commit 00eadf0

Please sign in to comment.