From b1a7f24200d461437fd5202a025f8341aa89781b Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Wed, 15 Jun 2022 23:16:29 -0700 Subject: [PATCH] 2 seconds was too fast, set peripheral scanning time to 4 seconds --- MeshtasticApple/Helpers/BLEManager.swift | 3 +-- MeshtasticApple/Views/Map/MapViewModule.swift | 11 +++-------- MeshtasticApple/Views/Nodes/NodeDetail.swift | 12 ++++++++++-- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/MeshtasticApple/Helpers/BLEManager.swift b/MeshtasticApple/Helpers/BLEManager.swift index 61a455a5..f9fdd787 100644 --- a/MeshtasticApple/Helpers/BLEManager.swift +++ b/MeshtasticApple/Helpers/BLEManager.swift @@ -198,7 +198,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph } let today = Date() - let visibleDuration = Calendar.current.date(byAdding: .second, value: -2, to: today)! + let visibleDuration = Calendar.current.date(byAdding: .second, value: -4, to: today)! peripherals.removeAll(where: { $0.lastUpdate <= visibleDuration}) } @@ -580,7 +580,6 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph let newMessage = MessageEntity(context: context!) newMessage.messageId = Int64(UInt32.random(in: UInt32(UInt8.max).. MKOverlayRenderer { diff --git a/MeshtasticApple/Views/Nodes/NodeDetail.swift b/MeshtasticApple/Views/Nodes/NodeDetail.swift index aa69dd53..5d7a3699 100644 --- a/MeshtasticApple/Views/Nodes/NodeDetail.swift +++ b/MeshtasticApple/Views/Nodes/NodeDetail.swift @@ -112,7 +112,11 @@ struct NodeDetail: View { isPresented: $isPresentingShutdownConfirm ) { Button("Shutdown Node?", role: .destructive) { - let success = bleManager.sendShutdown(destNum: node.num, wantResponse: false) + + if !bleManager.sendShutdown(destNum: node.num, wantResponse: false) { + + print("Shutdown Failed") + } } } } @@ -139,7 +143,11 @@ struct NodeDetail: View { isPresented: $isPresentingRebootConfirm ) { Button("Reboot Node?", role: .destructive) { - let success = bleManager.sendReboot(destNum: node.num, wantResponse: false) + + if !bleManager.sendReboot(destNum: node.num, wantResponse: false) { + + print("Reboot Failed") + } } } }