From e17791b71d79709953d67314a147ee859f31fa1b Mon Sep 17 00:00:00 2001 From: Benjamin Faershtein <119711889+RCGV1@users.noreply.github.com> Date: Thu, 12 Jun 2025 12:06:23 -0700 Subject: [PATCH] First get config to subscribe then fetch nodes --- Meshtastic/Helpers/BLEManager.swift | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Meshtastic/Helpers/BLEManager.swift b/Meshtastic/Helpers/BLEManager.swift index c1dc7023..008fe3e8 100644 --- a/Meshtastic/Helpers/BLEManager.swift +++ b/Meshtastic/Helpers/BLEManager.swift @@ -511,7 +511,10 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate Logger.mesh.info("πŸ›ŽοΈ \(logString, privacy: .public)") // BLE Characteristics discovered, issue wantConfig var toRadio: ToRadio = ToRadio() - configNonce += 1 + configNonce = UInt32(69421) + if !isSubscribed { + configNonce = UInt32(69420) // Get config first + } toRadio.wantConfigID = configNonce guard let binaryData: Data = try? toRadio.serializedData() else { return @@ -982,7 +985,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate Logger.mesh.warning("πŸ•ΈοΈ MESH PACKET received for Key Verification App UNHANDLED \((try? decodedInfo.packet.jsonString()) ?? "JSON Decode Failure", privacy: .public)") } - if decodedInfo.configCompleteID != 0 && decodedInfo.configCompleteID == configNonce { + if decodedInfo.configCompleteID != 0 && decodedInfo.configCompleteID == 69420 { invalidVersion = false lastConnectionError = "" isSubscribed = true @@ -1022,6 +1025,12 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate } catch { Logger.data.error("Failed to find a node info for the connected node \(error.localizedDescription, privacy: .public)") } + Logger.mesh.info("🀜 [BLE] Want Config Complete. ID:\(decodedInfo.configCompleteID, privacy: .public)") + sendWantConfig() + + } + if decodedInfo.configCompleteID != 0 && decodedInfo.configCompleteID == 69421 { + Logger.mesh.info("🀜 [BLE] Want Config DB Complete. ID:\(decodedInfo.configCompleteID, privacy: .public)") } // MARK: Share Location Position Update Timer