lubeda / EspHoMaTriXv2

A simple DIY status display with a 8x32 RGB LED matrix, implemented with esphome.io and Home Assistant.
MIT License
269 stars 25 forks source link

2024.6.1: Add `multicolor text` support #237

Closed andrewjswan closed 2 months ago

andrewjswan commented 2 months ago

multicolor_text (optional, boolean): If true, enables text multi color support when displaying text.

Example:

ehmtxv2:
  id: rgb8x32
...
  multicolor_text: true
service: esphome.ulanzi_text_screen
data:
  default_font: true
  text: "Test Test #00FF00Test #FF0000Test #0000FFTest"
  lifetime: 2
  screen_time: 10
  r: 255
  g: 255
  b: 255

Shows text in different colors, Test Test in the default color #FFFFFF (r: 255, g:255, b: 255), followed by Test in green #00FF00, then Test in red #FF0000 and finally Test in blue #0000FF.

lubeda commented 2 months ago

This nice addition makes everything to slow:

[13:26:02][W][component:237]: Component display took a long time for an operation (61 ms).
[13:26:02][W][component:238]: Components should block for at most 30 ms.
andrewjswan commented 2 months ago

Yes, it happens. And only once during the first screen display, during the display it does not happen anymore. I think because of Regex. On short text, or when there are few color changes, this does not happen, for example Default #00FF00Green works without this message.

andrewjswan commented 2 months ago

We can add a warning in the Readme that performance may decrease. Or not add it.

[!WARNING] In this mode, with a large number of color changes, or with long lines, a short-term decrease in performance is possible.

andrewjswan commented 2 months ago

Added to https://github.com/lubeda/EspHoMaTriXv2/pull/238

https://github.com/lubeda/EspHoMaTriXv2/pull/238/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R399-R403