lubeda / EspHoMaTriXv2

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

2024.1.0: Advanced Boot Logo #191

Closed andrewjswan closed 8 months ago

andrewjswan commented 8 months ago

Advanced mode of boot logo display

Allows you to show a custom boot logo instead of the default animation when booting. advanced_boot (optional, boolean, only on ESP32, Default: false) Enables advanced mode of boot logo display. boot_logo (optional, string, only on ESP32): Mask defined as rgb565 array used to display boot logo, color is completely ignored, output depends on boot logo display mode. boot_mode (optional, integer, only on ESP32, Default: 3) Mode of displaying boot logo, can take value from 0 to 3:

After startup, to save memory, you can clear the array with the boot logo by calling the boot_logo setup function with an empty parameter.

id(rgb8x32)->set_boot_logo("");

But in case time is lost (unsynchronization), the standard animation will be shown.

PS: I see the readme is constantly being updated, so I decided not to add this text to the file itself. I will leave the text of changes here.

lubeda commented 8 months ago

Hi, also a nice addition. I will add it to the readme before releasing.

lubeda commented 8 months ago

You dont useadvanced_boot` and there is no option to show the boot_logo as it is without the masking or animation stuff

lubeda commented 8 months ago

I also think boot_mode 0 should be default e.g. the normal pure display and from 1 to to 4 should be your animations

andrewjswan commented 8 months ago

You dont useadvanced_boot` and there is no option to show the boot_logo as it is without the masking or animation stuff

I didn't quite understand the question. If advanced_boot is not used, then the default code works, i.e. rectangle. If advanced_boot is used and boot_logo is specified and it is processed without errors i.e. the array is full and not NULL, then advanced_boot works. If you clear the array, the default code works again, i.e. rectangle.

andrewjswan commented 8 months ago

I also think boot_mode 0 should be default e.g. the normal pure display and from 1 to to 4 should be your animations

I don’t see the point, if we indicate in the configuration that we want the default logo (mode 0 you suggested), then what difference does it make to change the mode or comment out any line from advanced_boot or boot_logo. In both cases there will be a default logo.

lubeda commented 8 months ago

On a fresh installation of 2024.1.0-prerelease there is no boot_logo at all because it was removed in 2023.8.0 (I think) and "replaced" with the

on_start_running:
  id(rgb32x8)->bitmap_screen(.....

way of showing a "boot-logo".

The visual result is the same as your method.

Now you reintroduced the boot_logo and your part is working, but somehow our code base drifted. Just try the version 2024.1.0-prerelease in the repo and you will see.

andrewjswan commented 8 months ago

This is not quite true if you don't turn on advanced_boot, but add

on_start_running:
  id(rgb32x8)->bitmap_screen(.....

The startup process will be like this:

If you enable advanced_boot, add boot_logo and leave the configuration as it is, the startup process will be like this:

chertvl commented 8 months ago

I tested this feature and liked it. I drew myself, using zeros and ones, a semblance of a blank screen during loading, which then turns into a real watch face screen. looks very good.

code and video:

image

https://drive.google.com/file/d/1GGKvRePjlyhDy6QFaLkTMfeWjZEa8yZG/view?usp=sharing

lubeda commented 8 months ago

The startup process will be like this:

  • Show the expanding rectangle until the time is synchronized and the clock starts running
  • Show the regular bitmap_screen while it is alive, alternating with other screens

If you enable advanced_boot, add boot_logo and leave the configuration as it is, the startup process will be like this:

  • Show the image from boot_logo in the selected mode instead of the rectangle until the time is synchronized and the clock starts running
  • Show the regular bitmap_screen while it is alive, alternating with other screens.

I see, I was a little wrong. But still, I think it would be clearer to have:

if boot_logo is set and the default_bootmode is 0, the advanced_boot is the obsolete

0 - Display boot_logo without filter and mask, just colorful 1 - Display boot_logo in white color 2 - Display boot_logo in white color, the mask appears from the center to the sides. 3 - Display boot_logo with rainbow color 4 - Display boot_logo in rainbow color, the mask appears from the center to the sides

The on_start_runing lambda way could then be optional. You could even free the boot_logo space automatically. So all boot_logo things are in one place.

lubeda commented 8 months ago

I tested this feature and liked it.

Yes it is

andrewjswan commented 8 months ago

if boot_logo is set and the default_bootmode is 0, the advanced_boot is the obsolete

Well now it is, to enable this mode it is necessary to write advanced_boot and boot_logo, if it is not done, then we do not enable this mode at all and it works as before. But at the same time we save some memory because there is no pointer to the array.

Look: https://github.com/lubeda/EspHoMaTriXv2/blob/2024.1.0-prerelease/components/ehmtxv2/__init__.py#L596

andrewjswan commented 8 months ago

But we can do it just in the base, without any advanced keys, based on the mode and the presence of the logo. I just decided not to overload not all the necessary functionality.

andrewjswan commented 8 months ago

@lubeda I think I get your idea, sorry I didn't get it right away. You suggest to remove advanced_boot and rely only on boot_logo and boot_mode, I like this idea, I support it. I'll redo it.