[O] Stop motion detection after alarm stopped
This commit is contained in:
@@ -106,11 +106,13 @@ class AlarmActivationViewController: UIViewController
|
|||||||
case "Shake":
|
case "Shake":
|
||||||
shakeView.show()
|
shakeView.show()
|
||||||
|
|
||||||
|
// Start motion detection
|
||||||
motion.accelerometerUpdateInterval = 0.2
|
motion.accelerometerUpdateInterval = 0.2
|
||||||
motion.startAccelerometerUpdates(to: OperationQueue.current!) { data, error in
|
motion.startAccelerometerUpdates(to: OperationQueue.current!) { data, error in
|
||||||
if data!.acceleration.x > 5
|
if data!.acceleration.x > 5
|
||||||
{
|
{
|
||||||
ui { self.endAlarm() }
|
ui { self.endAlarm() }
|
||||||
|
motion.stopAccelerometerUpdates()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user