1hz Watch Faces - Q&A

I'm not sure if many folks have been trying the new "always active" watch faces in 2.3.x, but the 2.3.0.beta1 has been out for a month or so now. It's probably getting close to the 2.3.1 SDK release, and thought I'd start a Q&A for the feature, and start with some of what I've picked up in adapting a number of watch faces to use 1hz.

I'll be calling this feature "1hz", as that's what it really is - being able to change the screen on a watch face every second.
The most common thing will likely being the ability to display seconds all the time. One thing I'll note right off, is while you can update the screen every second, the underlying data still changes at the rate it did before, so if you use 1hz for the HR, you won't see the HR change every second.

A few basics.

  • 1hz is only available on some watches. The f5, f5s, f5x, 935, and Q5, but if you support a bunch of different watches, you can easily have it on some and not others.
  • 1hz happens by way of a new onPartialUpdate() for watch faces. onUpdate() is just like it was in the past, and when you are allowed to do a 1hz update, onPartialUpdated() is called. You don't have to change a thing in your code if you don't want to use 1hz.
  • onPartialUpdate() is VERY strict as to how long it can run. You have a "power budget", and the rule is that each minute, the average run time each second can't be greater than 30 milliseconds. This is the tricky part! :)



I started with the Analog Sample in the SDK, which does show what to do, but has some things you don't need to do for digital watch faces - there's no second hand passing over a bunch of different places on the screen with a digital one. The time is in a fixed spot on the screen in most cases.



Anyway's, the first thing I did was cut back to the basics of what was needed for a digital WF. I'll attached a project with a very basic 1hz watch face, but first a few notes about it.

  • vs1hzapp.mc shows how to use the delegate for the power exceeded deligate on watches that have 1hz, and still run on watches that don't do 1hz.
  • vs1hzview.mc I tried to comment as to where to do things, where not to do things, but took a simple approach where I don't just update the seconds at 1hz, I actually do hh:mm:ss. In real code, you likely have a separate space for seconds, and your setClip() will be adjusted for that. I just wanted to get the ball rolling here :). Also, note onEnterSleep() and the code there for 1hz...
  • In onPartialUpdate(), I have a comment about a simple change to make the watch face exceed the power budget, so you can see how that works



Ask questions, suggest other ideas, whatever. That's what this thread is for!

So here's the project! (it might be a bit different than the original one that was lost in the forum update) :

VS1hz-old.zip



NOTE: I should have mentioned this before, but you want to use a 2.3.x SDK for this project!

  • If you look at the sample code I posted, I might just use the "do1hz" boolean - and add

    if[!do1hz] {return;}

    at the beginning of onPartialUpdate[]

    if you set seconds off, just make it false. if you set seconds on, set "do1hz" based on the "has" like I do in initialize. You should still get seconds for the 10 seconds after a gesture.

    the reason being, is do1hz is used in a few different parts of the code. it's the same boolen that is used if the delegate is called for exceeding the power budget.

    I replaced the parens with sq brackets to post
  • Just put if(condition) { render } inside onPartialUpdate
  • Thanks, jim_m_58 and HermoT!

    I used the standard sample that came with the SDK as the starting point, but both of the suggestions make sense.

    This is what I have been working on, EuroPilot.

    https://dl.dropboxusercontent.com/u/28846604/Garmin/EuroPilotBeta1Hz.gif
  • Oh my word! You're the author of EuroPilot!
    I left you a 5 star rating and a request to add support for 935 and f5s. I really like this watch face, and with always on seconds hand this is going to be exceptional!
  • Oh my word! You're the author of EuroPilot!
    I left you a 5 star rating and a request to add support for 935 and f5s. I really like this watch face, and with always on seconds hand this is going to be exceptional!


    Thanks for the kind words and rating. I am still very new to this; I've only started ConnectIQ development a couple of weeks ago. I have managed to get both EuroPilot and EuroPilotPlus working with 1Hz second hand. I will add the 935 on the next release. The F5s might be a little while and I may release a separate version since the size of the fonts and bitmaps don't work well with the smaller display - I didn't like the look of it.

    On the EuroPilots, I learned:
    • I had to limit the second hand width to 3px to stay "safely" within the power budget (other options were to shorten the length of hand or trim the tail, I didn't like those options)
    • defining the screen buffer palette really helps reduce memory usage
    • defining a bitmap palette is also quite important (the BT icon would cause errors until I specified the palette, even though it used indexed colours within the palette)
  • KSodhi. The thing here is you got people to ask that have done this for years. If you don't know who Hermo is, check "most popular" for watch faces on about any device and look for NoFrills....

    BTW, bitmaps for Icons? Have you considered a custom font for Icons? Much easier memory wise if you want to change colors! :)
  • KSodhi. The thing here is you got people to ask that have done this for years. If you don't know who Hermo is, check "most popular" for watch faces on about any device and look for NoFrills....

    BTW, bitmaps for Icons? Have you considered a custom font for Icons? Much easier memory wise if you want to change colors! :)


    Yes, I know who Hermo is and have to admit, was a little starstruck. :)

    Thanks for the tip on the BT logo font. I found one and will use it.

  • I have a whole custom font of the icons I use in various apps (maybe 20 things all together, like BT, battery, alarm, etc). (sorry, I won't share it! :) When I have to do pixel editing, I guard it well!) Using a font makes it really easy to customize colors, or to change colors, like the battery dropping below a certain level
  • I have a whole custom font of the icons I use in various apps (maybe 20 things all together, like BT, battery, alarm, etc). (sorry, I won't share it! :) When I have to do pixel editing, I guard it well!) Using a font makes it really easy to customize colors, or to change colors, like the battery dropping below a certain level


    That's fair and a good suggestion. I just grabbed this font for the BT icons. I haven't yet got to building my own fonts though.

    http://zavoloklom.github.io/material-design-iconic-font/icons.html

  • So, I'm noticed a bug/glitch which presents itself after the watch face has been running for a while.

    The second hand jumps from 59s straight to 1s and pauses there the appropriate time and continues on. I don't see this behaviour in the simulator, so I'm a little lost. Where should I look in trying to debug/troubleshoot this issue?

    Other than the above, the watch face runs well and doesn't report and exceeding the power budget. Any ideas?