Announcement

Collapse
No announcement yet.

onPartialUpdate and Low Power Mode

Collapse
X
  • Time
  • Show
Clear All
new posts

  • onPartialUpdate and Low Power Mode

    I am working on a watchface and trying to update seconds and heart rate in onPartialUpdate(). I've read through the forums and am not able to find a solution. Coincidentally, I see a pretty similar question to mine recently posted where the developer's issue seems to be exceeding the power budget. However, I believe my issue is related to entering low power mode. Toggling the "Low Power Mode" option in the simulator replicates or resolves the issue. I have installed it on my watch. And, when I perform the arm gesture to wake my watch on my wrist, it will start updating the seconds, but the heart rate doesn't return. It will do so for 10 secs (as I have seen mentioned in other threads where low power mode, update() and onPartialUpdate() were discussed). So, can you direct me to the documentation, thread or example that describes how to correctly display these 2 pieces of data? Maybe there's an example in the SDK samples that I haven't run across.

    FWIW, I don't plan to offer this on the IQ store. It might wind up there eventually, but I'm not really focused on making the layout or features work across many devices (just my 935). But, if it works out, I might because I haven't been able to find exactly what I want yet. So, maybe someone else will benefit from it.

    TIA,
    Darren

  • #2
    Here's a whole thread about 1hz, with a number of tips. (and a simple sample watch face that shows much of what I'll say here)
    https://forums.garmin.com/forum/deve...58133-?376929=
    The Analog sample in the SDK is an analog WF that does 1hz.

    Ok, a couple things.

    In the sim, when you uncheck Low Power mode, onUpdate gets called every second instead of every minute. And onPartialUpdate doesn't get called.
    This is what happens with a gesture, OnUpdate gets called every second for 10 seconds, then falls back to low power mode and onUpdate gets called every minute. onEnterSleep()/onExitSleep() is how a WF can tell if it's in low power mode or not

    When in low power mode, onPartialUpdate gets called every second (if onUpdate hasn't been called that second). and this is where the power budget comes into play. If you exceed an avg of 30ms per call, onPartialUpdate is no longer called. You can see if the budget has been exceeded with a delegate in the WF.

    For 1hz HR, you want to use Activity.Info.currentHeartRate, as getHeartRateHistory only updates every couple minutes. You may want to get get seconds working before you try to add hr.

    Take a look at the thread and sample and ask if you have questions.
    My Connect IQ Apps in the Store
    Facebook - Instagram -
    Twitter

    Comment


    • #3
      Thank you very much. I will spend some time digesting all of this and post back when I've resolved it or if I continue to have problems connecting the dots.

      Comment


      • #4
        Jim,

        Just wanted to thank you again and give you a quick update on my progress so you'd know that your assistance didn't fall on deaf ears. When I originally posted my question, I didn't realize I was exceeding the power budget. However, after I implemented your delegate code I could see that I was, in fact, exceeding it. So, the first thing I started doing to decrease usage was to start using setClip(). That helped. However, after trying every trick I could think of (including skipping a few seconds), I was still not able to stay within the budget. The fonts I was using to display the time of day and the seconds were custom fonts. I ended up compromising on the custom fonts for seconds. It appears that they take too long to load up from file. I ended up having to use Gfx.FONT_LARGE for the seconds. That keeps me below the budget.

        My code is a mess after all of the experimenting. So, I have a lot of clean up and abstracting to do. But, at least it's usable and turned out close to exactly like what I wanted. I originally planned to include icons. But, I think everything is obvious without them and it's cleaner and allows for bigger fonts. The whole purpose of me doing this was because I couldn't find a watchface with large enough numbers and included all of the fields I wanted to see at a glance. I need reading glasses but, I don't wear them all of the time. There were a lot of watchfaces that were close, but not exactly like I wanted. I still think other people might benefit from it. So, I'll probably try to polish it up and get it on ConnectIQ.

        I've attached a screenshot of the simulator.

        Comment


        • #5
          Oh, one thing about onPartialUpdate. You should load things like custom fonts once (I do it in onLayout() or initialize()) to keep onPartialUpdate as minimal as possible. In your picture you should have a clip for just the seconds and another for just the HR, but the "cost" will be the rows from the top of the seconds to bottom of HR. You'd save a bit if you swapped the date and HR. Also, before you set the clip region for the HR, see if you need to update it. If it's not changed since it was last displayed, only do the seconds.
          My Connect IQ Apps in the Store
          Facebook - Instagram -
          Twitter

          Comment


          • #6
            Oh wait. I don't think you're doing HR! I was thinking of another thread. But here's a couple of mine where I do 1hz and custom fonts for time Simple Big and Four Fields. In Four Fields, I use 1hz for HR too. The picture is a bit old as I user a custom font for icons there now. (a heart for HR that needs to be redrawn when the HR changes as it can be 2 or 3 digits)
            My Connect IQ Apps in the Store
            Facebook - Instagram -
            Twitter

            Comment


            • #7
              Originally posted by jim_m_58 View Post
              Oh, one thing about onPartialUpdate. You should load things like custom fonts once (I do it in onLayout() or initialize()) to keep onPartialUpdate as minimal as possible. In your picture you should have a clip for just the seconds and another for just the HR, but the "cost" will be the rows from the top of the seconds to bottom of HR. You'd save a bit if you swapped the date and HR. Also, before you set the clip region for the HR, see if you need to update it. If it's not changed since it was last displayed, only do the seconds.
              I'll have to research the preloading stuff. Right now, I'm actually pretty happy with the way it looks. The smaller seconds font actually look better than the colon separated time (like HH:MM:SS) that I originally planned. I also need to clean up my unused code, comments and abstract some of my hard coded positioning.

              I have read other posts where you've described the cost is higher with rows than columns due to the way the screen repaints. I tried to keep that in mind. I also read a post that describes the drawing area grows to encompass all clips and that the suggestion was to move the redrawable areas closer to each other. I took a different approach. I was setting a clip, drawing the seconds, clearing the clip, setting a new clip and drawing the HR.

              I also took your advice and verify the HR changes before updating it.

              Another idea that I had for the seconds was to use a polygon to draw a circle around the perimeter. I found some code to help with that here: https://forums.garmin.com/forum/deve...588#post678588. But, the first time I tried it, it was way over budget.

              In response to your other reply, yes, I'm doing HR. I did it in red.

              Comment


              • #8
                Originally posted by jim_m_58 View Post
                Oh wait. I don't think you're doing HR! I was thinking of another thread. But here's a couple of mine where I do 1hz and custom fonts for time Simple Big and Four Fields. In Four Fields, I use 1hz for HR too. The picture is a bit old as I user a custom font for icons there now. (a heart for HR that needs to be redrawn when the HR changes as it can be 2 or 3 digits)
                Yeah. I can relate to the icon changing positions. I tried drawing 3 different sized clips for the HR based on the digits that needed to be updated. But, when you're centering the numbers on the screen and the numbers are going back and forth between 2 or 3 digits, there are several scenarios that require a good bit of math to locate the X coordinate. In the end, I figured it was less expensive to just set the clip to cover all 3 places every time.

                Comment

                Working...
                X