From 8213f3db658b234aaa17aa670d8336a3c8f2cccc Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Tue, 27 Sep 2022 09:01:33 -0700 Subject: [PATCH] More version updates --- Meshtastic/Helpers/BLEManager.swift | 11 +++++++---- Meshtastic/Views/Bluetooth/Connect.swift | 5 +++++ .../Views/Bluetooth/InvalidVersion.swift | 19 ++++++++++++++----- Meshtastic/Views/Settings/Settings.swift | 1 + 4 files changed, 27 insertions(+), 9 deletions(-) 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..1b290924 100644 --- a/Meshtastic/Views/Settings/Settings.swift +++ b/Meshtastic/Views/Settings/Settings.swift @@ -226,6 +226,7 @@ struct Settings: View { // Store Forward Config - Not Working, TBEAM Only // MQTT Config - Can do from WebUI once WiFi is enabled } + .disabled(bleManager.connectedPeripheral == nil || !bleManager.connectedPeripheral.subscribed) .onAppear { self.bleManager.context = context