From 72b4af4f2b82abe0d84b87455c4e19c26b7a87ee Mon Sep 17 00:00:00 2001 From: liamcharger Date: Fri, 12 Jul 2024 16:14:29 -0400 Subject: [PATCH] HRM: add average heart rate --- InfiniLink/Core/Heart/HeartView.swift | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/InfiniLink/Core/Heart/HeartView.swift b/InfiniLink/Core/Heart/HeartView.swift index 22d80db..7e1aff2 100644 --- a/InfiniLink/Core/Heart/HeartView.swift +++ b/InfiniLink/Core/Heart/HeartView.swift @@ -6,7 +6,7 @@ // // - +import Accelerate import SwiftUI struct HeartView: View { @@ -88,13 +88,14 @@ struct HeartView: View { .stroke(style: StrokeStyle(lineWidth: 10.0, lineCap: .round, lineJoin: .round)) .foregroundColor(.red) .rotationEffect(Angle(degrees: 90.0 - Double(bleManagerVal.heartBPM / 250) * 180.0)) - VStack(spacing: 8) { + VStack(spacing: 5) { Image(systemName: "heart.fill") .font(.system(size: 35)) .imageScale(.large) - Text(String(format: "%.0f", bleManagerVal.heartBPM) + " " + NSLocalizedString("bpm", comment: "BPM")) .font(.system(size: 32).weight(.bold)) + Text("Avg: " + String(Int(vDSP.mean(dataPoints.map({ $0.value })))) + " " + NSLocalizedString("bpm", comment: "BPM")) + .foregroundColor(.primary) } .foregroundColor(.red) }