From 4494b4863f688ade6b5e7958a68c5ba709628adf Mon Sep 17 00:00:00 2001 From: thyttan <6uuxstm66@mozmail.comā©> Date: Sun, 19 Feb 2023 12:28:33 +0100 Subject: [PATCH] fix hrm max setting --- apps/run/app.js | 2 +- apps/run/karvonnen.js | 6 +++--- apps/run/settings.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/run/app.js b/apps/run/app.js index 0d3b3e57a8..266b2d90ad 100644 --- a/apps/run/app.js +++ b/apps/run/app.js @@ -178,7 +178,7 @@ function stopRunUI() { // Define the function to go back and foth between the different UI's function swipeHandler(LR,_) { if (LR==-1 && karvonnenActive && !isMenuDisplayed) run(); - if (LR==1 && !karvonnenActive && !isMenuDisplayed) {stopRunUI(); require("run_karvonnen").show();} + if (LR==1 && !karvonnenActive && !isMenuDisplayed) {stopRunUI(); require("run_karvonnen").show(settings.HRM);} } // Listen for swipes with the swipeHandler diff --git a/apps/run/karvonnen.js b/apps/run/karvonnen.js index c1673f8621..54be4458c0 100644 --- a/apps/run/karvonnen.js +++ b/apps/run/karvonnen.js @@ -1,5 +1,5 @@ // Korvonnen pasted inside a function -exports.show = function karvonnen() { +exports.show = function karvonnen(hrmSettings) { //This app is an extra feature implementation for the Run.app of the bangle.js. It's called run+ //The calculation of the Heart Rate Zones is based on the Karvonnen method. It requires to know maximum and minimum heart rates. More precise calculation methods require a lab. //Other methods are even more approximative. @@ -18,8 +18,8 @@ exports.show = function karvonnen() { // HRR = maximum HR - Minimum HR. minhr is minimum hr, maxhr is maximum hr. //get the hrr (heart rate reserve). // I put random data here, but this has to come as a menu in the settings section so that users can change it. - let minhr = 48; - let maxhr = 187; + let minhr = hrmSettings.min; + let maxhr = hrmSettings.max; function calculatehrr(minhr, maxhr) { return maxhr - minhr;} diff --git a/apps/run/settings.js b/apps/run/settings.js index fa7af36dcb..8d44293bf3 100644 --- a/apps/run/settings.js +++ b/apps/run/settings.js @@ -146,7 +146,7 @@ } hrmMenu[/*LANG*/"max"] = { min: 120, max: 190, - value: settings.HRM.min|165, + value: settings.HRM.max|165, format: v => v, onchange: v => { settings[HRM][max] = v;