diff --git a/MeshtasticApple/Helpers/BLEManager.swift b/MeshtasticApple/Helpers/BLEManager.swift index 9af895ae..0613cc62 100644 --- a/MeshtasticApple/Helpers/BLEManager.swift +++ b/MeshtasticApple/Helpers/BLEManager.swift @@ -688,8 +688,13 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph positionPacket.longitudeI = Int32(LocationHelper.currentLocation.longitude * 1e7) positionPacket.time = UInt32(LocationHelper.currentTimestamp.timeIntervalSince1970) positionPacket.altitude = Int32(LocationHelper.currentAltitude) - positionPacket.groundSpeed = UInt32(LocationHelper.currentSpeed) - positionPacket.groundTrack = UInt32(LocationHelper.currentHeading) + + // Get Errors without some speed + if LocationHelper.currentSpeed >= 5 { + + positionPacket.groundSpeed = UInt32(LocationHelper.currentSpeed) + positionPacket.groundTrack = UInt32(LocationHelper.currentHeading) + } var meshPacket = MeshPacket() meshPacket.to = UInt32(destNum) diff --git a/MeshtasticApple/Views/Bluetooth/Connect.swift b/MeshtasticApple/Views/Bluetooth/Connect.swift index b4ecd7b1..72a43bd3 100644 --- a/MeshtasticApple/Views/Bluetooth/Connect.swift +++ b/MeshtasticApple/Views/Bluetooth/Connect.swift @@ -184,69 +184,66 @@ struct Connect: View { } HStack(alignment: .center) { - Spacer() - Button(action: { + + Spacer() + + if !bleManager.isScanning { + + Button(action: { - self.bleManager.startScanning() + self.bleManager.startScanning() - }) { + }) { - Image(systemName: "play.circle") - .symbolRenderingMode(.hierarchical) - .imageScale(.large) - .foregroundColor(self.bleManager.isScanning ? .gray : .accentColor) - Text("Start Scanning").font(.caption) - .font(.caption) + Label("Start Scanning", systemImage: "play.fill") - } - .disabled(self.bleManager.isScanning) - .padding() - .background(Color(.systemGray6)) - .clipShape(Capsule()) - Button(action: { + } + .buttonStyle(.bordered) + .buttonBorderShape(.capsule) + .controlSize(.large) + .padding() + + } else { + + Button(action: { - self.bleManager.stopScanning() + self.bleManager.stopScanning() - }) { + }) { - Image(systemName: "stop.circle") - .symbolRenderingMode(.hierarchical) - .imageScale(.large) - .foregroundColor(!self.bleManager.isScanning ? .gray : .accentColor) - Text("Stop Scanning") - .font(.caption) + Label("Stop Scanning", systemImage: "stop.fill") - } - .disabled(!self.bleManager.isScanning) - .padding() - .background(Color(.systemGray6)) - .clipShape(Capsule()) + } + .buttonStyle(.bordered) + .buttonBorderShape(.capsule) + .controlSize(.large) + .padding() + } #if targetEnvironment(macCatalyst) - if bleManager.connectedPeripheral != nil { - Button(role: .destructive, action: { - - if bleManager.connectedPeripheral != nil && bleManager.connectedPeripheral.peripheral.state == CBPeripheralState.connected { - bleManager.disconnectPeripheral() - isPreferredRadio = false - } - - }) { - - Image(systemName: "antenna.radiowaves.left.and.right.slash") - .symbolRenderingMode(.hierarchical) - .imageScale(.large) - .foregroundColor(.red) - Text("Disconnect").font(.caption) - .font(.caption) - + if bleManager.connectedPeripheral != nil { + + Button(role: .destructive, action: { + + if bleManager.connectedPeripheral != nil && bleManager.connectedPeripheral.peripheral.state == CBPeripheralState.connected { + bleManager.disconnectPeripheral() + isPreferredRadio = false } - .padding() - .background(Color(.systemGray6)) - .clipShape(Capsule()) + + }) { + + Label("Disconnect", systemImage: "antenna.radiowaves.left.and.right.slash") + } + .buttonStyle(.bordered) + .buttonBorderShape(.capsule) + .controlSize(.large) + .padding() + + } #endif + Spacer() } .padding(.bottom, 10) diff --git a/MeshtasticApple/Views/Nodes/NodeDetail.swift b/MeshtasticApple/Views/Nodes/NodeDetail.swift index 3a1f7c39..72f38ad2 100644 --- a/MeshtasticApple/Views/Nodes/NodeDetail.swift +++ b/MeshtasticApple/Views/Nodes/NodeDetail.swift @@ -96,17 +96,12 @@ struct NodeDetail: View { isPresentingShutdownConfirm = true }) { - Image(systemName: "power") - .symbolRenderingMode(.hierarchical) - .imageScale(.small) - .foregroundColor(Color.accentColor) - Text("Power Off") - .font(.caption) - + Label("Power Off", systemImage: "power") } + .buttonStyle(.bordered) + .buttonBorderShape(.capsule) + .controlSize(.large) .padding() - .background(Color(.systemGray6)) - .clipShape(Capsule()) .confirmationDialog( "Are you sure?", isPresented: $isPresentingShutdownConfirm @@ -126,18 +121,13 @@ struct NodeDetail: View { isPresentingRebootConfirm = true }) { - - Image(systemName: "arrow.triangle.2.circlepath") - .symbolRenderingMode(.hierarchical) - .imageScale(.small) - .foregroundColor(Color.accentColor) - Text("Reboot") - .font(.caption) - + + Label("Reboot", systemImage: "arrow.triangle.2.circlepath") } + .buttonStyle(.bordered) + .buttonBorderShape(.capsule) + .controlSize(.large) .padding() - .background(Color(.systemGray6)) - .clipShape(Capsule()) .confirmationDialog( "Are you sure?", isPresented: $isPresentingRebootConfirm