InfiniTime icon indicating copy to clipboard operation
InfiniTime copied to clipboard

watchfaces: add LCARS

Open w4tsn opened this issue 1 year ago • 11 comments

This adds an LCARS watchface, a UI known from the Star Trek series.

The following issues are still open and I might need a hand with these:

  • the background image is around 170 kB. I suspect because of it's size (240x240) and the embedded text. This could be reduced by a lot I guess if converted to point-rendering in lvgl similar to Infineat
  • there are alignment issues currently only solvable through calling the lv_obj_align function (again) after calling the local label_make function, which I added to reduce duplicate code
  • coming from the settings screen the watchface loads quite slowly, probably because of the size of the background image
  • needs rebase to latest development branch, currently tracks 1.14.0
  • the app is currently fully integrated (as default in the build) because I did not catch how to make it a "UserApp" that can be selected when invoking cmake

Screenshot from 2024-06-03 18-34-32

image

Screencast from 2024-06-03 18-34-02.webm

EDIT: here the pre-build OTA files for the firmware and resources.

pinetime-mcuboot-app-dfu-1.14.0.zip infinitime-resources-1.14.0.zip

w4tsn avatar Jun 03 '24 16:06 w4tsn

Build checks have not completed. Possible reasons for this are:

  1. The checks need to be approved by a maintainer
  2. The branch has conflicts
  3. The firmware build has failed

github-actions[bot] avatar Jun 03 '24 16:06 github-actions[bot]

I'm more of a TNG fan :wink: but this looks nice :+1:

Having the background as an image really is using a lot of storage space. ~~Alas, you can not render images from the SPI flash, so making this fit is going to be difficult.~~ Have you been able to run it on the device, not the simulator? If you decide to convert it to be rendered "vector graphics style" with lvgl, watch out for the heap memory usage. If you go crazy detailed (like I did once with my watch face), you can easily fill the heap completely and get weird behaviour that does not show on the sim. For an immediate size decrease of the background picture, you could also use one of lvgl's indexed color modes. If you convert to 4 or 8 bit indexed color, you can only have 16 or 265 colors, respectively (16 will certainly make your curves look less anti-aliased), but the storage use would decrease to 29kB or 58kB.

You alignment issue is a funny one that definitely never happened to anyone I know :wink:. You pass the value -5 to an argument of type uint8_t.

Edit: Marked wrong statement

ljahn avatar Jun 04 '24 16:06 ljahn

I'm more of a TNG fan 😉 but this looks nice 👍

Thanks! Your TNG Version is also pretty cool, but as you can guess I'm more of a Voyager fan :D

Having the background as an image really is using a lot of storage space. Alas, you can not render images from the SPI flash, so making this fit is going to be difficult. Have you been able to run it on the device, not the simulator? If you decide to convert it to be rendered "vector graphics style" with lvgl, watch out for the heap memory usage. If you go crazy detailed (like I did once with my watch face), you can easily fill the heap completely and get weird behaviour that does not show on the sim. For an immediate size decrease of the background picture, you could also use one of lvgl's indexed color modes. If you convert to 4 or 8 bit indexed color, you can only have 16 or 265 colors, respectively (16 will certainly make your curves look less anti-aliased), but the storage use would decrease to 29kB or 58kB.

Thanks, I'll look into that!

You alignment issue is a funny one that definitely never happened to anyone I know 😉. You pass the value -5 to an argument of type uint8_t.

Oh my....

w4tsn avatar Jun 05 '24 12:06 w4tsn

Alas, you can not render images from the SPI flash

This is wrong. I got mixed up while thinking about how I went to optimize the storage needs of my development. I tried to save space by re-using duplicate parts, but I could not get the rotation features of lvgl to work. It turned out it is not possible to rotate images that are displayed from the SPI flash.

You clearly can render images from SPI flash (actually you do it). But I would also think this is the reason the watch face loads slowly. Nevertheless indexed color will probably speed things up by giving you size reduction.

ljahn avatar Jun 05 '24 13:06 ljahn

@w4tsn I really like this watchface. Do you think it is possible to additionally add the current weather information? Probably the most useful way would be to make it configurable. E.g. I don't use the heart rate measurement because it drains the battery so fast but I like to know the (rough) temperature. An option to configure the available information like in the PineTimeStyle watchface were awesome but I understand if this takes some time since it increases the complexity of the watch face considerably.

L3br4nd avatar Jun 25 '24 20:06 L3br4nd

Great watchface, I started using it yesterday. After some time though. Usually after a notification the screen goes all funky and after a few minutes the firmware rolls back

IMG_20240804_213147.jpg

IMG_20240804_214230.jpg

jimfim avatar Aug 04 '24 20:08 jimfim

You can replicate the issue by just toggling back and forwards between the watch face and the notifications. You don't need any notifications. After about 20~ish transitions you see what I see above in my pictures. Checking the minfree value between transitions you can see the value reduce to 0 as you perform more transitions and eventually you will get alloc errors and the watch will reset.

jimfim avatar Aug 05 '24 23:08 jimfim

The memory leak is in set_label_text_from_uint. I unrolled the loop and did not call that function and the issue is gone. Maybe the function could be fixed but i though unrolling the loop and hard coding the labels was easier …

I also have made a version that does not use the image as a background but draws it with circles and rectangles and labels. It draws faster but the remaining memory is veeery tight and the code is not nice yet … nothing i can publicly commit yet …

romibi avatar Jan 12 '25 19:01 romibi

See My copy of this branch where I:

  • Rebased onto main
  • Fixed the memory leak Still not sure I fixing the function would be nicer instead of unrolling the loops. But I'm not too used to cpp to be certain how/when to properly free the temporary variables.
  • Fixed the alignment issues Main culprit was providing negativ numbers to uint8_t And for one situation providing the wrong "container"
  • Fixed the week number format mixup mentioned above
  • Implemented drawing the bg with circles, rectangles and labels Not completely happy with the font for the bg labels
  • Added weather info for when no heartrate is available @L3br4nd you requested this 😄

@w4tsn You can cherry pick from it or reset to it to update this pull request …

Todo:

  • remove png again (and maybe svg … or keep as reference?)
  • not happy with memory usage

Pictures: image

image

Build results: pinetime-mcuboot-app-dfu-1.15.0.zip infinitime-resources-1.15.0.zip

romibi avatar Jan 14 '25 22:01 romibi

@romibi nice, thank you 😊

L3br4nd avatar Jan 15 '25 06:01 L3br4nd

While using this watchface (my updated version) for the past two weeks I was quite happy how it is. But one thing I was missing was some indication on if I missed any notifications. So I added notification icons/count to my branch of this. (Todos from above unchanged)

Notification count if any: image

Icon for not yet displayed Notifications (When notifications off/sleep mode): image

Build results: pinetime-mcuboot-app-dfu-1.15.0.zip infinitime-resources-1.15.0.zip

romibi avatar Jan 29 '25 11:01 romibi