From 9b29f5d2c72737d06b0d6b48505ff01bd69c93ab Mon Sep 17 00:00:00 2001 From: Marco Heiming Date: Sat, 1 Jan 2022 14:13:53 +0100 Subject: [PATCH] Improve heart rate circle drawing calculation --- apps/circlesclock/app.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/circlesclock/app.js b/apps/circlesclock/app.js index a23894ba1..026b47cc6 100644 --- a/apps/circlesclock/app.js +++ b/apps/circlesclock/app.js @@ -102,7 +102,8 @@ function drawHeartRate() { g.fillCircle(w2, h3, radiusOuter); if (hrtValue != undefined && hrtValue > 0) { - const percent = hrtValue / settings.maxHR; + const minHR = 40; + const percent = (hrtValue - minHR) / (settings.maxHR - minHR); drawGauge(w2, h3, percent, colorRed); } @@ -166,6 +167,7 @@ function drawGauge(cx, cy, percent, color) { var i = 0; var r = radiusInner + 3; + if (percent <= 0) return; if (percent > 1) percent = 1; var startrot = -offset;