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.

  • Re: "I guess you are too young to understand "divide by zero"  Slight smile  Did you also use "3" for pi in school?  Slight smile"

    Actually you might have broken the law, cause pi is 3.2:

    www.forbes.com/.../

  • You forgot to tell us what is the problem in the logs, but to state the obvious based on the info you gave: one second later both the minute and the hour change...

  • The problem is that the app went from being in the middle of onUpdate to a sudden restart with no errors or CIQ logs generated. Last night the log has this:

    jday 2023-01-26 04:27:59.609
    _batteryLevels [[8425.718521, 87.621094], [8425.936951, 85.593750], [8425.936951, 85.593750]]
    _batteryRate 9.281428
    AppBase onStop  <-- message from where it says, this is the last entry in the log.

    And the face was frozen in a half updated state. Again no CIQ logs. Why is the watch face being what seems to be randomly stopped?

  • what device do you have? what firmware version?

    does it happen also in simulator?

  • Fenix 7x Solar

    Part-Number: 006-B3907-00
    Firmware-Version: '10.44'
    Language-Code: eng
    ConnectIQ-Version: 4.1.7

    I haven't seen it in the simulator yet. I'm restarting frequently during the day, but I usually let it run at night.

  • When onUpdate() is called does your WF always redraw the entire screen?  (not just parts)  if you set clip regions, have they been cleared where you update the screen?

    Do you have a background service?  If so, onStart() and onStop() run each time the background runs.  I'm thinking maybe that's what you see in the log - onStop from the background

  • Do you have energy saving ON during sleep hours?

  • The battery saver is not on in sleep mode, and the watch face set to not change in sleep mode. Also I have the O2 sensor set to run at while sleeping.

  • jday 2023-01-26 21:59:59.801
    _batteryLevels [[8425.958577, 87.609375], [8426.667509, 85.105469], [8426.470465, 85.582031]]
    _batteryRate 3.531942
    AppBase onStop
    starting AppBase
    AppBase onStart
    bYear 1964, age 59, _hrMax 161
    _jStart 2023-01-26 22:00:00.635
    jday 2023-01-27 05:59:59.970
    _batteryLevels [[8426.667519, 85.042969], [8427.000845, 82.054688], [8426.893900, 83.019531]]
    _batteryRate 8.965051
    AppBase onStop
    starting AppBase
    AppBase onStart
    bYear 1964, age 59, _hrMax 161
    _jStart 2023-01-27 06:00:00.668
    jday 2023-01-27 13:59:59.772
    _batteryLevels [[8427.000853, 82.042969], [8427.334176, 81.136719], [8427.000847, 82.042969]]
    _batteryRate 2.718835
    AppBase onStop

    It seems that watchfaces restart based on our sleep schedule we have configured in the app, so probably has something to do with the service delegate. The only reason I know now is because I've been trying to track something over a few days, and now I see that I will have to save some data in storage if I want to keep trying.

  • You have said 'no background' and now have mentioned 'service delegate'.

    So, do you have (:background) annotation in app class?