Stop a couple of mesh log items from crashing

This commit is contained in:
Garth Vander Houwen 2023-01-02 20:53:40 -08:00
parent 12fdddd565
commit 4467c7ab9e
2 changed files with 2 additions and 4 deletions

View file

@ -357,8 +357,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
} else {
let nodeName = connectedPeripheral!.peripheral.name ?? NSLocalizedString("unknown", comment: NSLocalizedString("unknown", comment: "Unknown"))
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.wantconfig %@",
comment: "Issuing Want Config to %@"), nodeName)
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.wantconfig %@", comment: "Issuing Want Config to %@"), nodeName)
MeshLogger.log("🛎️ \(logString)")
//BLE Characteristics discovered, issue wantConfig
var toRadio: ToRadio = ToRadio()
@ -1029,7 +1028,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
let binaryData: Data = try! toRadio.serializedData()
if connectedPeripheral!.peripheral.state == CBPeripheralState.connected {
self.connectedPeripheral.peripheral.writeValue(binaryData, for: self.TORADIO_characteristic, type: .withResponse)
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.channel.sent %d", comment: "Sent a Channel for: %d Channel Index %d"), connectedPeripheral.num, chan.index)
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.channel.sent %@ %d", comment: "Sent a Channel for: %@ Channel Index %d"), String(connectedPeripheral.num), chan.index)
MeshLogger.log("🎛️ \(logString)")
}
}

View file

@ -913,7 +913,6 @@ func nodeInfoPacket (nodeInfo: NodeInfo, channel: UInt32, context: NSManagedObje
do {
try context.save()
print("💾 NodeInfo saved for \(nodeInfo.num)")
return fetchedNode[0]
} catch {
context.rollback()