UTC Digital: a Garmin Connect IQ watch face

I built a watch face.

Following up on a previous post about my initial thoughts on Garmin’s Connect IQ, I dove in and started playing around with watch faces. Garmin’s Connect IQ SDK includes an example analog watch face and the Eclipse plug-in for Connect IQ will setup a simple, working digital watch face when you create a new watch face project.

Working with Connect IQ is remarkably easy. As advertised, the language Garmin created, Monkey C, is a procedural programming language that will be familiar to any C, C++ or Java programmer. It’s simply a matter of learning what classes/methods give you access to what functionality.

A watch face is the most simple of the project types you can build; watch faces have only a single view (typically), don’t interact with any keys or actions and don’t have access to any sensors.

A simple digital watch face might start out like this:

using Toybox.Application as App;
using Toybox.WatchUi as WatchUi;
using Toybox.Graphics as Graphics;

class SimpleDigitalApp extends App.AppBase {
    function initialize() {
        App.AppBase.initialize();
    }

    function getInitialView() {
        return [ new SimpleDigitalView() ];
    }
}
class SimpleDigitalView extends WatchUi.WatchFace {
    function initialize() {
        WatchFace.initialize();
    }

    function onUpdate(dc) {
        var timeInfo = Time.Gregorian.info(Toybox.Time.now(), Time.FORMAT_SHORT);
        var timeStr = timeInfo.hour + ":" + timeInfo.min.format("%02d");
        dc.setColor(Graphics.COLOR_WHITE, Graphics.COLOR_TRANSPARENT);
        dc.drawText(dc.getWidth()/2, dc.getHeight()/2-dc.getFontHeight(Graphics.FONT_NUMBER_MEDIUM)/2, Graphics.FONT_NUMBER_MEDIUM, timeStr, Graphics.TEXT_JUSTIFY_CENTER);
    }
}

But because a watch face is running all the time the underlying watch OS only calls the onUpdate() method once per minute so as to ensure that battery life is maximized. However, when the watch senses the motion of a user lifting up the watch to look at it, the watch enters “high power” mode, whereby the onUpdate() method is called once per second for a maximum of 8 seconds or whenever the user looks away from the watch, whichever happens first. This then allows you do display the seconds or display other secondary information.

There are a large number of third-party watch faces available on the Connect IQ store; it depends on the watch model but for the D2 Bravo there are 692 of them. Most are okay in that they function but don’t add much value beyond the fancy background (team sport or whatever). Some of the watch faces are fantastic, offering up a neat, at-a-quick-glance view of all the other information available, such as daily steps, distance, calories expended, etc. But with that added functionality comes more complex code, which typically results in slower response when switching to or from the watch face. And sadly, it seems as most of the available watch faces are built with looks in mind and little consideration for code efficiency.

So while watch faces are simple to create, the best ones are the ones that manage to find a nice balance between information displayed and responsiveness. Or, the watch face fills a niche. And it’s the niche category that my watch face fits into.

64b24906-9032-455a-858b-34000b433ea2The D2 Bravo has analog and digital watch faces built-in and both allow for some customization of the background and extra information displayed. One of the extra fields is UTC (commonly referred to as GMT or Zulu time). However, UTC is always rendered in a small font and when I’m in pilot-mode all times are referenced in UTC. I don’t depart at 10:24am local Calgary time, I depart at 1724 UTC (or 1624 UTC when in Daylight Saving Time). So from the time I start planning my flight(s) and filing my flight plans through departure and until some point shortly after arrival all I’m really interested in seeing on my watch in terms of time is UTC.

And that primary interest in UTC is what my watch face “UTC Digital” provides. The large, easy to read at a casual glance font is displayed UTC time, with the UTC date (which could be tomorrow’s date) right above it. And in case a passenger is asking about it, local time is presented in the smaller font right below UTC. For me, it’s the perfect “pilot doing pilot things” watch face.

If you have a Garmin watch capable of running Connect IQ apps you can download the watch face at the Connect IQ Store: https://apps.garmin.com/en-US/apps/9abeafd5-f46f-4363-998a-6f2535784f5a

And if you’re interested in more details about the functionality of the watch face, including the changelog, you can read more on the page dedicated to UTC Digital that I’ve created.

Advertisements

Overview of Garmin’s Connect IQ

One of the attractive features of Garmin’s D2 Bravo pilot watch (a derivative of their fēnix 3 model) is the ability to customize the watch via for apps, widgets, watch faces and data fields available on the Connect IQ Store.

Connect IQ is touted by Garmin as “the first-ever open platform for third-party developers to create apps for our [Garmin’s] products” and it allows anyone with some programming savvy to create add-ons for their products, filling gaps (or in some cases, gaping holes) in built-in, default functionality or adding on highly specialized features that may not appeal to the general masses.

I’ve had my D2 Bravo for nine months now and I finally got around to looking into developing with Connect IQ, though I had been thinking about it for the past couple months but had been completely unmotivated to do so because the last thing anyone wants to do is dive into documentation provided by a big company (Garmin has a market cap of about $7.7B as of this writing) – I had visions of the nightmare that was working with PayPal’s API back before Stripe showed up on the payment processing scene. Plus I recalled reading that Garmin had created a new language to go with their Connect IQ API and I detest learning new languages, especially when the language is specific to one particular platform.

As it turns out Garmin did create a new, object-oriented language, called Monkey C, for use with Connect IQ. But the claimed goal of doing so was to make for easier app development on wearable devices by “…letting developers focus more on the customer and less on resource constraints“.

Okay, I was warming up to the notion of learning a new language. And that was made easier by the modern look and wording style in which the developer site for Connect IQ was written. The documentation is casual, fun and easy to read and understand. Perfect. And just when you think you can’t have anymore fun, you come across one of their  funny footnotes.

Functions are the meat[2] of your program.

2. Tofu for the vegetarians, BBQ for Kansans…

But footnotes aside, the programmer’s guide is a software developer’s dream, full of clear descriptions and lots of sample snippets of code. Not at all what I was expecting, and that serves me right for projecting past experiences with big companies and terrible documentation onto Garmin. In any case, what a breath of fresh air; it was like working with the Stripe API again! I’m not sure if this developer honeymoon will last through the first trial project but it’s looking good so far.