InfiniTimeOrg / InfiniTime

Firmware for Pinetime smartwatch written in C++ and based on FreeRTOS
GNU General Public License v3.0
2.71k stars 927 forks source link

background for analog watch face in lvgl #1824

Closed minacode closed 1 year ago

minacode commented 1 year ago

Alternative to #1819.

This commit removes the background image for the WatchFaceAnalog and replaces it with lvgl widgets. It aims to keep the original look.

The refresh is almost instant now.

I am not sure at how much places the background image has to be removed. If someone knows more about that, please have a look at it.

Colors are up to debate :grin:

InfiniSim_2023-08-08_123955

github-actions[bot] commented 1 year ago
Build size and comparison to main: Section Size Difference
text 395204B -14096B
data 996B 0B
bss 63372B 0B
minacode commented 1 year ago

I tried it with 'PineTime' first and can confirm that it does not look good with the current font 😄

NeroBurner commented 1 year ago

It would be interesting what the ram usage at runtime difference between this new and the old one with the background image is

minacode commented 1 year ago

Which number do you need?

Memory heap Free 19576 Min free 9896

FintasticMan commented 1 year ago

It would be better to use a label to display the current free memory on the watch face itself, because the face is unloaded when you go to the about page to look at the memory. (assuming you don't have a debugger connected)

minacode commented 1 year ago

Makes sense. How can I get the current free memory?

FintasticMan commented 1 year ago

xPortGetFreeHeapSize()

everypizza1 commented 1 year ago

I tried it with 'PineTime' first and can confirm that it does not look good with the current font 😄

Personally, I would like Fredoka 600 from Google Fonts.

minacode commented 1 year ago

Tbh, I like the watch face more without some brand label. Isn't it also possible (or at least a goal) to run InfiniTime on non-PineTime watches?

FintasticMan commented 1 year ago

You're right, it is possible to run InfiniTime on other watches, currently only variations of the Colmi P8.

Boteium commented 1 year ago

Great Job ! It's a really clever use of lv_lmeter. I would never think of it and would implement this in several lvgl objects.

minacode commented 1 year ago

Here are the measurements: New watch face: 16904 once, then 16744 constantly Old watch face: 17536 once, then 17472 constantly

JF002 commented 1 year ago

Great job! This effectively frees ~14KB in flash, which is not insignificant at all!

Here is a picture showing the original analog watchface and this one: infinitime-analog-comparison

They look quite similar, IMO, except for the font size, obviously.

This PR also improve the drawing speed of the watchface :

https://github.com/InfiniTimeOrg/InfiniTime/assets/2261652/3dabd55b-ef36-4f34-90df-47d646d944b9

RAM usage at runtime looks good. It allocates ~2.8KB in RAM (from the freeRTOS heap). The casio watchface (the one with the heaviest RAM usage) allocates ~12KB, so I guess we're good!