mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Merge pull request #140 from meshtastic/cancel-timer
invalidate existing timer before creating a new one
This commit is contained in:
commit
a03f50da51
1 changed files with 3 additions and 0 deletions
|
|
@ -170,6 +170,9 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
|
|||
self.connectedVersion = "0.0.0"
|
||||
self.centralManager?.connect(peripheral)
|
||||
|
||||
// Invalidate any existing timer
|
||||
self.timeoutTimer?.invalidate()
|
||||
|
||||
// Use a timer to keep track of connecting peripherals, context to pass the radio name with the timer and the RunLoop to prevent
|
||||
// the timer from running on the main UI thread
|
||||
let context = ["name": "@\(peripheral.name ?? "Unknown")"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue