Skip to content

Commit 5f337a2

Browse files
authored
Merge pull request #65 from lubeda/develop
Develop to main for release
2 parents 781198d + ce349d2 commit 5f337a2

25 files changed

+333
-60
lines changed

.github/workflows/main.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ jobs:
2424
- file: tests/ehtmxv2-special.yaml
2525
name: EHMTX template 8266
2626
manifest_filename: ehtmxv2-special-template-manifest.json
27+
devfirmware:
28+
- file: tests/ulanzi-easy.yaml
29+
name: Ulanzi-Easy
30+
manifest_filename: ulanzi-easy-manifest.json
2731
fail-fast: false
2832
steps:
2933
- name: Checkout source code
@@ -34,3 +38,9 @@ jobs:
3438
with:
3539
yaml_file: ${{ matrix.firmware.file }}
3640
version: latest
41+
# - name: Build firmware with beta
42+
# uses: esphome/build-action@v1.8.0
43+
# id: esphome-build-beta
44+
# with:
45+
# yaml_file: ${{ matrix.firmware.file }}
46+
# version: beta

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## 2023.7.0
4+
5+
- added always_show_rl_indicators boolean
6+
- added on_start_running trigger to allow for additional configuration when
7+
matrix starts display
8+
- icontype rgb565 array as string
9+
- fixed scroll small text
10+
- introduced mateine.ttf and mateineThin.ttf from @dbuezas [samples](https://github.com/lubeda/EspHoMaTriXv2/issues/63)
11+
- fixed hold_screen [issue](https://github.com/lubeda/EspHoMaTriXv2/issues/58)
12+
313
## 2023.6.5
414

515
- introduced `blend_steps: 16`

README.md

Lines changed: 53 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,31 @@
11
# EspHoMaTriX version 2 (EHMTXv2)
22

3-
## Warning
3+
[donation-badge]:https://img.shields.io/badge/PayPal-00457C?style=for-the-badge&logo=paypal&logoColor=white
4+
[donation-url]: https://www.paypal.com/donate/?hosted_button_id=FZDKSLQ46HJTU
45

5-
Sorry but there this modules is highly dependend from the esphome releases. You can expect that some breaking changes in esphome breaks my code. So This version of EspHoMaTriX is working from esphome **2023.7.0** upwards (hopefully).
6+
![Home Assistant](https://img.shields.io/badge/home%20assistant-%2341BDF5.svg?style=for-the-badge&logo=home-assistant&logoColor=white)
7+
![GitHub](https://img.shields.io/badge/github-%23121011.svg?style=for-the-badge&logo=github&logoColor=white)
8+
[![Donate][donation-badge]][donation-url]
9+
10+
## Attention
11+
12+
Some updates of esphome will interfere with EspHoMaTriXv2, like the update of esphome to 2023.7.0. It made a change to all YAML files neccessary.
13+
14+
You have to add this to your YAML
15+
16+
```yaml
17+
image:
18+
- file: 1pixel.gif
19+
id: breaking20237
20+
21+
animation:
22+
- file: 1pixel.gif
23+
id: breaking20237
24+
```
25+
26+
You have also to copy the file 1pixel.gif from the copy2esphome folder to the directory with your yaml.
27+
28+
Also there might be [breaking changes](#breaking-changes) due to a redesign of EspHoMaTriXv2.
629
730
## Important information
831
@@ -56,7 +79,7 @@ In easy mode you'll have a clock with auto brightness control and after step 3 y
5679
Copy these files from the source folder `copy2esphome`:
5780

5881
- ulanzi-simple.yaml
59-
- EHMTXv2.ttf
82+
- mateine.ttf
6083

6184
to your esphome directory (usually /config/esphome). In your esphome dashboard, you will find a new device named `ulanzi-easy`.
6285

@@ -426,11 +449,11 @@ You can configure two fonts if you like.
426449

427450
Trip5 is also providing special fonts for 8x32 matrices in his [repo](https://github.com/trip5/MatrixClockFonts)
428451

429-
For Europeans starters, you can use the font EHMTXv2.ttf of the copy2esphome folder.
452+
dbuezas has also contributed tow optimized fonts with umlauts for this kind of display `mateine.ttf` and `mateineThin.ttf`. They are included in the copy2esphome folder
430453

431454
```yaml
432455
font:
433-
  - file: EHMTXv2.ttf
456+
  - file: mateine.ttf
434457
    id: default_font
435458
    size: 16
436459
    glyphs:  |
@@ -557,8 +580,18 @@ ehmtxv2:
557580

558581
**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)
559582

583+
**boot_logo** (optional, string , only on ESP32): Display a fullscreen logo defined as rgb565 array.
584+
585+
```yaml
586+
boot_logo: "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63519,63519,63519,63519,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63519,0,0,0,0,2016,0,0,0,0,0,0,0,0,0,0,31,0,0,0,0,0,0,0,0,0,63488,0,63488,0,0,0,63519,0,0,0,0,2016,2016,0,0,0,65514,0,65514,0,0,0,31,0,0,0,64512,0,0,64512,0,63488,63488,0,63488,63488,0,0,63519,63519,63519,0,0,2016,0,2016,0,65514,0,65514,0,65514,0,31,31,31,0,0,0,64512,64512,0,0,63488,63488,63488,63488,63488,0,0,63519,0,0,0,0,2016,0,2016,0,65514,0,65514,0,65514,0,0,31,0,0,0,0,64512,64512,0,0,0,63488,63488,63488,0,0,0,63519,63519,63519,63519,0,2016,0,2016,0,65514,0,65514,0,65514,0,0,0,31,31,0,64512,0,0,64512,0,0,0,63488,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]"
587+
```
588+
589+
If defined you can use the services `display_boot_logo` and `display_version` to display the defined logo or the version of ehmtx.
590+
560591
**icons2html** (optional, boolean): If true, generate the HTML-file (*filename*.html) to show all included icons.  (default = `false`)
561592

593+
**always_show_rl_indicators** (optional, boolean): If true, always show the r/l indicators on all screens. Default is to not show either on clock, date, full, and bitmap screens, left on icon, or if display gauge displayed. (default = `false`)
594+
562595
***Example output:***
563596
![icon preview](./images/icons_preview.png)
564597

@@ -602,7 +635,6 @@ Numerous features are accessible with services from home assistant and lambdas t
602635
|`show_gauge"`|"percent", "r", "g", "b"|set the height of the gauge according to the percentage in the given color|
603636
|`show_alarm`|"r", "g", "b", "size"|shows the color with the given size in the upper-right corner|
604637
|`show_rindicator`|"r", "g", "b", "size"|shows the color with the given size in the lower-right corner|
605-
|`set_clock_color`|"r", "g", "b"|set the default color for the clock/date display|
606638
|`set_today_color`|"r", "g", "b"|set the special color for today in the day of week line|
607639
|`set_weekday_color`|"r", "g", "b"|set the default color in the day of week line|
608640
|`del_screen`|"icon_name", “mode”|deletes the specified icon screen from the queue, the [mode](#modes) is a filter|
@@ -700,6 +732,10 @@ ehmtxv2:
700732
            - mode
701733
```
702734

735+
#### on_start_running
736+
737+
The trigger ```on_start_running``` is triggered when the display starts. It is triggered when time sync is done, and initial clock / date / version screens are loaded. This is to allow you to customize the default screens (for instance set colours for the clock).
738+
703739
#### on_icon_error
704740

705741
The trigger ```on_icon_error``` is triggered if you try to add a screen with a non defined icon. In lambda's you can use one local string variable:
@@ -822,6 +858,8 @@ For example, if you have multiple icons named weather_sunny, weather_rain & weat
822858
|MODE_RAINBOW_TEXT|8|
823859
|MODE_RAINBOW_CLOCK| 9|
824860
|MODE_RAINBOW_DATE| 10|
861+
|MODE_BITMAP_SCREEN| 11|
862+
|MODE_BITMAP_SMALL| 12|
825863

826864
**(D)** Service **display_on** / **display_off**
827865

@@ -866,7 +904,7 @@ binary_sensor:
866904

867905
Service **hold_screen**
868906

869-
Displays the current screen for a configured amount (see **hold_time**) (default=30) seconds longer.
907+
Displays the current screen for a configured amount (default=30) seconds longer.
870908

871909
e.g., on the Ulanzi TC001
872910

@@ -1074,6 +1112,11 @@ sensor:
10741112

10751113
## Breaking changes
10761114

1115+
### 2023.7.0
1116+
1117+
- removed automatic boot logo display
1118+
- removed set_clock_color since clock_screen and date_screen will set color anyway
1119+
10771120
### 2023.6.3
10781121

10791122
**Due to this change these values are fixed, e.g. you can not change the date or timeformat during runtime anymore!!**
@@ -1113,6 +1156,8 @@ THE SOFTWARE IS PROVIDED “AS IS”, use at your own risk!
11131156
## Thanks
11141157

11151158
- **[blakadder](https://github.com/blakadder)** for his contribution (cleanup README.md, fixed sample)
1159+
- **[dbuezas](https://github.com/dbuezas)** for his fonts [infos](https://github.com/lubeda/EspHoMaTriXv2/issues/63)
1160+
- **[jfurtner](https://github.com/jfurtner)** for his the on_start_running trigger and a new parameter
11161161
- **[andrew-codechimp](https://github.com/andrew-codechimp)** for his contribution (display on/off & del_screen "*" & show_clock with 0) and improved blueprint slelection
11171162
- **[jd1](https://github.com/jd1)** for his contributions
11181163
- **[aptonline](https://github.com/aptonline)** for his work on the Ulanzi hardware
@@ -1123,6 +1168,7 @@ THE SOFTWARE IS PROVIDED “AS IS”, use at your own risk!
11231168
- **[dennisse](https://github.com/dennisse)** Auto brightness for the Ulanzi
11241169
- **[hco](https://github.com/hco)** fixing documentation
11251170
- **[geekofweek](https://github.com/geekofweek)** fixed sample YAML, cleanup documentation
1171+
- **[joncar](https://github.com/joncar)** fixed scroll small text
11261172
- **Everybody** who found bugs/issues and reported them!
11271173

11281174
## Special thanks to all sponsors

components/ehmtxv2/EHMTX.cpp

Lines changed: 48 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,11 @@ namespace esphome
1111
this->display_lindicator = 0;
1212
this->display_alarm = 0;
1313
this->clock_time = 10;
14-
this->hold_time = 10;
1514
this->icon_count = 0;
1615
this->hue_ = 0;
1716
this->text_color = Color(C_RED, C_GREEN, C_BLUE);
1817
this->today_color = Color(C_RED, C_GREEN, C_BLUE);
1918
this->weekday_color = Color(CD_RED, CD_GREEN, CD_BLUE);
20-
this->clock_color = Color(C_RED, C_GREEN, C_BLUE);
2119
this->rainbow_color = Color(CA_RED, CA_GREEN, CA_BLUE);
2220
this->alarm_color = Color(CA_RED, CA_GREEN, CA_BLUE);
2321
this->next_action_time = 0;
@@ -96,12 +94,6 @@ namespace esphome
9694
ESP_LOGD(TAG, "default weekday color: %d g: %d b: %d", r, g, b);
9795
}
9896

99-
void EHMTX::set_clock_color(int r, int g, int b)
100-
{
101-
this->clock_color = Color((uint8_t)r & 248, (uint8_t)g & 252, (uint8_t)b & 248);
102-
ESP_LOGD(TAG, "default clock color r: %d g: %d b: %d", r, g, b);
103-
}
104-
10597
bool EHMTX::string_has_ending(std::string const &fullString, std::string const &ending)
10698
{
10799
if (fullString.length() >= ending.length())
@@ -329,7 +321,6 @@ namespace esphome
329321
register_service(&EHMTX::show_rindicator, "show_rindicator", {"r", "g", "b", "size"});
330322
register_service(&EHMTX::show_lindicator, "show_lindicator", {"r", "g", "b", "size"});
331323

332-
register_service(&EHMTX::set_clock_color, "set_clock_color", {"r", "g", "b"});
333324
register_service(&EHMTX::set_today_color, "set_today_color", {"r", "g", "b"});
334325
register_service(&EHMTX::set_weekday_color, "set_weekday_color", {"r", "g", "b"});
335326

@@ -354,6 +345,10 @@ namespace esphome
354345

355346
register_service(&EHMTX::set_brightness, "brightness", {"value"});
356347
#ifndef USE_ESP8266
348+
#ifdef EHMTXv2_BOOTLOGO
349+
register_service(&EHMTX::display_boot_logo, "display_boot_logo");
350+
register_service(&EHMTX::display_version, "display_version");
351+
#endif
357352
register_service(&EHMTX::color_gauge, "color_gauge", {"colors"});
358353
register_service(&EHMTX::bitmap_screen, "bitmap_screen", {"icon", "lifetime", "screen_time"});
359354
register_service(&EHMTX::bitmap_small, "bitmap_small", {"icon", "text", "lifetime", "screen_time", "default_font", "r", "g", "b"});
@@ -376,6 +371,18 @@ namespace esphome
376371
}
377372
}
378373

374+
#ifndef USE_ESP8266
375+
#ifdef EHMTXv2_BOOTLOGO
376+
void EHMTX::display_boot_logo() {
377+
this->bitmap_screen(EHMTXv2_BOOTLOGO, 1, 10);
378+
}
379+
void EHMTX::display_version() {
380+
this->bitmap_small("[2016,0,0,0,2016,0,0,0,2016,0,0,0,2016,0,0,0,2016,0,0,0,2016,0,0,0,0,2016,0,2016,0,31,31,0,0,0,2016,0,31,0,0,31,0,0,0,0,0,0,31,0,0,0,0,0,0,31,0,0,0,0,0,0,31,31,31,31]", EHMTX_VERSION, 1, 10);
381+
}
382+
383+
#endif
384+
#endif
385+
379386
void EHMTX::hide_alarm()
380387
{
381388
this->display_alarm = 0;
@@ -398,12 +405,18 @@ namespace esphome
398405
{
399406
ESP_LOGD(TAG, "time sync => start running");
400407
#ifndef USE_ESP8266
401-
this->bitmap_screen(EHMTX_LOGO, 1, 10);
402-
this->bitmap_small(EHMTX_SLOGO, EHMTX_VERSION, 1, 10);
408+
#ifdef EHMTXv2_BOOTLOGO
409+
this->bitmap_screen(EHMTXv2_BOOTLOGO, 1, 10);
410+
#endif
403411
#endif
404412
this->clock_screen(14 * 24 * 60, this->clock_time, EHMTXv2_DEFAULT_CLOCK_FONT, C_RED, C_GREEN, C_BLUE);
405413
this->date_screen(14 * 24 * 60, (int)this->clock_time / 2, EHMTXv2_DEFAULT_CLOCK_FONT, C_RED, C_GREEN, C_BLUE);
406414
this->is_running = true;
415+
for (auto *t : on_start_running_triggers_)
416+
{
417+
ESP_LOGD(TAG, "on_start_running_triggers");
418+
t->process();
419+
}
407420
}
408421
}
409422
else
@@ -545,7 +558,7 @@ namespace esphome
545558
float red, green, blue;
546559
esphome::hsv_to_rgb(this->hue_, 0.8, 0.8, red, green, blue);
547560
this->rainbow_color = Color(uint8_t(255 * red), uint8_t(255 * green), uint8_t(255 * blue));
548-
561+
549562
if (this->is_running && this->clock->now().is_valid())
550563
{
551564
time_t ts = this->clock->now().timestamp;
@@ -608,16 +621,16 @@ namespace esphome
608621
}
609622
}
610623
// blend handling
611-
624+
612625
#ifdef EHMTXv2_BLEND_STEPS
613-
if (this->ticks_ <= EHMTXv2_BLEND_STEPS)
626+
if ((this->ticks_ <= EHMTXv2_BLEND_STEPS))
614627
{
615-
uint8_t b = this->brightness_;
616-
float br = lerp((float)this->ticks_ / EHMTXv2_BLEND_STEPS, 0, (float)b / 255);
617-
this->display->get_light()->set_correction(br, br, br);
628+
uint8_t b = this->brightness_;
629+
float br = lerp((float)this->ticks_ / EHMTXv2_BLEND_STEPS, 0, (float)b / 255);
630+
this->display->get_light()->set_correction(br, br, br);
618631
}
619632
#endif
620-
this->ticks_++;
633+
this->ticks_++;
621634
}
622635
else
623636
{
@@ -634,8 +647,7 @@ namespace esphome
634647

635648
void EHMTX::hold_screen(int time)
636649
{
637-
this->next_action_time += this->hold_time;
638-
this->hold_time = time;
650+
this->next_action_time = this->clock->now().timestamp + time;
639651
}
640652

641653
void EHMTX::get_status()
@@ -877,7 +889,6 @@ namespace esphome
877889
void EHMTX::clock_screen(int lifetime, int screen_time, bool default_font, int r, int g, int b)
878890
{
879891
EHMTX_queue *screen = this->find_free_queue_element();
880-
881892
screen->text_color = Color(r, g, b);
882893
ESP_LOGD(TAG, "clock_screen_color lifetime: %d screen_time: %d red: %d green: %d blue: %d", lifetime, screen_time, r, g, b);
883894
screen->mode = MODE_CLOCK;
@@ -1046,6 +1057,9 @@ namespace esphome
10461057
}
10471058
#ifdef EHMTXv2_USE_RTL
10481059
ESP_LOGCONFIG(TAG, "RTL activated");
1060+
#endif
1061+
#ifdef EHMTXv2_BLEND_STEPS
1062+
ESP_LOGCONFIG(TAG, "Fade in activated: %d steps",EHMTXv2_BLEND_STEPS);
10491063
#endif
10501064
if (EHMTXv2_WEEK_START)
10511065
{
@@ -1128,19 +1142,30 @@ namespace esphome
11281142
{
11291143
this->draw_gauge();
11301144
}
1131-
if (this->queue[this->screen_pointer]->mode != MODE_CLOCK && this->queue[this->screen_pointer]->mode != MODE_DATE && this->queue[this->screen_pointer]->mode != MODE_FULL_SCREEN && this->queue[this->screen_pointer]->mode != MODE_BITMAP_SCREEN)
1132-
{
1145+
#ifndef EHMTXv2_ALWAYS_SHOW_RLINDICATORS
1146+
if (this->queue[this->screen_pointer]->mode != MODE_CLOCK && this->queue[this->screen_pointer]->mode != MODE_DATE && this->queue[this->screen_pointer]->mode != MODE_FULL_SCREEN && this->queue[this->screen_pointer]->mode != MODE_BITMAP_SCREEN)
1147+
{
1148+
#endif
11331149

11341150
this->draw_rindicator();
1151+
#ifndef EHMTXv2_ALWAYS_SHOW_RLINDICATORS
11351152
if (this->queue[this->screen_pointer]->mode != MODE_ICON_SCREEN && this->queue[this->screen_pointer]->mode != MODE_RAINBOW_ICON && !this->display_gauge)
11361153
{
1154+
#endif
11371155
this->draw_lindicator();
1156+
#ifndef EHMTXv2_ALWAYS_SHOW_RLINDICATORS
11381157
}
11391158
}
1159+
#endif
11401160
this->draw_alarm();
11411161
}
11421162
}
11431163

1164+
void EHMTXStartRunningTrigger::process()
1165+
{
1166+
this->trigger();
1167+
}
1168+
11441169
void EHMTXNextScreenTrigger::process(std::string iconname, std::string text)
11451170
{
11461171
this->trigger(iconname, text);

0 commit comments

Comments
 (0)