Skip to content

Commit

Permalink
Merge pull request #30 from andrewjswan/2023.9.1-Move_icon_text_to_ri…
Browse files Browse the repository at this point in the history
…ght_in_Icon_to_9_mode_3

2023.9.1: Move icon text to right in icon to 9 mode 3
  • Loading branch information
andrewjswan authored Dec 26, 2023
2 parents 9cb459a + b49f433 commit dd5e2ff
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions components/ehmtxv2/EHMTX_queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ namespace esphome
if (this->mode == MODE_ICON_CLOCK)
{
#ifdef EHMTXv2_ADV_CLOCK
if (!this->config_->draw_clock(EHMTXv2_TIME_FORMAT, font, color_, xoffset + 20, this->ypos() + yoffset))
if (!this->config_->draw_clock(EHMTXv2_TIME_FORMAT, font, color_, xoffset + offset, this->ypos() + yoffset))
{
#endif
if (this->config_->replace_time_date_active) // check for replace active
Expand Down Expand Up @@ -768,7 +768,14 @@ namespace esphome
}
if (mode == 5 && (d < 10))
{
x_right = 4 - (r_width - 1) / 2;
if (this->config_->icon_to_9 == 3)
{
x_right = 5 - (r_width - 1) / 2;
}
else
{
x_right = 4 - (r_width - 1) / 2;
}
this->config_->display->printf(x_right, this->ypos() + yoffset + i_y_offset, info_font, i_rcolor, display::TextAlign::BASELINE_LEFT, "%d", d % 10);
}
else
Expand Down Expand Up @@ -820,7 +827,14 @@ namespace esphome

// The symbol consists of a visible part, and an empty area to the right with a width of one point.
uint8_t c_width = this->config_->GetTextWidth(info_font, "%s", weekday.c_str());
x_left = 4 - (c_width - 1) / 2;
if (this->config_->icon_to_9 == 3)
{
x_left = 5 - (c_width - 1) / 2;
}
else
{
x_left = 4 - (c_width - 1) / 2;
}
this->config_->display->printf(x_left, this->ypos() + yoffset + i_y_offset, info_font, i_lcolor, display::TextAlign::BASELINE_LEFT, "%s", weekday.c_str());
}
}
Expand Down

0 comments on commit dd5e2ff

Please sign in to comment.