mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Merge pull request #86 from meshtastic/feature/new_config
Assorted 1.3 Cleanup
This commit is contained in:
commit
f5d34ae6c4
10 changed files with 130 additions and 19 deletions
|
|
@ -22,6 +22,7 @@
|
|||
DD2E65262767A01F00E45FC5 /* NodeDetail.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD2E65252767A01F00E45FC5 /* NodeDetail.swift */; };
|
||||
DD3501892852FC3B000FC853 /* Settings.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD3501882852FC3B000FC853 /* Settings.swift */; };
|
||||
DD35018B2852FC79000FC853 /* UserSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD35018A2852FC79000FC853 /* UserSettings.swift */; };
|
||||
DD41582628582E9B009B0E59 /* DeviceConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD41582528582E9B009B0E59 /* DeviceConfig.swift */; };
|
||||
DD47E3CE26F103C600029299 /* NodeList.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD47E3CD26F103C600029299 /* NodeList.swift */; };
|
||||
DD47E3D626F17ED900029299 /* CircleText.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD47E3D526F17ED900029299 /* CircleText.swift */; };
|
||||
DD47E3D926F3093800029299 /* MessageBubble.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD47E3D826F3093800029299 /* MessageBubble.swift */; };
|
||||
|
|
@ -103,6 +104,7 @@
|
|||
DD2E65252767A01F00E45FC5 /* NodeDetail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NodeDetail.swift; sourceTree = "<group>"; };
|
||||
DD3501882852FC3B000FC853 /* Settings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Settings.swift; sourceTree = "<group>"; };
|
||||
DD35018A2852FC79000FC853 /* UserSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserSettings.swift; sourceTree = "<group>"; };
|
||||
DD41582528582E9B009B0E59 /* DeviceConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceConfig.swift; sourceTree = "<group>"; };
|
||||
DD45C77427BD4EF80011784F /* MeshtasticDataModel v2.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "MeshtasticDataModel v2.xcdatamodel"; sourceTree = "<group>"; };
|
||||
DD47E3CD26F103C600029299 /* NodeList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NodeList.swift; sourceTree = "<group>"; };
|
||||
DD47E3D526F17ED900029299 /* CircleText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CircleText.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -230,6 +232,7 @@
|
|||
DD3501882852FC3B000FC853 /* Settings.swift */,
|
||||
DD4A911D2708C65400501B7E /* AppSettings.swift */,
|
||||
DD6B85A728009258000ACD6B /* ShareChannel.swift */,
|
||||
DD41582528582E9B009B0E59 /* DeviceConfig.swift */,
|
||||
DD8EBF42285058FA00426DCA /* DisplayConfig.swift */,
|
||||
DD2553562855B02500E55709 /* LoRaConfig.swift */,
|
||||
DD2553582855B52700E55709 /* PositionConfig.swift */,
|
||||
|
|
@ -596,6 +599,7 @@
|
|||
DDAF8C5D26ED09490058C060 /* portnums.pb.swift in Sources */,
|
||||
DD9D8F2F2764403B00080993 /* Meshtastic.xcdatamodeld in Sources */,
|
||||
DD25535D285666C700E55709 /* PowerConfig.swift in Sources */,
|
||||
DD41582628582E9B009B0E59 /* DeviceConfig.swift in Sources */,
|
||||
DD1BF2F92776FE2E008C8D2F /* UserMessageList.swift in Sources */,
|
||||
DDB2CC6E27F3EB47009C5FCC /* telemetry.pb.swift in Sources */,
|
||||
DD23A50F26FD1B4400D9B90C /* PeripheralModel.swift in Sources */,
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ import SwiftUI
|
|||
struct CircleText: View {
|
||||
var text: String
|
||||
var color: Color
|
||||
var circleSize: CGFloat? = 50
|
||||
var fontSize: CGFloat? = 22
|
||||
var circleSize: CGFloat? = 60
|
||||
var fontSize: CGFloat? = 20
|
||||
|
||||
var body: some View {
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class PositionAnnotation: NSObject, MKAnnotation {
|
|||
|
||||
class PositionAnnotationView: MKAnnotationView {
|
||||
|
||||
private let annotationFrame = CGRect(x: 0, y: 0, width: 32, height: 32)
|
||||
private let annotationFrame = CGRect(x: 0, y: 0, width: 40, height: 40)
|
||||
private let label: UILabel
|
||||
|
||||
override init(annotation: MKAnnotation?, reuseIdentifier: String?) {
|
||||
|
|
@ -52,7 +52,7 @@ class PositionAnnotationView: MKAnnotationView {
|
|||
override func draw(_ rect: CGRect) {
|
||||
guard let context = UIGraphicsGetCurrentContext() else { return }
|
||||
|
||||
let circleRect = CGRect(x: 1, y: 1, width: 30, height: 30)
|
||||
let circleRect = CGRect(x: 1, y: 1, width: 38, height: 38)
|
||||
|
||||
context.setFillColor(CGColor(red: 0, green: 0.5, blue: 1.0, alpha: 1.0))
|
||||
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ struct Contacts: View {
|
|||
|
||||
VStack {
|
||||
|
||||
CircleText(text: user.shortName ?? "???", color: Color.blue)
|
||||
CircleText(text: user.shortName ?? "????", color: Color.blue)
|
||||
}
|
||||
.padding(.trailing)
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ struct UserMessageList: View {
|
|||
if currentUser { Spacer(minLength:50) }
|
||||
|
||||
if !currentUser {
|
||||
CircleText(text: message.fromUser?.shortName ?? "????", color: currentUser ? .accentColor : Color(.darkGray), circleSize: 36, fontSize: 16).padding(.all, 5)
|
||||
CircleText(text: message.fromUser?.shortName ?? "????", color: currentUser ? .accentColor : Color(.darkGray), circleSize: 46, fontSize: 16).padding(.all, 5)
|
||||
}
|
||||
|
||||
VStack(alignment: currentUser ? .trailing : .leading) {
|
||||
|
|
@ -444,7 +444,7 @@ struct UserMessageList: View {
|
|||
|
||||
HStack {
|
||||
|
||||
CircleText(text: user.shortName ?? "???", color: .blue, circleSize: 42, fontSize: 20).fixedSize()
|
||||
CircleText(text: user.shortName ?? "???", color: .blue, circleSize: 42, fontSize: 16).fixedSize()
|
||||
Text(user.longName ?? "Unknown").font(.headline).fixedSize()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -219,11 +219,13 @@ struct NodeDetail: View {
|
|||
.foregroundColor(.gray)
|
||||
.fixedSize()
|
||||
}
|
||||
|
||||
Text(String(format: "%.2f", mostRecent.voltage) + " V")
|
||||
.font(.title3)
|
||||
.foregroundColor(.gray)
|
||||
.fixedSize()
|
||||
if mostRecent.voltage > 0 {
|
||||
|
||||
Text(String(format: "%.2f", mostRecent.voltage) + " V")
|
||||
.font(.title3)
|
||||
.foregroundColor(.gray)
|
||||
.fixedSize()
|
||||
}
|
||||
}
|
||||
.padding(5)
|
||||
}
|
||||
|
|
|
|||
91
MeshtasticApple/Views/Settings/DeviceConfig.swift
Normal file
91
MeshtasticApple/Views/Settings/DeviceConfig.swift
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
//
|
||||
// DeviceConfig.swift
|
||||
// Meshtastic Apple
|
||||
//
|
||||
// Copyright (c) Garth Vander Houwen 6/13/22.
|
||||
//
|
||||
import SwiftUI
|
||||
|
||||
// Default of 0 is One Minute
|
||||
enum DeviceRoles: Int, CaseIterable, Identifiable {
|
||||
|
||||
case client = 0
|
||||
case clientMute = 1
|
||||
case router = 2
|
||||
case routerClient = 3
|
||||
|
||||
var id: Int { self.rawValue }
|
||||
var description: String {
|
||||
get {
|
||||
switch self {
|
||||
|
||||
case .client:
|
||||
return "Client (default)"
|
||||
case .clientMute:
|
||||
return "Client Mute - Packets will not hop over this node, does not contribute to routing packets for mesh."
|
||||
case .router:
|
||||
return "Router - Mesh packets will prefer to be routed over this node. This node will not be used by client apps. The wifi/ble radios and the oled screen will be put to sleep."
|
||||
case .routerClient:
|
||||
return "Router Client - Mesh packets will prefer to be routed over this node. The Router Client can be used as both a Router and an app connected Client."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct DeviceConfig: View {
|
||||
|
||||
@Environment(\.managedObjectContext) var context
|
||||
@EnvironmentObject var bleManager: BLEManager
|
||||
|
||||
@State var deviceRole = 0
|
||||
@State var serialEnabled = true
|
||||
@State var debugLogEnabled = false
|
||||
|
||||
var body: some View {
|
||||
|
||||
VStack {
|
||||
|
||||
Form {
|
||||
|
||||
Section(header: Text("Options")) {
|
||||
|
||||
Picker("Device Role", selection: $deviceRole ) {
|
||||
ForEach(DeviceRoles.allCases) { dr in
|
||||
Text(dr.description)
|
||||
}
|
||||
}
|
||||
.pickerStyle(InlinePickerStyle())
|
||||
.padding(.top, 10)
|
||||
.padding(.bottom, 10)
|
||||
}
|
||||
|
||||
Section(header: Text("Debug")) {
|
||||
|
||||
Toggle(isOn: $serialEnabled) {
|
||||
|
||||
Label("Serial Console", systemImage: "terminal")
|
||||
}
|
||||
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
|
||||
|
||||
Toggle(isOn: $debugLogEnabled) {
|
||||
|
||||
Label("Debug Log", systemImage: "ant.fill")
|
||||
}
|
||||
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
|
||||
}
|
||||
}
|
||||
.navigationTitle("Device Config")
|
||||
.navigationBarItems(trailing:
|
||||
|
||||
ZStack {
|
||||
|
||||
ConnectedDevice(bluetoothOn: bleManager.isSwitchedOn, deviceConnected: bleManager.connectedPeripheral != nil, name: (bleManager.connectedPeripheral != nil) ? bleManager.connectedPeripheral.lastFourCode : "????")
|
||||
})
|
||||
.onAppear {
|
||||
|
||||
self.bleManager.context = context
|
||||
}
|
||||
.navigationViewStyle(StackNavigationViewStyle())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -124,7 +124,7 @@ struct PositionConfig: View {
|
|||
|
||||
Form {
|
||||
|
||||
Section(header: Text("Device GPS Options")) {
|
||||
Section(header: Text("Device GPS")) {
|
||||
|
||||
Toggle(isOn: $deviceGpsEnabled) {
|
||||
|
||||
|
|
@ -133,7 +133,7 @@ struct PositionConfig: View {
|
|||
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
|
||||
if deviceGpsEnabled {
|
||||
|
||||
Picker("GPS Update Interval", selection: $gpsUpdateInterval) {
|
||||
Picker("Update Interval", selection: $gpsUpdateInterval) {
|
||||
ForEach(GpsUpdateIntervals.allCases) { ui in
|
||||
Text(ui.description)
|
||||
}
|
||||
|
|
@ -144,7 +144,7 @@ struct PositionConfig: View {
|
|||
.font(.caption)
|
||||
.listRowSeparator(.visible)
|
||||
|
||||
Picker("GPS Attempt Time", selection: $gpsAttemptTime) {
|
||||
Picker("Attempt Time", selection: $gpsAttemptTime) {
|
||||
ForEach(GpsAttemptTimes.allCases) { at in
|
||||
Text(at.description)
|
||||
}
|
||||
|
|
@ -172,7 +172,7 @@ struct PositionConfig: View {
|
|||
|
||||
}
|
||||
}
|
||||
Section(header: Text("Position Packet Options")) {
|
||||
Section(header: Text("Position Packet")) {
|
||||
|
||||
Toggle(isOn: $smartPositionEnabled) {
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,13 @@ struct PowerConfig: View {
|
|||
VStack {
|
||||
|
||||
Form {
|
||||
|
||||
|
||||
Section(header: Text("Warning")) {
|
||||
|
||||
Text("These power settings are designed for and and are only useful mostly for solar use cases. Do not use these settings if you are planning on using your device for messaging paired with a phone.")
|
||||
.font(.callout)
|
||||
.listRowSeparator(.visible)
|
||||
}
|
||||
Section(header: Text("States")) {
|
||||
|
||||
Toggle(isOn: $isPowerSaving) {
|
||||
|
|
@ -30,7 +36,7 @@ struct PowerConfig: View {
|
|||
}
|
||||
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
|
||||
.disabled(isAlwaysPowered)
|
||||
Text("If set, we are powered from a low-current source (i.e. solar), so even if it looks like we have power flowing in we should try to minimize power consumption as much as possible.")
|
||||
Text("If set, we are powered from a low-current source (i.e. solar) and do not intend on using a client to connect via BLE, WiFi or Serial. This setting is assumed and unnessary if you have turned on Router mode.")
|
||||
.font(.caption)
|
||||
.listRowSeparator(.visible)
|
||||
|
||||
|
|
@ -40,7 +46,7 @@ struct PowerConfig: View {
|
|||
}
|
||||
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
|
||||
.disabled(isPowerSaving)
|
||||
Text("Circumvents the logic block for determining whether the device is powered or not. Useful for devices with finicky ADC issues on the battery sense pins, or no battery pin at all.")
|
||||
Text("Circumvents the logic block for determining whether the device is powered or not. Useful for devices with finicky ADC issues on the battery sense pins, or no battery pin at all. This mode increases battery use substantially")
|
||||
.font(.caption)
|
||||
.listRowSeparator(.visible)
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,14 @@ struct Settings: View {
|
|||
|
||||
Section("Radio Configuration (Non-Functional Interaction Previews)") {
|
||||
|
||||
NavigationLink {
|
||||
DeviceConfig()
|
||||
} label: {
|
||||
|
||||
Image(systemName: "flipphone")
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
Text("Device")
|
||||
}
|
||||
NavigationLink {
|
||||
DisplayConfig()
|
||||
} label: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue