Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getHeartRate(am) {
- var heartRate = Activity.getActivityInfo().currentHeartRate;
- if (heartRate == null) {
- if (am has :getHeartRateHistory) {
- var HRH = am.getHeartRateHistory(1, true);
- var HRS = HRH.next();
- if (HRS != null && HRS.heartRate != ActivityMonitor.INVALID_HR_SAMPLE) {
- heartRate = HRS.heartRate;
- }
- }
- }
- if (heartRate != null) {
- return heartRate;
- } else {
- return "--";
- }
- }
- function getMaxHr() {
- try {
- var currentSport = UserProfile.getCurrentSport();
- if (currentSport != null) {
- var zones = UserProfile.getHeartRateZones(currentSport);
- if (zones instanceof Toybox.Lang.Array) {
- return zones[5];
- }
- }
- }
- catch (e) { }
- return 185;
- }
Advertisement
Add Comment
Please, Sign In to add comment