Skip to content

Commit

Permalink
fix hrm max setting
Browse files Browse the repository at this point in the history
  • Loading branch information
thyttan committed Feb 22, 2023
1 parent 52c5970 commit 4494b48
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion apps/run/app.js
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions 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.
Expand All @@ -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;}
Expand Down
2 changes: 1 addition & 1 deletion apps/run/settings.js
Expand Up @@ -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;
Expand Down

0 comments on commit 4494b48

Please sign in to comment.