Heart rate freezes on Venu 2/Venu 2 Plus on one of my watch faces

I have a watch face that displays the current heart rate. However, one of our Venu 2 customer (Firmware version 8.11) claims the heart rate is frozen at 44.

I cannot repro this issue on my Venu device. Can anyone read the code below and tell us if there is anything in the code that can cause the heart rate to freeze at a particular value?

--------------------------------------------------------------
var hrm = info.HeartRateSample.heartRate;
var hrmString = "--";
if (hrm != ActivityMonitor.INVALID_HR_SAMPLE && hrm != null) {
hrmString = hrm.toString();
System.println("current");
}
else if (ActivityMonitor has :getHeartRateHistory){
hrm = ActivityMonitor.getHeartRateHistory(1, true).next();
if ((hrm != null) && (hrm.heartRate != ActivityMonitor.INVALID_HR_SAMPLE)){
hrmString = hrm.heartRate.toString();
System.println("history");
}
}
else {
hrmString = "--";
}
---------------------------------------------------------

My Development enviroment:

Mac: OS 12.1

VS code

Garmin SDK 4.0.9 used as current SDK

Tested on a physical Garmin Venu with no issues.

---------------------------------------------------------

  • On a real device, if the watch is taken off or WHR is turned off it won't change.  Could be if  Activity Monitor is turned off too.

  • The tricky part is the customer switched to another clock face and the heart rate displays properly. He uninstalled and reinstalled our clock face and back to the frozen heartrate.

    The exact same watch face on my Venu works just fine! Heart rate updates normally.

    That's why I cannot understand why only for my clock face his heart rate is frozen?

    As per current documentation, is this the right way to get the current heart rate ->

    ActivityMonitor.HeartRateSample.heartRate
  • I'm not sure what you are doing here:
    var hrm = info.HeartRateSample.heartRate;

    To get the real time HR,

    you use

    Activity.getActivityInfo().currentHeartRate,  If it's null, then you fall back to getHeartRateHistory()

  • Okay, got confused between Activity and ActivityMonitor classes. One has the current heart rate and one has the history.

    So, is the code below good:

    var hrm = Activity.getActivityInfo().currentHeartRate;
    var hrmString = "--";
    if (hrm != ActivityMonitor.INVALID_HR_SAMPLE && hrm != null) {
    hrmString = hrm.toString();
    }
    else if (ActivityMonitor has :getHeartRateHistory){
       hrm = ActivityMonitor.getHeartRateHistory(1, true).next();
       if ((hrm != null) && (hrm.heartRate != ActivityMonitor.INVALID_HR_SAMPLE)){
          hrmString = hrm.heartRate.toString();
       }
    }
    else {
    hrmString = "--";
    }
    heartLabel.setText(hrmString);