diff --git a/Meshtastic/Helpers/BLEManager.swift b/Meshtastic/Helpers/BLEManager.swift index 53b9e334..4bef22ee 100644 --- a/Meshtastic/Helpers/BLEManager.swift +++ b/Meshtastic/Helpers/BLEManager.swift @@ -439,7 +439,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph sendWantConfig() - self.configTimeoutTimer = Timer.scheduledTimer(timeInterval: TimeInterval(7), target: self, selector: #selector(configTimeoutTimerFired), userInfo: context, repeats: false) + self.configTimeoutTimer = Timer.scheduledTimer(timeInterval: TimeInterval(15), target: self, selector: #selector(configTimeoutTimerFired), userInfo: context, repeats: false) RunLoop.current.add(self.configTimeoutTimer!, forMode: .common) } } @@ -717,6 +717,8 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph if decodedInfo.configCompleteID != 0 && decodedInfo.configCompleteID == configNonce { + invalidVersion = false + lastConnectionError = "" if configTimeoutTimer != nil { configTimeoutTimer?.invalidate() @@ -729,10 +731,11 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph // Get all the channels var i: UInt32 = 1; + var max: Int32 = self.connectedPeripheral.maxChannels - Timer.scheduledTimer(withTimeInterval: 0.4, - repeats: true) { timer in - if i == (self.connectedPeripheral.maxChannels + 1) { + Timer.scheduledTimer(withTimeInterval: 0.4, repeats: true) { timer in + + if i == (max + 1) { timer.invalidate() // invalidate the timer } else { diff --git a/Meshtastic/Views/Bluetooth/Connect.swift b/Meshtastic/Views/Bluetooth/Connect.swift index ffff8152..d5eb57c1 100644 --- a/Meshtastic/Views/Bluetooth/Connect.swift +++ b/Meshtastic/Views/Bluetooth/Connect.swift @@ -43,6 +43,7 @@ struct Connect: View { Section(header: Text("Connected Radio").font(.title)) { if bleManager.connectedPeripheral != nil && bleManager.connectedPeripheral.peripheral.state == .connected { + HStack { Image(systemName: "antenna.radiowaves.left.and.right") @@ -73,6 +74,10 @@ struct Connect: View { } if bleManager.connectedPeripheral.subscribed { Text("Properly Subscribed").font(.caption) + } else { + Text("Attempting to connect. . . ").font(.caption) + .foregroundColor(.orange) + } } Spacer() diff --git a/Meshtastic/Views/Bluetooth/InvalidVersion.swift b/Meshtastic/Views/Bluetooth/InvalidVersion.swift index 7f9e4541..5d5d674e 100644 --- a/Meshtastic/Views/Bluetooth/InvalidVersion.swift +++ b/Meshtastic/Views/Bluetooth/InvalidVersion.swift @@ -23,9 +23,18 @@ struct InvalidVersion: View { VStack { - Text("The Meshtastic Apple apps support firmware version \(minimumVersion) and above. You are running version \(version)") - .font(.title2) - .padding(.bottom) + if version != "1.2.65" { + + Text("The Meshtastic Apple apps support firmware version \(minimumVersion) and above. You are running version \(version)") + .font(.title2) + .padding(.bottom) + + } else { + + Text("The Meshtastic Apple apps support firmware version \(minimumVersion) and above.") + .font(.title2) + .padding(.bottom) + } Link("Firmware update docs", destination: URL(string: "https://meshtastic.org/docs/getting-started/flashing-firmware/")!) .font(.title) @@ -46,12 +55,12 @@ struct InvalidVersion: View { VStack{ - Text("🦕 Your device is Version 1.2 🦖 ☄️") + Text("🦕 End of life Version 🦖 ☄️") .font(.title3) .foregroundColor(.orange) .padding(.bottom) - Text("Version 1.3 includes breaking changes to devices and the client apps. The version 1.3 app does not support 1.2 or 1.0 nodes.") + Text("Version \(minimumVersion) includes breaking changes to devices and the client apps. Only nodes version \(minimumVersion) and above are supported.") .font(.caption) .padding([.leading, .trailing]) diff --git a/Meshtastic/Views/Settings/Settings.swift b/Meshtastic/Views/Settings/Settings.swift index b998e532..f33bec77 100644 --- a/Meshtastic/Views/Settings/Settings.swift +++ b/Meshtastic/Views/Settings/Settings.swift @@ -44,7 +44,6 @@ struct Settings: View { .symbolRenderingMode(.hierarchical) Text("Share Channels QR Code") } - .disabled(bleManager.connectedPeripheral == nil) NavigationLink { UserConfig(node: nodes.first(where: { $0.num == connectedNodeNum })) @@ -55,7 +54,6 @@ struct Settings: View { Text("User") } - .disabled(bleManager.connectedPeripheral == nil) NavigationLink() { @@ -67,7 +65,6 @@ struct Settings: View { Text("LoRa") } - .disabled(bleManager.connectedPeripheral == nil) NavigationLink() { @@ -79,7 +76,6 @@ struct Settings: View { Text("Bluetooth (BLE)") } - .disabled(bleManager.connectedPeripheral == nil) NavigationLink { DeviceConfig(node: nodes.first(where: { $0.num == connectedNodeNum })) @@ -89,7 +85,6 @@ struct Settings: View { .symbolRenderingMode(.hierarchical) Text("Device") } - .disabled(bleManager.connectedPeripheral == nil) NavigationLink { DisplayConfig(node: nodes.first(where: { $0.num == connectedNodeNum })) @@ -99,7 +94,6 @@ struct Settings: View { .symbolRenderingMode(.hierarchical) Text("Display (Device Screen)") } - .disabled(bleManager.connectedPeripheral == nil) NavigationLink { NetworkConfig(node: nodes.first(where: { $0.num == connectedNodeNum })) @@ -110,7 +104,6 @@ struct Settings: View { Text("Network (ESP32 Only)") } - .disabled(bleManager.connectedPeripheral == nil) NavigationLink { PositionConfig(node: nodes.first(where: { $0.num == connectedNodeNum })) @@ -121,7 +114,6 @@ struct Settings: View { Text("Position") } - .disabled(bleManager.connectedPeripheral == nil) } Section("Module Configuration") { @@ -135,7 +127,6 @@ struct Settings: View { Text("Canned Messages") } - .disabled(bleManager.connectedPeripheral == nil) NavigationLink { ExternalNotificationConfig(node: nodes.first(where: { $0.num == connectedNodeNum })) @@ -146,7 +137,6 @@ struct Settings: View { Text("External Notification") } - .disabled(bleManager.connectedPeripheral == nil) NavigationLink { MQTTConfig(node: nodes.first(where: { $0.num == connectedNodeNum })) @@ -157,7 +147,6 @@ struct Settings: View { Text("MQTT (ESP32 Only)") } - .disabled(bleManager.connectedPeripheral == nil) NavigationLink { RangeTestConfig(node: nodes.first(where: { $0.num == connectedNodeNum })) @@ -168,7 +157,6 @@ struct Settings: View { Text("Range Test (ESP32 Only)") } - .disabled(bleManager.connectedPeripheral == nil) NavigationLink { SerialConfig(node: nodes.first(where: { $0.num == connectedNodeNum })) @@ -179,8 +167,6 @@ struct Settings: View { Text("Serial") } - .disabled(bleManager.connectedPeripheral == nil) - NavigationLink { TelemetryConfig(node: nodes.first(where: { $0.num == connectedNodeNum })) @@ -191,7 +177,6 @@ struct Settings: View { Text("Telemetry (Sensors)") } - .disabled(bleManager.connectedPeripheral == nil) } Section(header: Text("Logging")) { @@ -219,13 +204,13 @@ struct Settings: View { Text("Admin Message Log") } - .disabled(bleManager.connectedPeripheral == nil) } // Not Implemented: // Store Forward Config - Not Working, TBEAM Only - // MQTT Config - Can do from WebUI once WiFi is enabled + } + .disabled(!(bleManager.connectedPeripheral?.subscribed ?? true)) .onAppear { self.bleManager.context = context