Symbol lookup best practices?

Most of the time the simulator starts without a problem, but sometimes I get this when I start:

Error: Invalid Value

Details: Failed invoking <symbol>
Stack:
- onUpdate() at C:\Users\Andy\Desktop\Garmin-GIT\Annulus\source\AnnulusView.mc:735 0x10002514

Encountered app crash.
Kill app for run the app
Failed to run the app: Timeout

What's worse it's happening on the watch, after a day or so onUpdate will stop updating when awake, but it does keep updating every minute awake or not. I get something similar in a CIQ_LOG file. I reselect the watch face and it's fine, at least for a while.

Can I fix this by helping the lookup process? I don't have any globals beyond Toybox, so do I use self to say it's a variable or function in the same class? Does a symbol need to be looked up everytime that piece of code is run, or does it remember after the first time? It seems like if it was remembering where it was it wouldn't break the next day.

  • No decorations of any kind in the code yet. Isn't the service delegate is required for partial update and power budget?

  • You need only onPartialUpdate but if you want to handle power budget you need WatchFaceDelegate.

    What permissions do you have in manifest?

  • <iq:permissions>
    <iq:uses-permission id="Positioning"/>
    <iq:uses-permission id="SensorHistory"/>
    <iq:uses-permission id="UserProfile"/>
    </iq:permissions>

  • System behaves "strange" if you have permission and don't use anything form it's module.

    As you haven't published code - it's blind seeking. So first thing is to exclude firmware bug, watch settings etc.

    Install any CIQ watch face form store and check if it freeze too.

    You use buffered bitmaps so maybe you face problem described in

    forums.garmin.com/.../multiple-watch-faces-crashing-simultaneously-with-out-of-memory-error-minimal-repro-app-included

  • I used another watchface before this one I'm trying to write, it was fairly simple and didn't have any problems. Freezing is probably not the right description. The minute hand keeps moves every minute like it should, but the second hand, which is only drawn when awake is true, is on zero (12 o'clock) and not moving. onUpdate clears the dc with black every time it runs, so I would think the second hand would go away eventually. Why it's shown at all and not moving I don't understand. It only happens with SOME restarts. I didn't see it this morning after it restarted twice last night.

  • seconds hand is drawn at 0 second in onUpdate at 1-59 sec. in onPartialUpdate. I you exceed power budget  onPartialUpdate is never called again (as I remember to the newer version of app or after restarting watch) so you can see drowning from 0 sec.

    You have remember that watch face can start in lowpower so flow can be

    view.initialize()

    view.onEnterSleep()

    ...

  • I'm not using partial update right now because I'm still a little over 30ms per second, so I'm having to use onUpdate and check to see if awake (set by onExitSleep) is true to draw the second hand. When onEnterSleep calls requestUpdate it clears the second hand like it should every other time . If I can get it below that then I can try partial updates always on second hand again. I'm not using it, but it's still there in case I might need it.

  • in low power onUpdate is called only every full minutes so if you don't use onPartialUpdate no way to draw anything at 1-59s. Choose in sim low power mode and you will see effect of your code.

  • Yes, that's why when onEnterSleep calls requestUpdate it clears the second hand so only the minute and hour hands (and ticks and other stuff that doesn't change much) stays on the screen until the next time seconds = 0.

  • I'm thinking you may be a bit confused about the names of onEnterSleep() and onExitSleep().  They have nothing to do with sleep tomes, and the watch face is always awake.

    It was a bad chose of names in my opinion, but it's been that way since day 1.

    onEnterSleep() means onUpdate will now be called only once a minute while onExitSleep() means onUpdate will now be called every second (for about 10 seconds on real devices).  (what is commonly called "low power mode")