Skip to content

Commit

Permalink
Merge branch '2023.9.1' into 2023.9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
lubeda authored Oct 11, 2023
2 parents 2eb4cba + b461ec1 commit 16cd804
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@
- Added icon and date output screen
- `icon_date(iconname, lifetime, screen_time, default_font, r, g, b)`
- If pass a screen identifier with the value `[day, weekday]` like `icon_name|day`, and a backing icon to `icon_clock` or `icon_date`, it will display text.
- New YAML option `weekdays: "SUMOTUWETHFRSA"` and new function to customize the info text over the icon:
- New YAML option `weekdays: "SUMOTUWETHFRSA"` (**7 or 14** characters) and new function to customize the info text over the icon:
- `set_infotext_color(200,100,100,100,100,200,false,2);`
- `set_infotext_color("left_r", "left_g", "left_b", "right_r", "right_g", "right_b", "default_font", "y_offset");`
- `weekdays` - the order of the days of the week, from Sunday to Saturday.
- Example for **weekdays**:
- `weekdays: "일월화수목금토"`
- `weekdays: "НДПНВТСРЧТПТСБ"`
- Added a screen with the ability to display a progress bar, progress value `(-100..100)`
- `icon_screen_progress(iconname, text, progress, lifetime, screen_time, default_font, r, g, b)`
- Added `replace_time_date_to:` and `replace_time_date_from:` which allow replacing the system date & time text (anything!)
Expand Down Expand Up @@ -659,6 +662,13 @@ ehmtxv2:

**week_start_monday** (optional, bool): default Monday is first day of week, false => Sunday

**weekdays** (optional, string, default: "SUMOTUWETHFRSA"): Abbreviations of the days of the week, starting from Sunday, from *7 to 14* characters.

Example:
- `weekdays: "SUMOTUWETHFRSA"`
- `weekdays: "일월화수목금토"`
- `weekdays: "НДПНВТСРЧТПТСБ"`
**scroll_interval** (optional, ms): the interval in ms to scroll the text (default=80), should be a multiple of the ```update_interval``` of the [display](https://esphome.io/components/display/addressable_light.html)

**clock_interval** (optional, s): the interval in seconds to force the clock display. By default, the clock screen, if any, will be displayed according to the position in the queue. **If you set the clock_interval close to the screen_time of the clock, you will only see the clock!** (default=0)
Expand Down Expand Up @@ -1098,6 +1108,7 @@ A common format for specifying output options: `icon|mode#draw_mode`
- 2 - Left to center, Right to edge
- 3 - To the center, the left one is a pixel higher
- 4 - To the center, the right one is a pixel higher
- 5 - To the center, without leading 0 (**only for day**)

https://github.com/lubeda/EspHoMaTriXv2/issues/92#issuecomment-1750184472

Expand Down
14 changes: 12 additions & 2 deletions components/ehmtxv2/EHMTX_queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,8 @@ namespace esphome
case 3:
// To the center, the right one is a pixel higher.
case 4:
// To the center, without leading 0
case 5:
x_left = (l_width < 5) ? 5 - l_width : 0;
x_right = 4;
break;
Expand All @@ -450,8 +452,16 @@ namespace esphome
x_right = x_right - r_width;
break;
}
this->config_->display->printf(x_left, yoffset + this->config_->info_y_offset - (mode != 3 ? 0 : 1), info_font, this->config_->info_lcolor, display::TextAlign::BASELINE_LEFT, "%d", d / 10 % 10);
this->config_->display->printf(x_right, yoffset + this->config_->info_y_offset - (mode != 4 ? 0 : 1), info_font, this->config_->info_rcolor, display::TextAlign::BASELINE_LEFT, "%d", d % 10);
if (mode == 5 && (d < 10))
{
x_right = 4 - (r_width - 1) / 2;
this->config_->display->printf(x_right, yoffset + this->config_->info_y_offset, info_font, this->config_->info_rcolor, display::TextAlign::BASELINE_LEFT, "%d", d % 10);
}
else
{
this->config_->display->printf(x_left, yoffset + this->config_->info_y_offset - (mode != 3 ? 0 : 1), info_font, this->config_->info_lcolor, display::TextAlign::BASELINE_LEFT, "%d", d / 10 % 10);
this->config_->display->printf(x_right, yoffset + this->config_->info_y_offset - (mode != 4 ? 0 : 1), info_font, this->config_->info_rcolor, display::TextAlign::BASELINE_LEFT, "%d", d % 10);
}
}
else // if (this->icon_name.rfind("weekday", 0) == 0)
{
Expand Down

0 comments on commit 16cd804

Please sign in to comment.