EspHoMaTriXv2: [BUG] Scroll count calculates wrong time, its a 0.5 more time

Bug report

Describe the bug

Hi, Lubeda, firstly thank you for great project!

There is some strange bug ive notice: Somewhy when I call any HA-service to display my long text on Ulanzi, the time of scrolling line calculates wrong. Line is showing fully, then a little blank space at the end, and then showing one first word of my text again (i think its 24px, not a just first word). It looks like:

“[Icon] Some text here, long text i think (blank space)” “[Icon] Some tex” *Returns to main screen (clock).

What I need to do to display my long-text notification 1 time only (not 1.5) ?

In my esphome config i have: scroll_count: 1 With scroll cound 2 i have 2.5 times of running long text.

Additional information

  • used Hardware:
    • Ulanzi TС001

To Reproduce

Steps to reproduce the behavior: Just a call icon_text or alarm as me, for 1 scroll count, for 1 screen time.

Services calls

service: esphome.ulanzi_alert_screen
data:
  icon_name: spotify
  text: >-
    {{state_attr('media_player.zenbook','media_artist') + ' - ' +
    state_attr('media_player.zenbook','media_title') }}
  screen_time: 1
  default_font: true
  r: 255
  g: 255
  b: 255

There is a little video ive recorded for you. https://drive.google.com/file/d/1VUK-n22frwMrHPKhwonuQXQiwJ0iN8Mt/view?usp=sharing

About this issue

  • Original URL
  • State: closed
  • Created 8 months ago
  • Reactions: 2
  • Comments: 15 (3 by maintainers)

Most upvoted comments

i will investigate

@chertvl Can you check? Has your problem been fixed?

It seems work flawlessly. Indeed what I expected! Thank you for your work 😉

In calc_scroll_time - https://github.com/lubeda/EspHoMaTriXv2/blob/2023.9.1/components/ehmtxv2/EHMTX_queue.cpp#L703 i change:

max_steps = (EHMTXv2_SCROLL_COUNT + 1) * (width - startx) + EHMTXv2_SCROLL_COUNT * this->pixels_;

to

max_steps = EHMTXv2_SCROLL_COUNT * (width - startx) + EHMTXv2_SCROLL_COUNT * this->pixels_;

It has gotten better, but there is still a small tail.

@lubeda , I was thinking, maybe we should add the ability to display it at once to all screens? Those if specified a lifetime of 0, and specified a screen display time of 10 seconds, then the lifetime automatically takes the value of 10 seconds.

    screen->calc_scroll_time(text, screen_time);
    screen->endtime = this->clock->now().timestamp + (lifetime > 0 ? lifetime * 60 : screen->screen_time_ + 1);