HELP: Seconds Hand in Simulator Works, but not on Device (Glitch)

Hello,

The seconds hand in my analog simulator and device shows the second hand with a serious glitch (picture included)...basically every second...on power mode.

Then after several more seconds (on device) the watch face disappears and goes to one of the Garmin Factory Setting Watch Faces.

I've included the enter sleep and exit sleep code below. Any help will be truly helpful.

    function onEnterSleep() {
        isAwake = false;
        showSeconds=false;
        WatchUi.requestUpdate();
    }

    function onExitSleep() {
        isAwake = true;
        showSeconds=true;
        WatchUi.requestUpdate();

  • Have you run with settings set for low Power Mode in the sim?  This is the way a real device will run most of the time.

    Are you trying to use onPartialUpdate?  If so, have you opened Watch Face Diagnostics while running in low power mode and watched for at least a minute?  Do you have a delegate for when you exceed the power budget in onPartialUpdate?

    Do you redraw the entire watch face when onUpdate is called?

  • Hello Jim,

    re: low Power Mode

    Yes, I have used the low power mode in the sim and it also shows this glitch. Complete oversight on my part to upload and not selecting that setting in the simulator. 

    re: Sim

    I also ran the "Time Simulation" with multiple speed factors on low power mode plus just opened the drag...same results.

    re: onPartialUpdate

    I do not necessarily need the onPartialUpdate (or do I)? I used the Analog SDK as a template to build the analog. 

    re: Delegate

    The delegate reads as follows:

    class AnalogDelegate extends WatchUi.WatchFaceDelegate {

        function initialize() {

            WatchFaceDelegate.initialize();

        }

        function onPowerBudgetExceeded(powerInfo) {

            System.println( "Average execution time: " + powerInfo.executionTimeAverage );

            System.println( "Allowed execution time: " + powerInfo.executionTimeLimit );

            partialUpdatesAllowed = false;

  • But does the delegate ever get called?

    First thing I'd do is comment out your onPartuialUpdate code and see if it works

  • I am using the Analog SDK as my template. I do not see the delegate being called or comment out in the SDK. Unless, I am looking in the wrong line(s)...?

  • I put  dc.drawBitmap(width/2-bmWidth/2,0, bitmap); at the end of the onPartialUpdate.

    I also tried bitmap = WatchUi.loadResource(Rez at the end.

    I guess I am not sure what comment out means. I also searched throughout the forum and tried the 1hz solution...

    I am a bit lost at this point...

  • Get things to work with onPartialUpdate commented out in your code.  You won't see the second hand all the time, but get back to something that works, and then add parts of onPartialUpdate until things break.

    In onParticalUpdate you "might" be able to update 1/2 the rows on the screen. And you want to avoid things like loading resources in onPartialUpdate, as that will impact the power budget.

  • Got it. Things broke when I drew the second hand to the screen. It worked with the "curClip:"...

            // Update the cliping rectangle to the new location of the second hand.

            curClip = getBoundingBox( secondHandPoints );

            var bboxWidth = curClip[1][0] - curClip[0][0] + 1;

            var bboxHeight = curClip[1][1] - curClip[0][1] + 1;

            dc.setClip(curClip[0][0], curClip[0][1], bboxWidth, bboxHeight);

            // Draw the second hand to the screen.

            dc.setColor(Application.getApp().getProperty("ForegroundColor"),Graphics.COLOR_TRANSPARENT);

            dc.fillPolygon(secondHandPoints);

  • I suspect you may not be using clearClip() properly.

    And getProperty is something you don't want to do in onParticalUpdate.  The color should already be known and it cuts into your power budget.

  • Correct on the Clips. Is the Clip needed? What is it for...?

    I removed that part and kept the secondhand dc. That did not work either. 

    I do use targetdc to generate the hand and minute hands. I tried updating the seconds hand with the target but that didn't work either.

    The second hand just disappears...

  • I put  dc.drawBitmap(width/2-bmWidth/2,0, bitmap); at the end of the onPartialUpdate.

    I also tried bitmap = WatchUi.loadResource(Rez at the end.

    Do not load resources in the onPartialUpdate. Loading resources is extremely slow and will cause you future headaches.