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();

  • Hello Travis, yeah I am learning a lot through this process but I'd rather not have headaches for the end-user nor me... LOL

    I still have the same glitch on my end where #1) the second hand glitches and #2) the watch face crashes in the sim and on the device. When it glitches on the device it goes to the factory watch face setting while on the sim it goes to the famous broken screen.

    Here is what I currently have in the onPartialUpdate section. Where and how should I modify the code?

      function onPartialUpdate( dc ) {
        if (!fullScreenRefresh) {
          drawBackground(dc);
        }
    
        var clockTime = System.getClockTime();
        var secondHand = (clockTime.sec / 60.0) * Math.PI * 2;
        var secondHandPoints = generateHandCoordinates(screenCenterPoint, secondHand, 130, 20, 2);
    
        // 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(generateHandCoordinates(screenCenterPoint, secondHand, 130, 20, 2));
    }

  • I'm not sure what you need to fix. Typically crash logs or ERA reports tell you where to look for failures. If you have this information, I'd use it to find the code that is causing problems and then look there.

    Just looking at the code, I have a few questions:

    1. if you're not doing a full screen refresh, you draw the background. i.e., if you're actually doing a partial update you draw the full screen? That seems backward. I think what you actually want to do is determine the area that used to be under the second hand, set the clip area, draw the background and anything else that may have been obscured by the second hand, and then reset the clip area to the position of the new second hand and draw that. It has been a while since I did an analog watch face with partial update support, so I could be missing something.
    2. You are calling generateHandCoordinates twice with the same parameters. This is wasteful. You could just pass secondHandPoints to fillPolygon and save yourself a bunch of calculations.
  • Unfortunately, I do not get any ERA reports after launching the sim. The settings allow me to modify b/w digital & analog. The moment I switch on Low Power Mode, the seconds hand repeats itself without erasing the previous ones...if that makes sense. The picture included below shows what it looks like. 

    re: your questions

    1. On the if( partialUpdatesAllowed, it currently has getProperty for the foreground color and generate second hand. Then on the actual function onPartialUpdate, the code I presented before remains the same. I've been using the SDK as a guide for this.

    How do I reset the clip area? I just looked at the Analog SDK again and its coded similar to how I presented here.

    2. Same for the parameter. I have been using the analog SDK to manage the writing of the code. So you are suggesting I update to var fillPolygon in lieu of var secondHandPoints? I do have targetDc.fillPolygon for hour and minute hands.