Skip to content

Commit

Permalink
HRM: add average heart rate
Browse files Browse the repository at this point in the history
  • Loading branch information
liamcharger committed Jul 12, 2024
1 parent 0a6ef49 commit 72b4af4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions InfiniLink/Core/Heart/HeartView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//


import Accelerate
import SwiftUI

struct HeartView: View {
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 72b4af4

Please sign in to comment.