Merge branch 'main'

This commit is contained in:
Garth Vander Houwen 2022-09-29 22:25:36 -07:00
commit bbd1de3ab6
2 changed files with 14 additions and 22 deletions

View file

@ -439,7 +439,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
sendWantConfig()
self.configTimeoutTimer = Timer.scheduledTimer(timeInterval: TimeInterval(15), target: self, selector: #selector(configTimeoutTimerFired), userInfo: context, repeats: false)
self.configTimeoutTimer = Timer.scheduledTimer(timeInterval: TimeInterval(30), target: self, selector: #selector(configTimeoutTimerFired), userInfo: context, repeats: false)
RunLoop.current.add(self.configTimeoutTimer!, forMode: .common)
}
}

View file

@ -1095,31 +1095,22 @@ func adminAppPacket (packet: MeshPacket, meshLogging: Bool, context: NSManagedOb
newChannel.role = Int32(channelMessage.role.rawValue)
let mutableChannels = fetchedMyInfo[0].channels!.mutableCopy() as! NSMutableOrderedSet
let currentChannel = fetchedMyInfo[0].channels!.first(where: { ($0 as! ChannelEntity).index == channelMessage.index })
if currentChannel != nil {
//mutableChannels.remove(currentChannel!)
}
mutableChannels.add(newChannel)
fetchedMyInfo[0].channels = mutableChannels.copy() as? NSOrderedSet
} else {
if channelMessage.index == 0 {
let newChannel = ChannelEntity(context: context)
newChannel.index = channelMessage.index
newChannel.uplinkEnabled = channelMessage.settings.uplinkEnabled
newChannel.downlinkEnabled = channelMessage.settings.downlinkEnabled
newChannel.name = "Primary"
var newChannels = [ChannelEntity]()
newChannels.append(newChannel)
fetchedMyInfo[0].channels! = NSOrderedSet(array: newChannels)
}
let newChannel = ChannelEntity(context: context)
newChannel.index = Int32(channelMessage.settings.channelNum)
newChannel.uplinkEnabled = channelMessage.settings.uplinkEnabled
newChannel.downlinkEnabled = channelMessage.settings.downlinkEnabled
newChannel.name = channelMessage.settings.name
newChannel.role = Int32(channelMessage.role.rawValue)
var newChannels = [ChannelEntity]()
newChannels.append(newChannel)
fetchedMyInfo[0].channels! = NSOrderedSet(array: newChannels)
}
} else {
@ -1130,7 +1121,7 @@ func adminAppPacket (packet: MeshPacket, meshLogging: Bool, context: NSManagedOb
if meshLogging {
MeshLogger.log("💾 Updated MyInfo channel \(channelMessage.index) from Channel App Packet For: \(fetchedMyInfo[0].myNodeNum)")
MeshLogger.log("💾 Updated MyInfo channel \(channelMessage.settings.channelNum) from Channel App Packet For: \(fetchedMyInfo[0].myNodeNum)")
}
} catch {
@ -1443,3 +1434,4 @@ func textMessageAppPacket(packet: MeshPacket, connectedNode: Int64, meshLogging:
}
}
}