From 694337d776dca22e4e7fe7b69ea3df790923288b Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Mon, 8 Jan 2024 13:51:13 -0800 Subject: [PATCH] Clean up position timer --- Meshtastic/Helpers/BLEManager.swift | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Meshtastic/Helpers/BLEManager.swift b/Meshtastic/Helpers/BLEManager.swift index 3834aa13..5ba2d0d9 100644 --- a/Meshtastic/Helpers/BLEManager.swift +++ b/Meshtastic/Helpers/BLEManager.swift @@ -757,15 +757,12 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate // Use context to pass the radio name with the timer // Use a RunLoop to prevent the timer from running on the main UI thread if UserDefaults.provideLocation { - let interval = UserDefaults.provideLocationInterval > 0 ? UserDefaults.provideLocationInterval : 30 + let interval = UserDefaults.provideLocationInterval >= 10 ? UserDefaults.provideLocationInterval : 30 + positionTimer = Timer.scheduledTimer(timeInterval: TimeInterval(interval), target: self, selector: #selector(positionTimerFired), userInfo: context, repeats: true) if positionTimer != nil { - positionTimer = Timer.scheduledTimer(timeInterval: TimeInterval(interval), target: self, selector: #selector(positionTimerFired), userInfo: context, repeats: true) - if positionTimer != nil { - RunLoop.current.add(positionTimer!, forMode: .common) - } + RunLoop.current.add(positionTimer!, forMode: .common) } } - return }