diff --git a/Meshtastic/Helpers/BLEManager.swift b/Meshtastic/Helpers/BLEManager.swift index 10b3c638..e2f79c8d 100644 --- a/Meshtastic/Helpers/BLEManager.swift +++ b/Meshtastic/Helpers/BLEManager.swift @@ -29,7 +29,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph @Published var connectedPeripheral: Peripheral! @Published var lastConnectionError: String - @Published var connectedVersion: String + @State var connectedVersion: String @Published var isSwitchedOn: Bool = false @Published var isScanning: Bool = false diff --git a/Meshtastic/Helpers/MeshPackets.swift b/Meshtastic/Helpers/MeshPackets.swift index 17835d31..09401138 100644 --- a/Meshtastic/Helpers/MeshPackets.swift +++ b/Meshtastic/Helpers/MeshPackets.swift @@ -1230,7 +1230,6 @@ func routingPacket (packet: MeshPacket, meshLogging: Bool, context: NSManagedObj let nsError = error as NSError print("💥 Error Saving ACK for message MessageID \(packet.id) Error: \(nsError)") } - } } diff --git a/Meshtastic/Protobufs/module_config.pb.swift b/Meshtastic/Protobufs/module_config.pb.swift index c9626648..832dc69a 100644 --- a/Meshtastic/Protobufs/module_config.pb.swift +++ b/Meshtastic/Protobufs/module_config.pb.swift @@ -330,6 +330,7 @@ struct ModuleConfig { case `default` // = 0 case simple // = 1 case proto // = 2 + case textmsg // = 3 case UNRECOGNIZED(Int) init() { @@ -341,6 +342,7 @@ struct ModuleConfig { case 0: self = .default case 1: self = .simple case 2: self = .proto + case 3: self = .textmsg default: self = .UNRECOGNIZED(rawValue) } } @@ -350,6 +352,7 @@ struct ModuleConfig { case .default: return 0 case .simple: return 1 case .proto: return 2 + case .textmsg: return 3 case .UNRECOGNIZED(let i): return i } } @@ -649,6 +652,7 @@ extension ModuleConfig.SerialConfig.Serial_Mode: CaseIterable { .default, .simple, .proto, + .textmsg, ] } @@ -1001,6 +1005,7 @@ extension ModuleConfig.SerialConfig.Serial_Mode: SwiftProtobuf._ProtoNameProvidi 0: .same(proto: "DEFAULT"), 1: .same(proto: "SIMPLE"), 2: .same(proto: "PROTO"), + 3: .same(proto: "TEXTMSG"), ] } diff --git a/Meshtastic/Views/Nodes/NodeDetail.swift b/Meshtastic/Views/Nodes/NodeDetail.swift index 20f79db5..405a8777 100644 --- a/Meshtastic/Views/Nodes/NodeDetail.swift +++ b/Meshtastic/Views/Nodes/NodeDetail.swift @@ -12,10 +12,12 @@ struct NodeDetail: View { @Environment(\.managedObjectContext) var context @EnvironmentObject var bleManager: BLEManager + @State private var showingDetailsPopover = false + @State var initialLoad: Bool = true @State var satsInView = 0 - @State private var isPresentingShutdownConfirm: Bool = false - @State private var isPresentingRebootConfirm: Bool = false + @State private var showingShutdownConfirm: Bool = false + @State private var showingRebootConfirm: Bool = false var node: NodeInfoEntity @@ -79,15 +81,14 @@ struct NodeDetail: View { ScrollView { if self.bleManager.connectedPeripheral != nil && self.bleManager.connectedPeripheral.num == node.num && self.bleManager.connectedPeripheral.num == node.num { - - Divider() + HStack { if hwModelString == "TBEAM" || hwModelString == "TECHO" || hwModelString.contains("4631") { Button(action: { - isPresentingShutdownConfirm = true + showingShutdownConfirm = true }) { Label("Power Off", systemImage: "power") @@ -98,7 +99,7 @@ struct NodeDetail: View { .padding() .confirmationDialog( "Are you sure?", - isPresented: $isPresentingShutdownConfirm + isPresented: $showingShutdownConfirm ) { Button("Shutdown Node?", role: .destructive) { @@ -112,7 +113,7 @@ struct NodeDetail: View { Button(action: { - isPresentingRebootConfirm = true + showingRebootConfirm = true }) { @@ -125,7 +126,7 @@ struct NodeDetail: View { .confirmationDialog( "Are you sure?", - isPresented: $isPresentingRebootConfirm + isPresented: $showingRebootConfirm ) { Button("Reboot Node?", role: .destructive) { @@ -140,18 +141,10 @@ struct NodeDetail: View { .padding(5) } + Divider() + if UIDevice.current.userInterfaceIdiom == .pad || UIDevice.current.userInterfaceIdiom == .mac { - - // Add a divider if there is no map - if (node.positions?.count ?? 0) == 0 { - - Divider() - } - Image(hwModelString) - .resizable() - .aspectRatio(contentMode: .fill) - .frame(width: 200, height: 200) - .cornerRadius(5) + HStack { @@ -229,10 +222,15 @@ struct NodeDetail: View { } .padding() } - Divider() + } .padding() + .onLongPressGesture(minimumDuration: 2) { + + print("Long pressed!") + } + Divider() HStack(alignment: .center) { VStack { @@ -364,8 +362,6 @@ struct NodeDetail: View { } .padding(4) - Divider() - HStack(alignment: .center) { VStack { HStack { @@ -406,7 +402,6 @@ struct NodeDetail: View { if (node.positions?.count ?? 0) > 0 { - Divider() NavigationLink { PositionLog(node: node) } label: { @@ -419,11 +414,11 @@ struct NodeDetail: View { .font(.title3) } .fixedSize(horizontal: false, vertical: true) + Divider() } if (node.telemetries?.count ?? 0) > 0 { - Divider() NavigationLink { DeviceMetricsLog(node: node) } label: { diff --git a/Meshtastic/Views/Settings/Config/LoRaConfig.swift b/Meshtastic/Views/Settings/Config/LoRaConfig.swift index 2e63c168..89e53be7 100644 --- a/Meshtastic/Views/Settings/Config/LoRaConfig.swift +++ b/Meshtastic/Views/Settings/Config/LoRaConfig.swift @@ -87,6 +87,7 @@ struct LoRaConfig: View { lc.hopLimit = UInt32(hopLimit) lc.region = RegionCodes(rawValue: region)!.protoEnumValue() lc.modemPreset = ModemPresets(rawValue: modemPreset)!.protoEnumValue() + lc.txEnabled = true let adminMessageId = bleManager.saveLoRaConfig(config: lc, fromUser: node!.user!, toUser: node!.user!)