From 5a88d681bcd3183d795fecebf95d0649183ad833 Mon Sep 17 00:00:00 2001 From: Danfro Date: Mon, 14 Oct 2024 16:37:34 +0200 Subject: [PATCH 1/6] rename download to upload since files are uploaded onto the device --- ui/qml/pages/BipFirmwarePage.qml | 4 ++-- ui/qml/pages/FirstPage.qml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/qml/pages/BipFirmwarePage.qml b/ui/qml/pages/BipFirmwarePage.qml index d9eaf496..8e87cfbf 100644 --- a/ui/qml/pages/BipFirmwarePage.qml +++ b/ui/qml/pages/BipFirmwarePage.qml @@ -4,7 +4,7 @@ import "../components/platform" PagePL { id: page - title: qsTr("Download File") + title: qsTr("Upload File") property string selectedFile: qsTr("None") property string fileVersion @@ -19,7 +19,7 @@ PagePL { LabelPL { width: parent.width - text: qsTr("Select a file to download."); + text: qsTr("Select a file to upload."); } ValueButtonPL { diff --git a/ui/qml/pages/FirstPage.qml b/ui/qml/pages/FirstPage.qml index 57b4f476..7b637e95 100644 --- a/ui/qml/pages/FirstPage.qml +++ b/ui/qml/pages/FirstPage.qml @@ -30,7 +30,7 @@ PagePL { } } PageMenuItemPL { - text: qsTr("Download File") + text: qsTr("Upload File") onClicked: app.pages.push(Qt.resolvedUrl("BipFirmwarePage.qml")) } PageMenuItemPL { From d7b81290e236ae08f8033a1b117cea52116f7674 Mon Sep 17 00:00:00 2001 From: Danfro Date: Thu, 24 Oct 2024 22:53:38 +0200 Subject: [PATCH 2/6] rename upload to install as discussed --- ui/qml/pages/BipFirmwarePage.qml | 4 ++-- ui/qml/pages/FirstPage.qml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/qml/pages/BipFirmwarePage.qml b/ui/qml/pages/BipFirmwarePage.qml index 8e87cfbf..fc5c4bb3 100644 --- a/ui/qml/pages/BipFirmwarePage.qml +++ b/ui/qml/pages/BipFirmwarePage.qml @@ -4,7 +4,7 @@ import "../components/platform" PagePL { id: page - title: qsTr("Upload File") + title: qsTr("Install File") property string selectedFile: qsTr("None") property string fileVersion @@ -19,7 +19,7 @@ PagePL { LabelPL { width: parent.width - text: qsTr("Select a file to upload."); + text: qsTr("Select a file to install."); } ValueButtonPL { diff --git a/ui/qml/pages/FirstPage.qml b/ui/qml/pages/FirstPage.qml index 7b637e95..ac72f1d5 100644 --- a/ui/qml/pages/FirstPage.qml +++ b/ui/qml/pages/FirstPage.qml @@ -30,7 +30,7 @@ PagePL { } } PageMenuItemPL { - text: qsTr("Upload File") + text: qsTr("Install File") onClicked: app.pages.push(Qt.resolvedUrl("BipFirmwarePage.qml")) } PageMenuItemPL { From 8608a25a4f84122e564a0d818372e793ce467afe Mon Sep 17 00:00:00 2001 From: Danfro Date: Thu, 24 Oct 2024 23:04:42 +0200 Subject: [PATCH 3/6] add column with bpm tresholds and use round instead of floor to avoid larger differences to 100% sum --- ui/qml/pages/HeartratePage.qml | 62 ++++++++++++++++++++++------------ 1 file changed, 41 insertions(+), 21 deletions(-) diff --git a/ui/qml/pages/HeartratePage.qml b/ui/qml/pages/HeartratePage.qml index f820ea97..7d2215eb 100644 --- a/ui/qml/pages/HeartratePage.qml +++ b/ui/qml/pages/HeartratePage.qml @@ -85,45 +85,65 @@ PagePL { //Type summary Grid { - columns: 2 + columns: 3 spacing: styler.themePaddingMedium - width: parent.width - LabelPL { text: qsTr("Relaxed") } - Item { width: parent.width * 0.5; height: 50 + width: parent.width - (styler.themePaddingMedium * 2) + LabelPL {text: qsTr("Relaxed")} + Item { + width: parent.width * 0.5 + height: 50 Rectangle { color: "grey"; width: parent.width * (relaxed / total) ; height: parent.height } - LabelPL { text: Math.floor((relaxed / total) * 100) + "%"; anchors.centerIn: parent} + LabelPL { text: Math.round((relaxed / total) * 100) + "%"; anchors.centerIn: parent} } - LabelPL { text: qsTr("Light") } - Item { width: parent.width * 0.5; height: 50 + LabelPL {text: qsTr("<= %1 BPM".arg(Math.round(maxHR()*0.5)))} + + LabelPL {text: qsTr("Light")} + Item { + width: parent.width * 0.5 + height: 50 Rectangle { color: "lightblue"; width: parent.width * (light / total) ; height: parent.height } - LabelPL { text: Math.floor((light / total) * 100) + "%"; anchors.centerIn: parent} + LabelPL { text: Math.round((light / total) * 100) + "%"; anchors.centerIn: parent} } - LabelPL { text: qsTr("Intensive")} - Item { width: parent.width * 0.5; height: 50 + LabelPL {text: qsTr("<= %1 BPM".arg(Math.round(maxHR()*0.6)))} + + LabelPL {text: qsTr("Intensive")} + Item { + width: parent.width * 0.5 + height: 50 Rectangle { color: "green"; width: parent.width * (intensive / total) ; height: parent.height } - LabelPL { text: Math.floor((intensive / total) * 100) + "%"; anchors.centerIn: parent} + LabelPL { text: Math.round((intensive / total) * 100) + "%"; anchors.centerIn: parent} } - LabelPL { text: qsTr("Aerobic")} - Item { width: parent.width * 0.5; height: 50 + LabelPL {text: qsTr("<= %1 BPM".arg(Math.round(maxHR()*0.7)))} + + LabelPL {text: qsTr("Aerobic")} + Item { + width: parent.width * 0.5 + height: 50 Rectangle { color: "yellow"; width: parent.width * (aerobic / total) ; height: parent.height } - LabelPL { text: Math.floor((aerobic / total) * 100) + "%"; anchors.centerIn: parent} + LabelPL { text: Math.round((aerobic / total) * 100) + "%"; anchors.centerIn: parent} } + LabelPL {text: qsTr("<= %1 BPM".arg(Math.round(maxHR()*0.8)))} - LabelPL { text: qsTr("Anerobic")} - Item { width: parent.width * 0.5; height: 50 + LabelPL {text: qsTr("Anerobic")} + Item { + width: parent.width * 0.5 + height: 50 Rectangle { color: "orange"; width: parent.width * (anerobic / total) ; height: parent.height } - LabelPL { text: Math.floor((anerobic / total) * 100) + "%"; anchors.centerIn: parent} + LabelPL { text: Math.round((anerobic / total) * 100) + "%"; anchors.centerIn: parent} } + LabelPL {text: qsTr("<= %1 BPM".arg(Math.round(maxHR()*0.9)))} - LabelPL { text: qsTr("VO2 Max") } - Item { width: parent.width * 0.5; height: 50 + LabelPL {text: qsTr("VO2 Max")} + Item { + width: parent.width * 0.5 + height: 50 Rectangle { color: "red"; width: parent.width * (vo2max / total) ; height: parent.height } - LabelPL { text: Math.floor((vo2max / total) * 100) + "%"; anchors.centerIn: parent} + LabelPL { text: Math.round((vo2max / total) * 100) + "%"; anchors.centerIn: parent} } + LabelPL {text: qsTr("<= %1 BPM".arg(Math.round(maxHR())))} } } - function updateGraphs() { graphHR.updateGraph(day); calculateZones(); From ca607d2c89c7f718b4ae6c2df68030184373a08b Mon Sep 17 00:00:00 2001 From: Danfro Date: Fri, 25 Oct 2024 12:55:25 +0200 Subject: [PATCH 4/6] =?UTF-8?q?replace=20<=3D=20with=20=E2=89=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/qml/pages/HeartratePage.qml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ui/qml/pages/HeartratePage.qml b/ui/qml/pages/HeartratePage.qml index 7d2215eb..9bd0e959 100644 --- a/ui/qml/pages/HeartratePage.qml +++ b/ui/qml/pages/HeartratePage.qml @@ -95,7 +95,7 @@ PagePL { Rectangle { color: "grey"; width: parent.width * (relaxed / total) ; height: parent.height } LabelPL { text: Math.round((relaxed / total) * 100) + "%"; anchors.centerIn: parent} } - LabelPL {text: qsTr("<= %1 BPM".arg(Math.round(maxHR()*0.5)))} + LabelPL {text: qsTr("≤ %1 BPM".arg(Math.round(maxHR()*0.5)))} LabelPL {text: qsTr("Light")} Item { @@ -104,7 +104,7 @@ PagePL { Rectangle { color: "lightblue"; width: parent.width * (light / total) ; height: parent.height } LabelPL { text: Math.round((light / total) * 100) + "%"; anchors.centerIn: parent} } - LabelPL {text: qsTr("<= %1 BPM".arg(Math.round(maxHR()*0.6)))} + LabelPL {text: qsTr("≤ %1 BPM".arg(Math.round(maxHR()*0.6)))} LabelPL {text: qsTr("Intensive")} Item { @@ -113,7 +113,7 @@ PagePL { Rectangle { color: "green"; width: parent.width * (intensive / total) ; height: parent.height } LabelPL { text: Math.round((intensive / total) * 100) + "%"; anchors.centerIn: parent} } - LabelPL {text: qsTr("<= %1 BPM".arg(Math.round(maxHR()*0.7)))} + LabelPL {text: qsTr("≤ %1 BPM".arg(Math.round(maxHR()*0.7)))} LabelPL {text: qsTr("Aerobic")} Item { @@ -122,7 +122,7 @@ PagePL { Rectangle { color: "yellow"; width: parent.width * (aerobic / total) ; height: parent.height } LabelPL { text: Math.round((aerobic / total) * 100) + "%"; anchors.centerIn: parent} } - LabelPL {text: qsTr("<= %1 BPM".arg(Math.round(maxHR()*0.8)))} + LabelPL {text: qsTr("≤ %1 BPM".arg(Math.round(maxHR()*0.8)))} LabelPL {text: qsTr("Anerobic")} Item { @@ -131,7 +131,7 @@ PagePL { Rectangle { color: "orange"; width: parent.width * (anerobic / total) ; height: parent.height } LabelPL { text: Math.round((anerobic / total) * 100) + "%"; anchors.centerIn: parent} } - LabelPL {text: qsTr("<= %1 BPM".arg(Math.round(maxHR()*0.9)))} + LabelPL {text: qsTr("≤ %1 BPM".arg(Math.round(maxHR()*0.9)))} LabelPL {text: qsTr("VO2 Max")} Item { @@ -140,7 +140,7 @@ PagePL { Rectangle { color: "red"; width: parent.width * (vo2max / total) ; height: parent.height } LabelPL { text: Math.round((vo2max / total) * 100) + "%"; anchors.centerIn: parent} } - LabelPL {text: qsTr("<= %1 BPM".arg(Math.round(maxHR())))} + LabelPL {text: qsTr("≤ %1 BPM".arg(Math.round(maxHR())))} } } From d68f3679877647d678f403aa1e55b42579426d63 Mon Sep 17 00:00:00 2001 From: Danfro Date: Thu, 24 Oct 2024 23:17:59 +0200 Subject: [PATCH 5/6] replace Haskell & Fox maxHR formula with the more precise Wingate formula --- ui/qml/pages/HeartratePage.qml | 36 ++++++++++++---------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/ui/qml/pages/HeartratePage.qml b/ui/qml/pages/HeartratePage.qml index 9bd0e959..8dc41884 100644 --- a/ui/qml/pages/HeartratePage.qml +++ b/ui/qml/pages/HeartratePage.qml @@ -199,33 +199,23 @@ PagePL { function maxHR() { var dob = AmazfishConfig.profileDOB; + var gender = AmazfishConfig.profileGender; var diff_ms = Date.now() - dob.getTime(); var age_dt = new Date(diff_ms); var age = Math.abs(age_dt.getUTCFullYear() - 1970); - var max_hr = 200; - - if (age >= 70) { - max_hr = 150; - } else if (age >= 65) { - max_hr = 155; - } else if (age >= 60) { - max_hr = 160; - } else if (age >= 55) { - max_hr = 165; - } else if (age >= 50) { - max_hr = 170; - } else if (age >= 45) { - max_hr = 175; - } else if (age >= 40) { - max_hr = 180; - } else if (age >= 35) { - max_hr = 185; - } else if (age >= 30) { - max_hr = 190; - } else if (age >= 25) { - max_hr = 195; + var max_hr; + + // if no age is provided, use an average age + // this is to avoid providing too height values which may be a health risk + if (!age) { + age = 50 + } + // max HR calculated with Wingate formula as the most recent evaluation with a large test group + // for details see https://en.wikipedia.org/wiki/Heart_rate#Maximum_heart_rate + if (gender = qsTr("Male")) { + max_hr = 208.609-(0.716*age) } else { - max_hr = 200; + max_hr = 209.273-(0.804*age) } console.log("Age is", age, "max hr is", max_hr); From 1dac8318685cce6cb9d78d54bcbec0cd2852bc1d Mon Sep 17 00:00:00 2001 From: Danfro Date: Thu, 24 Oct 2024 23:50:52 +0200 Subject: [PATCH 6/6] fix wrong gender condition --- ui/qml/pages/HeartratePage.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/qml/pages/HeartratePage.qml b/ui/qml/pages/HeartratePage.qml index 8dc41884..f9d1df31 100644 --- a/ui/qml/pages/HeartratePage.qml +++ b/ui/qml/pages/HeartratePage.qml @@ -212,7 +212,7 @@ PagePL { } // max HR calculated with Wingate formula as the most recent evaluation with a large test group // for details see https://en.wikipedia.org/wiki/Heart_rate#Maximum_heart_rate - if (gender = qsTr("Male")) { + if (gender = 1) { // 1=male max_hr = 208.609-(0.716*age) } else { max_hr = 209.273-(0.804*age)