Simulator and API questions

1. Is it possible to get the profiler to start when the simulator starts? I would like to see the times of initialize, onLayout, and a few other routines that run at startup.

2. What do I need to do to get the "Watchface Diagnostics" to show anything other than all zeros? The watch face itself is working.

3. Is there a way to get the simulated watch face to look more like the real thing? A screen shot would be useless to show off.

4. Is it possible to get WatchFacePowerInfo.executionTimeAverage while the watch face is running? I only get a null value.

5. The watch is apparently tracking my heart rate most if not all the time. Is it possible to get the current heart rate while the watch face is awake? I am not looking for it in low power / sleep mode. The methods I have tried so far all return null.

6. Maybe the hard one: Can I get the compass while the watch is awake? If not directly then would it be possible to get a background service to read it?

  • 5 is certainly possible, i had seen exactly that on multiple CIQ eatchfaces

  • 1.  Use the -k compiler flag

    2.  That really most useful when the WF is in low power mode and upi are using onPartialUpdate.  The number at the top is the power buger.  You want the avg to be under 30000

    3.  It should look close.  Colors may look different, especually for MIP devices

    4.  See #2

    5.  Use Activity.getActivityInfo().currentHeartRate.  It will be null if you take off the watch.  I use this in many WFs.  The f5x is a bit different though,  There you use the newest sample from getHeartRateHistory()

    6. You can't access Sensor in a WF.  You can in a WF's background Service, but you probably want it more than every 5 minutes.

  • 1. I'm using VS Code. I can't find where to set it, and the internet points me to files I don't have. It's M$, so if it's a setting somewhere they've gone above and beyond their usual counter intuitiveness. It's doing this when I click run:

    Executing task in folder Annulus: C:\Program Files (x86)\Common Files\Oracle\Java\javapath\java.exe -Xms1g -Dfile.encoding=UTF-8 -Dapple.awt.UIElement=true -jar c:\Users\Andy\AppData\Roaming\Garmin\ConnectIQ\Sdks\connectiq-sdk-win-4.1.7-2022-11-21-562b8a195\bin\monkeybrains.jar -o bin\Annulus.prg -f c:\Users\Andy\Desktop\Garmin-GIT\Annulus\monkey.jungle -y c:\Users\Andy\developer_key -d fenix7x_sim -w

    2. Watch face diagnostics only works in low power mode? OK, good to know. Doing just one drawBitmap to draw the whole screen blows the power budget, so I'm having to use awake vs sleeping to control what's on the screen.

    3. At least the watch itself is the one that looks better.

    5. I'm already using

    import Toybox.Activity;
    private var _actInfo;
    _actInfo = Activity.getActivityInfo();
    if (_actInfo has :currentHeartRate) {
    	var hr = Activity.Info.currentHeartRate;
    but it only returns null. What else do I need to do? Does it only work if an activity is active? If so how does the watch know when I don't have an activity on? Or is fenix 7x like the five and I have to get it from history?

    6. Sounds like a challenge!

  • 2. In onUpdate you should really just draw on the dc. And all the calculations should be done beforehand and saved to class variables.

  • 	private function drawScreen(dc as Dc) as Void {
    		if (_fullFaceBuffer != null) {
    			dc.drawBitmap(0, 0, _fullFaceBuffer);
    		}
    	}

    This one function takes 23000+ according to the simulator. On the real watch it takes 58000+ which shuts down partial updates according to the log file. Yes, all the work is being done elsewhere.

  • How do I get it to work on the watch itself and not return null?

  • 1. I'm using VS Code. I can't find where to set it, and the internet points me to files I don't have. It's M$, so if it's a setting somewhere they've gone above and beyond their usual counter intuitiveness. It's doing this when I click run:

    It's in the settings for the Monkey C Extention

  • You have Activity.Info.currentHeartRate where you want to have

    _actInfo.currentHeartRate

  • on sim you have press play and  hr/body batterry spo2 won't null (but most of them shortly max and const, spo2 100, HR 162....)

    import Toybox.Activity;

    var _actInfo = Activity.getActivityInfo();
    var hr = _actInfo ? _actInfo.currentHeartRate : null;
    //hr can be null of course...