Is there a way on Watch Faces to disable the onEnterSleep() entry?

I've written a few watch faces and would like to be able to keep them from going into sleep so I can keep the seconds hand/count displayed all the time.  Some of the Garmin watch faces have always visible seconds, so I was wondering if there's a way to keep the seconds display always running in watch faces that I write myself.

I think I found a workaround by calling onExitSleep() immediately after going into sleep, as there's one final onUpdate() call after sleep is entered.  So I set a flag when onEnterSleep() is called, and then use that flag to call onExitSleep() on the next onUpdate() call.  Is that the normal way to do what I'm trying to do, or are there other ways?

edit: after posting this another thread showed up in the margins talking about onPartialUpdate(), looks like that gets called during sleep instead of onUpdate(), and it seems that I can keep the seconds displayed and incrementing using that method, so I think I'm good.  Any other comments will still be appreciated.

  • hi mate,

    you mean always stays on HighPowerMode? (update every seconds) 

    If yes, no there is no way, keep in mind that a watchface is supposed to be a "screen saver", not an app,

    if update every 1s, it will drain too much battery

    example: with lowPowerMode: at least 1440 refresh a day, if always highPowerMode 86400 refresh,

    see the excellent tread from Jim:

    https://forums.garmin.com/developer/connect-iq/f/discussion/5156/1hz-watch-faces---q-a

    or the Analog sample in the SDK.

  • A couple things since that thread was active are that onPartialUpdate() isn't supported on the forerunner 45 (it's a CIQ 1 device) or the Venu devices (the burn-in protection stuff).

  • OK, I should have mentioned its a Fenix 6 device, I'm used to posting on that forum where its not necessary to mention the device, sorry for that omission.  It looks like onPartialUpdate() is exactly what I was looking for, so I'm on the right track.

    After skimming through Jim's link, I recall reading either that post or something similar about a year ago, where he mentioned the 30ms execution time limit.  I think I even used onEnterSleep() once to see it working, but then lost interest in watch faces and forgot about it, I'm getting old. 

    Regarding the power consumption, I've been running one of Garmin's digital time displays that keeps the seconds on all the time, and its very power efficient (about 2%/day just sitting in a drawer), so it doesn't seem that just because you keep updating the seconds display at 1Hz you're going to burn a lot more power.  I'm sure how you do it matters though.  In my case I only refresh the small section of the screen that changes each second, I don't clear the entire screen and redraw everything every second.  I have a power measurement app that I wrote to monitor battery usage over time, I'll see how it goes compared to the Garmin screen and report back in a couple days.

  • Native watch faces (the ones that come on the watch) aren't done with CIQ so can do things a differently and are written for native code.  CIQ compiles to byte codes, and there's a virtual machine on the watch that executes them, so they're not as efficient.

    The 30ms thing in CIQ is that over a minute when in low power mode, the average for calls to onPartialUpdate needs to be 30ms or less.  That's why you need to have a clip region and only update part of the display.  You can get an idea of what's happening with Watch face diagnostics in the sim.

  • What I'm seeing now is when it goes to sleep I get onPartialUpdate() calls for between 1 and 2 minutes, and then they stop.

    Also, I don't know how to measure my execution time while in onPartialUpdate(), can you explain how to do that.  thanks.

  • You're exceeding the 30ms power budget,  That happens after a full minute (0 to 59 seconds).

    To see where you're at, in the sim use file>"view watchface diagnostics".  He's an example with one of mine:

    the 9489 is actually showing 9.489 ms, and it will change every second.  I'm guessing you're not setting a clip region for the area of the screen you want to update

  • yeah, I suspected that was the case, the diagnostics confirmed it.

    I found setClip() and I think that's going to help fix the problem, experimenting with it now, thanks.

  • Don't forget the clearClip.  I usually do that at the beginning of onUpdate().

  • yeah, found that at the same time I found setClip() so I was ready for that.  I've got the face working to my liking now, measuring power draw for a while now to see how it fares compared to the Garmin offerings.

  • I let it sit overnight and after 11 hours its battery usage is about 2.5%/day, which is similar to what I typically get with the Garmin watch face I have been using.  I think measuring battery usage is a bit of an inexact science, but that looks good so far.

    I have a question regarding the screen display.  It appears from my experiments yesterday that even if you only change the value of one pixel with your instruction, the entire screen actually gets redrawn if you don't have it clipped, is that correct?