Question about available data in widget

1 Question:
I have written a Sunrise & Sunset widget witch needs to have a position for calculations....
The "Module: Toybox::Position" is available in widgets, but does it supply position info when not in an activity? Is the last known location reported?
I have no hardware to test yet, and the simulator needs simulated data to report positions... I hope real watches will report last known location...

2 Question:
Is the "var status = Sensor.getInfo();" available with "status.heading;" beeing set to compass in widget when not in an activity? It would be nice to point to the moon if not visible...
  • The "Module: Toybox::Position" is available in widgets, but does it supply position info when not in an activity? Is the last known location reported?

    Yes. The Position.Info returned by Position.getInfo() has am accuracy field that tells you how good the GPS fix is, and the when field can be used to determine how old the fix is. It seems that your widget should probably check the accuracy and timestamp fields, and if they indicate a stale fix you could register for a one-time position update.

    Is the "var status = Sensor.getInfo();" available with "status.heading;" beeing set to compass in widget when not in an activity? It would be nice to point to the moon if not visible...

    Yes. I have a test widget that displays that status of the sensor fields, and the heading field does indeed have data. The altitude, cadence, pressure and speed fields have values as well (3.07 beta on a 920XT). I don't have access to my code at the moment, but either I have a bug (it looks like I'm applying the wrong conversion) or there is some issue with the data coming in for the heading. I'm guessing it is my issue.
  • Thank you very much for the detailed answer.

    It sometimes is quite difficult to develop without hardware and a quite limited simulator. Everything is as I expected or hoped. Good!

    The heading by the way from the simulator is in radiant, maybe you expected something like degree?

    Thank you once again!
  • The heading by the way from the simulator is in radiant, maybe you expected something like degree?

    I'm certain that I knew it was radians, but I could have easily have flipped the terms in the conversion operation (i.e. 180 / Math.PI is very different from Math.PI / 180).

    Travis