joBr99 / nspanel-lovelace-ui

Custom Firmware for NsPanel with the design of HomeAssistant's lovelace UI in mind, works with Tasmota.
GNU General Public License v3.0
867 stars 188 forks source link

[BUG] Font Size too big - leading to 20h uploading tft and data corruption #924

Closed andyxpert closed 1 year ago

andyxpert commented 1 year ago

PROBLEM DESCRIPTION

Recently saw a longer duration on ftf upload to nspanel. Specifically after reaching about 4MB the speed would go to almost zero taking about 20h to complete. Now this is NOT your problem, but to fix my issue I dug in the MHI file and found that two fonts take around 5 MB - Since the large one is used only for screensaver clock, I limited their characters to only the required ones - lowering their cumulated size from 5MB to around 100 KB.

So... this is mainly a feature request - lower font sizes by including only required characters But I'll leave it as a bug as it causes many issues along the way because of the buge tft file size

LE: when playing with the fonts I mistakenly removed all the icons - therefore had the big downsize of the tft. Will get back with updates, maybe even close this as Not a Bug...

REQUESTED INFORMATION

Compile HMI, tft file has over 8MB when it could have around 2

- [ ] Go to Settings>Add-ons>AppDaemon>Log (or the output of your TS script) and then, provide the output of the log during your issue/bug occurs:

Log output here:



### TO REPRODUCE
 - irrelevant -

### EXPECTED BEHAVIOUR
Smaller tft file zise

### SCREENSHOTS
 - irrelevant -

### ADDITIONAL CONTEXT
 - irrelevant -

### PANEL / FIRMWARE VERION
 - irrelevant -
joBr99 commented 1 year ago

what?

image

The big font used on the screensaver is number 5 and only contains most basic stuff (even though it could be stripped even more, but it's only 50KB not 5MB)

image

Font 3 and 4 contain all of the icons and that's also the reason why they are so big if you replace them with smaller fonts you will lose all of the icons lol.

What are you using to flash the display? Flashing the current firmware takes around 5 Minutes for a full flash with tasmota. Updates are way faster. (at least if there are no changes to the fonts or pictures)

andyxpert commented 1 year ago

My mistake, edited the icons font without having the NotoSans font installed and all the icons went away when I generated the font. Figured out after flashing when I saw the missing icons...

Flashing from HA directly using the upload_tft service - goes ok until around 4 MB then speed is almost zero... Is there another way to flash it ? From Nextion Editor with the panel attached doesn't work - fails pretty quickly. Can I use the MQTT command to upload it directly ? I changed the desired_display_firmware_url in nspanel-lovelace-ui.py to point to my tft hosted on a local server. I'm about to try increasing the desired_display_firmware_version to see if it updates me to install the new one.

joBr99 commented 1 year ago

with esphome flashing will be slower, but still should be around 15 minutes - also I cannot tell you much about the esphome stuff

afaik there is a service you can call in homeassistant with the url to flash the tft file

andyxpert commented 1 year ago

Yeah, exactly that service from HA I was using. Added the original fonts back. My only issue your your HMI is that I need a background image (to make it fancy), so I need to set pretty much all the elements on "crop image" with image "0" as a target, and replaced 0.png with my own. Look damn hot this way, with transparency and all... So maybe you could think of adding transparency by default or with a toggle (as there's quite some code I had to comment because of the crop-image setting).

Anyway, now I'm uploading via increasing desired_display_firmware_version, worked fine until it got to 4 MB and then boom - speed dropped again. So I'm guessing it's clearly an issue with ESPHome's recent changes, as half-a-year ago it uploaded 8MB in around 10 mins as you said.

Ok, if you want you can close this bug but keep in mind that adding transparency would be a great addition - and it's fairly easy as it takes me around 10-15 minutes to do the changes on the HMI everytime after an update :)

If i find something about ESP's transfer issue I'll update the thread, maybe someone else has the same problem.

joBr99 commented 1 year ago

guess it's realted to this: https://github.com/sairon/esphome-nspanel-lovelace-ui/issues/27

background images do not really work well in nextion, because there is no transparency - it won't work with all elements that involve images like sliders and switches

andyxpert commented 1 year ago

Ok, so assumption confirmed, it's due to EPSHome's recent updates... Heap is filling aggressively Reverted to an older 2022.9.0 version and it worked flawlessly, uploaded in under 2 minutes. I guess I'll update ESPHome to latest for the rest of the devices and keep nspanel on that older version.

PS: about transparency, I feel you, but I can live with grey corners on sliders and color swatches as long as I have full transparency and a nice background for the rest of the screens. PPS: the desired_display_firmware_version method works but I had to get in back to the old value as it kept asking me to upgrade every restart.