Hi Community,
I try to make a Watchface for Venu 2(S), which uses the compass/heading. Using Activity.getActivityInfo().currentHeading works great in simulator, but on my Venu 2S (v5.08) the radians stop updating after a few seconds and never update again. I am looking for a similar behaviour as the "orange" original Garmin watchface (see image), which seems to be able to use "currentHeading" all the time with about 1Hz samplerate without freezing.
This is a minimal setup to showcase/reproduce the issue. I use the "Default SDK 4.0 Watchface"-Project and Update the "View.mc" to this:
import Toybox.Graphics; import Toybox.Lang; import Toybox.System; import Toybox.WatchUi; using Toybox.Sensor; using Toybox.Math; using Toybox.System; class testView extends WatchUi.WatchFace { function initialize() { WatchFace.initialize(); } function onLayout(dc as Dc) as Void { setLayout(Rez.Layouts.WatchFace(dc)); } function onShow() as Void { } function onUpdate(dc as Dc) as Void { var clockTime = System.getClockTime(); var t = Lang.format("rad $1$ \nrand $2$", [Sensor.getInfo().heading, Math.rand().format("%02d")]); var v = View.findDrawableById("TimeLabel"); v.setText(t); View.onUpdate(dc); } function onHide() as Void { } function onExitSleep() as Void { } function onEnterSleep() as Void { } }
To make sure its really only the "currentHeading"-variable that freezes, I print a random number within the same textbox that I update (feel free to replace for clocktime-"seconds"). When running this in simulator, both lines update once per second - like expected. When running this on my Venu 2S,the random number updates every second, but the currentHeading instantly freezes or freezes after a few seconds (couldnt find any pattern yet).
What am I doing wrong? Is the source code for the orange garmin watchface public?
Thank you for your help.