Skip to content

Commit

Permalink
TODOの掃除
Browse files Browse the repository at this point in the history
  • Loading branch information
Gurrium committed Apr 18, 2022
1 parent 63e57bd commit f292e90
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
8 changes: 3 additions & 5 deletions Komusou/Settings/SensorSettingView.swift
Expand Up @@ -201,8 +201,6 @@ final class BluetoothManager: NSObject {
override init() {
super.init()

// TODO: Bluetoothが有効にされているか確認する/ダイアログを出す

centralManager.delegate = self

if let savedSpeedSensorUUID = savedSpeedSensorUUID,
Expand All @@ -219,7 +217,7 @@ final class BluetoothManager: NSObject {
}

deinit {
// TODO: disconnect
// TODO:
// ケイデンスセンサーもやる
guard let connectedSpeedSensor = connectedSpeedSensor else { return }

Expand Down Expand Up @@ -310,7 +308,7 @@ extension BluetoothManager: CBPeripheralDelegate {
guard (value[0] & 0b0010) > 0 else { return }

// ref: https://www.bluetooth.com/specifications/specs/gatt-specification-supplement-5/
if let retrieved = parseSpeed(from: value) {
if let retrieved = calculateSpeed(from: value) {
speedMeasurementPauseCounter = 0

speed = retrieved
Expand All @@ -319,7 +317,7 @@ extension BluetoothManager: CBPeripheralDelegate {
}
}

private func parseSpeed(from value: [UInt8]) -> Double? {
private func calculateSpeed(from value: [UInt8]) -> Double? {
let cumulativeWheelRevolutions = (UInt32(value[4]) << 24) + (UInt32(value[3]) << 16) + (UInt32(value[2]) << 8) + UInt32(value[1])
let wheelEventTime = (UInt16(value[6]) << 8) + UInt16(value[5])

Expand Down
1 change: 0 additions & 1 deletion Komusou/WorldView.swift
Expand Up @@ -30,7 +30,6 @@ final class _WorldView: UIView {

private var speedSensor: SpeedSensor!
private var speed = 0.0
private let wheelCircumference = 2048 // TODO: 可変にする
private let movingKey = "movingAction"

// TODO: スピードに揃える
Expand Down

0 comments on commit f292e90

Please sign in to comment.