Skip to content

Commit

Permalink
add clipping
Browse files Browse the repository at this point in the history
  • Loading branch information
lubeda committed Nov 28, 2024
1 parent 9ba2850 commit 33d49ae
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions components/ehmtxv2/EHMTX_queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,7 @@ namespace esphome
case MODE_RAINBOW_ICON:
case MODE_ICON_PROGRESS:
case MODE_PROGNOSIS_SCREEN:
this->config_->display->start_clipping(8,0,31,7);
color_ = (this->mode == MODE_RAINBOW_ICON || this->mode == MODE_RAINBOW_ALERT_SCREEN) ? this->config_->rainbow_color : this->text_color;
#ifdef EHMTXv2_USE_RTL
this->config_->display->print(this->xpos() + xoffset, this->ypos() + yoffset, font, color_, esphome::display::TextAlign::BASELINE_RIGHT,
Expand All @@ -898,6 +899,8 @@ namespace esphome
this->config_->display->print(this->xpos() + xoffset, this->ypos() + yoffset, font, color_, esphome::display::TextAlign::BASELINE_LEFT,
this->text.c_str());
#endif
this->config_->display->start_clipping(0,0,0,0);

if (this->mode == MODE_ICON_PROGRESS)
{
if (this->icon != BLANKICON)
Expand Down Expand Up @@ -1003,6 +1006,7 @@ namespace esphome
}
}
}

break;

case MODE_TEXT_PROGRESS:
Expand Down Expand Up @@ -1033,6 +1037,7 @@ namespace esphome

case MODE_ICON_TEXT_SCREEN:
case MODE_RAINBOW_ICON_TEXT_SCREEN:
this->config_->display->start_clipping(8,0,31,7);
color_ = (this->mode == MODE_RAINBOW_ICON_TEXT_SCREEN) ? this->config_->rainbow_color : this->text_color;
#ifdef EHMTXv2_USE_RTL
this->config_->display->print(this->xpos() + xoffset, this->ypos() + yoffset, font, color_, esphome::display::TextAlign::BASELINE_RIGHT,
Expand All @@ -1046,6 +1051,7 @@ namespace esphome
this->config_->display->print(this->xpos() + xoffset, this->ypos() + yoffset, font, color_, esphome::display::TextAlign::BASELINE_LEFT,
this->text.c_str());
#endif
this->config_->display->start_clipping(0,0,0,0);
if (this->icon != BLANKICON)
{
int x = 0;
Expand Down

0 comments on commit 33d49ae

Please sign in to comment.