Merge pull request #51 from meshtastic/bugfix/fromnum-read-spam-fix

Don't spam the node with reads to fromnum
This commit is contained in:
Garth Vander Houwen 2022-02-19 10:56:19 -08:00 committed by GitHub
commit c082f975cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -376,7 +376,10 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
switch characteristic.uuid {
case FROMNUM_UUID:
peripheral.readValue(for: FROMNUM_characteristic)
//Dont need to call readValue here, the value is already here from the notify
//readValue in turn calls this callback so we end up spamming the node with fromnum reads continuously
//peripheral.readValue(for: FROMNUM_characteristic)
let characteristicValue: [UInt8] = [UInt8](characteristic.value!)
let bigEndianUInt32 = characteristicValue.withUnsafeBytes { $0.load(as: UInt32.self) }
let returnValue = CFByteOrderGetCurrent() == CFByteOrder(CFByteOrderLittleEndian.rawValue)