InfiniTime icon indicating copy to clipboard operation
InfiniTime copied to clipboard

Star Trek Watchface

Open ljahn opened this issue 2 years ago • 36 comments
trafficstars

Description

I made a watch face inspired by Star Trek.

base

It supports all the icons and values of the standard digital face.
The status icons for Bluetooth, battery, power and notifications are on the left (the empty spot between battery and Bluetooth in the picture below is there because I could not make the small notification indicator "i" appear in InfiniSim).
Step count is under the main clock digits in brackets. The distance between the brackets leaves enough space for the default step goal of 10,000. It breaks down at 100,000 steps, where the number reaches over the right bracket. If the heart rate measurement is enabled, it is displayed above the date section. It also supports both 12h and 24h formats.

full

Technical stuff

I used the new external resources for the large number font and the small brackets.
I include the brackets as images, because I could not be bothered to draw them as rectangles and circles, like the rest of the display, because they are so detailed. They use up less space in total than the font. I thought about saving only one and turning it to make the other, but I could not get lvgl to do this.

The font for the large time numbers is Edge of the Galaxy, which is public domain.
The smaller text for dates and stuff is the InfiniTime standard font.

Testing

I tested this on InfiniSim (thoroughly, because I had a memory leak at first [from not freeing the font in the destructor :facepalm:]) and also run it at my personal PineTime without crash so far.

Things that could be changed

One could change the small font to a font closer to the Star Trek displays, but since it is so tiny, I don't think it would enhance the watch face much (apart from maybe removing the dot from inside the zero).

I am no graphics designer and therefore not good at selecting a balanced color palette. This could use some doing by someone with that skill.

I am unsure if it is okay to call this watch face "Star Trek" in the end, because of licensing issues.

ljahn avatar Nov 26 '22 12:11 ljahn

This is cool!

In the future, I want to try to get a Stardate thing going - I've tried getting behind how the Star Trek Online Stardate works but perhaps as another time format that could be a nice future feature. https://www.stoacademy.com/tools/stardate.php

I don't think licensing will be a problem - I doubt for a FOSS project any bullets will be shot, but if it is a problem I suppose naming it after a character or a ship. TMI the only copyrighted thing is the actual show + logo

JPeisach avatar Nov 27 '22 18:11 JPeisach

I love this watchface! I really hope it gets merged

CCF100 avatar Mar 03 '23 03:03 CCF100

Nice work! For an alternate name idea, might I suggest "LCARS"?

infinitytec avatar Mar 03 '23 12:03 infinitytec

Hey, you might want to look at the watch face initialization code, I've been running this watch face on my watch for a few days, and it's started rebooting whenever the watch attempts to chime on the hour/30 minute mark

It will also briefly display incorrectly right before it crashes...

CCF100 avatar Mar 06 '23 13:03 CCF100

Thanks for testing :+1:. I never use the chimes, that's why I missed that. I will have a look into it.

ljahn avatar Mar 06 '23 13:03 ljahn

I cannot replicate the crash. Not on my watch, which is 1.11.0 plus the commits from this PR (#1462) and #1479, Nor in InfiniSim with the same as on my watch or even just a build of this branch as is.

@CCF100 Could you please provide some info on what exactly you are running on your watch so I can replicate?

ljahn avatar Mar 06 '23 21:03 ljahn

I cannot replicate the crash. Not on my watch, which is 1.11.0 plus the commits from this PR (#1462) and #1479, Nor in InfiniSim with the same as on my watch or even just a build of this branch as is.

@CCF100 Could you please provide some info on what exactly you are running on your watch so I can replicate?

I'm just running the changes in this PR. I haven't merged in any other branches.

Edit: It seems to take a few days of running before the watch crashes

CCF100 avatar Mar 07 '23 01:03 CCF100

PXL_20230309_153033709 MP It will display like this right before it crashes

CCF100 avatar Mar 09 '23 15:03 CCF100

Aha! It is using the fallback font and the brackets are gone. This means that the external resources are missing somehow. Is the time also wrong?

My watch has still not crashed since I enabled the chimes, but I am also not running the exact code in this branch. You could try to build from this branch, which is just version 1.11 plus the watch face. This branch here is rebased onto the develop (now main) branch from the time I created the pull request, maybe the instability comes from there. The missing resources also hint at that.

ljahn avatar Mar 09 '23 16:03 ljahn

TBH, I kinda prefer the fallback font. It's more readable for me.

infinitytec avatar Mar 09 '23 16:03 infinitytec

I had the fallback as the default font for some time while I developed the watch face (It is just the same as in the digital style watch face) and I also think it is more readable. The Star Trek font looks more on theme, but it is definitely less legible when you just take a quick look at the watch. I, however, got accustomed to it rather quickly, so I decided for it in the end.

I think increasing the "small gaps" in the font in size would already do a lot for legibility, so I might try to edit the .otf to try it out if I have some time.

ljahn avatar Mar 09 '23 16:03 ljahn

Aha! It is using the fallback font and the brackets are gone. This means that the external resources are missing somehow. Is the time also wrong?

My watch has still not crashed since I enabled the chimes, but I am also not running the exact code in this branch. You could try to build from this branch, which is just version 1.11 plus the watch face. This branch here is rebased onto the develop (now main) branch from the time I created the pull request, maybe the instability comes from there. The missing resources also hint at that.

I think the problem might be rather it's having issues loading the external resources, causing it to crash and reboot. It has the external resources installed.

CCF100 avatar Mar 09 '23 19:03 CCF100

@ljahn I'm flashing the new branch to my watch now, will report back on any instability with this branch ^.^

CCF100 avatar Mar 10 '23 03:03 CCF100

@ljahn I still experience crashing when I have chimes enabled with the rebased branch :/ I think for some reason, it just fails to load the external resources when awoken with chimes enabled...

CCF100 avatar Mar 15 '23 01:03 CCF100

This is also an issue with the Infinineat and Casio watch faces, but in those cases it doesn't crash, just doesn't load the resources.

FintasticMan avatar Mar 15 '23 02:03 FintasticMan

I think I found the problem. I had a fallback font, but no fallback images, so when the external resources wouldn't load, displaying the brackets around the step count (which are images) would lead to crashes. I added fallbacks for those now, too.

@CCF100 please test when you have time. I was still unable to replicate the crash, maybe my watch has a golden flash chip that always delivers :wink:.

ljahn avatar Mar 18 '23 11:03 ljahn

I think I found the problem. I had a fallback font, but no fallback images, so when the external resources wouldn't load, displaying the brackets around the step count (which are images) would lead to crashes. I added fallbacks for those now, too.

@CCF100 please test when you have time. I was still unable to replicate the crash, maybe my watch has a golden flash chip that always delivers wink. Haven't checked this PR in awhile, I'll check it in a few

CCF100 avatar Mar 28 '23 23:03 CCF100

I think I found the problem. I had a fallback font, but no fallback images, so when the external resources wouldn't load, displaying the brackets around the step count (which are images) would lead to crashes. I added fallbacks for those now, too.

@CCF100 please test when you have time. I was still unable to replicate the crash, maybe my watch has a golden flash chip that always delivers wink. Haven't checked this PR in awhile, I'll check it in a few

Alas, the problem still exists. For whatever reason, enabling the chimes causes the watch to crash every time the chimes occurs...

CCF100 avatar Mar 30 '23 01:03 CCF100

TBH, I kinda prefer the fallback font. It's more readable for me.

I increased the small gaps in the digits. I thinks this makes it more readable while still keeping the style.

widergaps WiderGapsWatchface

ljahn avatar Apr 06 '23 10:04 ljahn

Build size and comparison to main:

Section Size Difference
text 385380B 8380B
data 940B 0B
bss 63556B 16B

github-actions[bot] avatar Apr 06 '23 10:04 github-actions[bot]

I think I found the problem. I had a fallback font, but no fallback images, so when the external resources wouldn't load, displaying the brackets around the step count (which are images) would lead to crashes. I added fallbacks for those now, too. @CCF100 please test when you have time. I was still unable to replicate the crash, maybe my watch has a golden flash chip that always delivers wink. Haven't checked this PR in awhile, I'll check it in a few

Alas, the problem still exists. For whatever reason, enabling the chimes causes the watch to crash every time the chimes occurs...

I am currently out of ideas what the reason could be. It still has never happened for me and I checked through my code again if I can see anything obvious and found nothing. When I wrote this, I took the digital watch face as a base and mainly edited stylistic stuff, I have not touched the fundamental clock logic or the interaction with the OS in any way (especially nothing related to chimes, since I do not use them).

So my hypothesis is that it it still something to do with the external resources, but I don't know what. Do I have to free the image buffers in some way? Does chiming for some reason use a lot of memory and the clock goes OOM under unlucky conditions, because the watch face is heavy and leaves not much free space? I don't know :shrug:

I am thankful for any additional testers and information on this :smiley:

ljahn avatar Apr 06 '23 10:04 ljahn

@CCF100 Not in subject but Where did you the bracelet ? It so cool!

lman0 avatar Apr 08 '23 20:04 lman0

@CCF100 Not in subject but Where did you the bracelet ? It so cool! @lman0 My girlfriend got it for me as an anniversary gift PXL_20230408_205839186.MP.jpg

CCF100 avatar Apr 08 '23 21:04 CCF100

I updated the watch face to 1.12.0 The old version on 1.11.0 remains at starTrekOn1.11

ljahn avatar Apr 15 '23 16:04 ljahn

Why is nothing happen here?

sonnatager avatar Sep 11 '23 14:09 sonnatager

Well there is something happening :wink:

I have channeled my inner masochist and drawn the detailed brackets around the step count fully in lvgl. Furthermore, I have made the font of the time digits configurable via a menu that opens on long press (like with the the configurable watchfaces). This means you can now choose if you want readability or style :wink: @infinitytec. This also means no external resources are needed when running the system font.

Lastly, I think I found the bug causing the crash. @CCF100 The destructor of the watchface tried to free the font when it was closed. But if the fallback font was loaded, this would result in attempt to free the system font, which lead to a crash. This is fixed now as well.

This branch is now at 1.13.0, not at the current development status, so if you build this, you get 1.13.0 plus the StarTrek watchface.

ljahn avatar Sep 13 '23 17:09 ljahn

I continued to do more work on this and I now consider it ready for review @JF002

This watch face now supports all the usual icons and information like steps and heart rate. I also added animations, to make it more lively (they can be disabled). Additionally, we have weather (which I copied from PTS, I think one could do a thing like the BatteryIcon for the weather as well), a config option to display seconds or not, and an option to use the system font for better legibility. It works without external resources, but then the Star Trek font is unavailable.

Here is a gif of what it looks like: InfiniSim_2023-11-08_233900 The flickering at the bottom is an artifact of the gif, it does not happen on the watch.

The one thing that reaches deeper into the system is the startup animation. I added OnLCDWakeup() and OnLCDSleep() functions to the Screen class to be able to react to those events and call them in DisplayApp.

ljahn avatar Nov 11 '23 12:11 ljahn

The clang-tidy check workflow is failing because of a problem with the submodules lvgl and littlefs. It is complaining about multiple configurations for those and then fails with fatal: remote error: upload-pack: not our ref. I don't think I have touched anything related to the submodules and I can also only find one configuration where the parameters in question, url and path, are defined (standard .gitmodules).

What could cause this?

ljahn avatar Nov 13 '23 20:11 ljahn

Yeah, I can't see any reason why it should fail... I'll try re-running the workflow.

Edit: re-running hasn't seemed to help. Very strange that it's only that workflow that fails, not any others.

FintasticMan avatar Nov 13 '23 20:11 FintasticMan

Well, it fixed itself :tada: :wink:

ljahn avatar Nov 13 '23 21:11 ljahn