QR Code fixes

This commit is contained in:
Garth Vander Houwen 2022-10-22 13:05:54 -07:00
parent 091874a9f2
commit 288b35d6fc
3 changed files with 6 additions and 3 deletions

View file

@ -410,11 +410,9 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
guard (connectedPeripheral!.peripheral.state == CBPeripheralState.connected) else { return }
if FROMRADIO_characteristic == nil {
MeshLogger.log("🚨 Unsupported Firmware Version Detected, unable to connect to device.")
invalidVersion = true
return
} else {
MeshLogger.log(" Issuing wantConfig to \(connectedPeripheral!.peripheral.name ?? "Unknown")")
//BLE Characteristics discovered, issue wantConfig
@ -423,7 +421,6 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
toRadio.wantConfigID = configNonce
let binaryData: Data = try! toRadio.serializedData()
connectedPeripheral!.peripheral.writeValue(binaryData, for: TORADIO_characteristic, type: .withResponse)
// Either Read the config complete value or from num notify value
connectedPeripheral!.peripheral.readValue(for: FROMRADIO_characteristic)
}

View file

@ -773,8 +773,13 @@ func channelPacket (channel: Channel, fromNum: Int64, context: NSManagedObjectCo
newChannel.name = channel.settings.name
newChannel.role = Int32(channel.role.rawValue)
newChannel.psk = channel.settings.psk
let mutableChannels = fetchedMyInfo[0].channels!.mutableCopy() as! NSMutableOrderedSet
if channel.role.rawValue == 1 {
mutableChannels.removeAllObjects()
}
mutableChannels.add(newChannel)
fetchedMyInfo[0].channels = mutableChannels.copy() as? NSOrderedSet

View file

@ -282,6 +282,7 @@ struct ShareChannels: View {
loRaConfig.hopLimit = UInt32(node?.loRaConfig?.hopLimit ?? 3)
loRaConfig.txEnabled = node?.loRaConfig?.txEnabled ?? false
loRaConfig.txPower = node?.loRaConfig?.txPower ?? 0
loRaConfig.usePreset = node?.loRaConfig?.usePreset ?? true
loRaConfig.channelNum = UInt32(node?.loRaConfig?.channelNum ?? 0)
channelSet.loraConfig = loRaConfig
if node != nil {