From 62af4899667bc4eeff080da0168098b6898fce59 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Fri, 22 Oct 2021 10:39:32 -0700 Subject: [PATCH] V 1.26.6 Fix error messages for BLE connection errors --- Meshtastic Client.xcodeproj/project.pbxproj | 4 ++-- MeshtasticClient/Helpers/BLEManager.swift | 10 +++++----- MeshtasticClient/Views/Bluetooth/Connect.swift | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Meshtastic Client.xcodeproj/project.pbxproj b/Meshtastic Client.xcodeproj/project.pbxproj index fc4d26c5..37f06821 100644 --- a/Meshtastic Client.xcodeproj/project.pbxproj +++ b/Meshtastic Client.xcodeproj/project.pbxproj @@ -668,7 +668,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.26.5; + MARKETING_VERSION = 1.26.6; PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTS_MACCATALYST = YES; @@ -695,7 +695,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.26.5; + MARKETING_VERSION = 1.26.6; PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTS_MACCATALYST = YES; diff --git a/MeshtasticClient/Helpers/BLEManager.swift b/MeshtasticClient/Helpers/BLEManager.swift index ffbce4f3..a3dcf5c7 100644 --- a/MeshtasticClient/Helpers/BLEManager.swift +++ b/MeshtasticClient/Helpers/BLEManager.swift @@ -104,7 +104,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph @objc func timeoutTimerFired(timer: Timer) { timer.invalidate() - lastConnectionError = "BLE Connection timed out" //radio \(connectedPeripheral.peripheral.name ?? "Unknown") + //lastConnectionError = "BLE Connection timed out" //radio \(connectedPeripheral.peripheral.name ?? "Unknown") if connectedPeripheral != nil { self.centralManager?.cancelPeripheralConnection(connectedPeripheral.peripheral) connectedNode = nil @@ -123,8 +123,8 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph self.disconnectDevice() } - self.timeoutTimer = Timer.scheduledTimer(timeInterval: 2.0, target: self, selector: #selector(timeoutTimerFired), userInfo: nil, repeats: false) - self.centralManager?.connect(peripheral) + self.centralManager?.connect(peripheral) + self.timeoutTimer = Timer.scheduledTimer(timeInterval: 3.0, target: self, selector: #selector(timeoutTimerFired), userInfo: nil, repeats: false) if meshLoggingEnabled { Logger.log("BLE Connecting: \(peripheral.name ?? "Unknown")") } print("BLE Connecting: \(peripheral.name ?? "Unknown")") } @@ -165,7 +165,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph func centralManager(_ central: CBCentralManager, didConnect peripheral: CBPeripheral) { lastConnectionError = "" - timeoutTimer!.invalidate() + self.timeoutTimer!.invalidate() peripheral.delegate = self connectedPeripheral = peripherals.filter({ $0.peripheral.identifier == peripheral.identifier }).first @@ -196,7 +196,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph // Error Code 6: The connection has timed out unexpectedly. // Happens when device is manually reset / powered off - lastConnectionError = " \(e.localizedDescription) Will automatically attempt to reconnect to the preferred radio if it reappears quickly." + lastConnectionError = "\(e.localizedDescription) The app will automatically reconnect to the preferred radio if it reappears within 3 seconds." self.connectedNode = nil self.connectedPeripheral = nil self.connectTo(peripheral: peripheral) diff --git a/MeshtasticClient/Views/Bluetooth/Connect.swift b/MeshtasticClient/Views/Bluetooth/Connect.swift index 1702641b..a984ff80 100644 --- a/MeshtasticClient/Views/Bluetooth/Connect.swift +++ b/MeshtasticClient/Views/Bluetooth/Connect.swift @@ -35,7 +35,7 @@ struct Connect: View { Section(header: Text("Connection Error").font(.title)) { - Text(bleManager.lastConnectionError).font(.title2).foregroundColor(.red) + Text(bleManager.lastConnectionError).font(.subheadline).foregroundColor(.red) } .textCase(nil) }