mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
2 seconds was too fast, set peripheral scanning time to 4 seconds
This commit is contained in:
parent
31093f52eb
commit
b1a7f24200
3 changed files with 14 additions and 12 deletions
|
|
@ -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)..<UInt32.max))
|
||||
//newMessage.messageId = Int64(0xFF | UInt32.random(in: UInt32(UInt8.max)..<UInt32(1147483647)))
|
||||
newMessage.messageTimestamp = Int32(Date().timeIntervalSince1970)
|
||||
newMessage.receivedACK = false
|
||||
newMessage.direction = "IN"
|
||||
|
|
|
|||
|
|
@ -331,23 +331,18 @@ public struct MapView: UIViewRepresentable {
|
|||
// Make a fast exit if the annotation is the `MKUserLocation`, as it's not an annotation view we wish to customize.
|
||||
return nil
|
||||
}
|
||||
|
||||
var annotationView: MKAnnotationView?
|
||||
//var annotationView: MKAnnotationView?
|
||||
|
||||
if let annotation = annotation as? PositionAnnotation {
|
||||
let identifier = NSStringFromClass(PositionAnnotationView.self)
|
||||
|
||||
//let annotationView = mapView.dequeueReusableAnnotationView(withIdentifier: identifier) as? PositionAnnotationView ?? PositionAnnotationView()
|
||||
let annotationView = PositionAnnotationView(annotation: annotation, reuseIdentifier: "PositionAnnotation")
|
||||
|
||||
annotationView.name = annotation.shortName ?? "???"
|
||||
|
||||
annotationView.name = annotation.shortName ?? "????"
|
||||
annotationView.canShowCallout = true
|
||||
|
||||
return annotationView
|
||||
}
|
||||
|
||||
return annotationView
|
||||
return nil
|
||||
}
|
||||
|
||||
public func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer {
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue