Skip to content

Commit

Permalink
day 255
Browse files Browse the repository at this point in the history
  • Loading branch information
Gurrium committed Mar 1, 2022
1 parent e300b95 commit 2f30238
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions bluetooth-poc/PeripheralListView.swift
Expand Up @@ -15,12 +15,8 @@ struct PeripheralListView: View {
var body: some View {
Group {
if state.isBluetoothEnabled {
if let cadence = state.cadence {
Text("Cadence: \(cadence)")
} else {
ProgressView()
}

Text("Cadence: \(state.cadence ?? -1)")
Text("Speed: \(state.speed ?? -1)")
} else {
Text("Bluetooth is not enabled.")
}
Expand Down Expand Up @@ -165,7 +161,7 @@ extension PeripheralListViewState: CBPeripheralDelegate {
// TODO: 可変にする?なくてもいいかも
let wheelCircumference = 2105.0 // [mm]

return revolutionsPerSec * wheelCircumference * 3600 / 1_000_000
return revolutionsPerSec * wheelCircumference * 3600 / 1_000_000 // [km/h]
}

private func retrieveCadence(from value: [UInt8]) -> Double? {
Expand Down

0 comments on commit 2f30238

Please sign in to comment.