mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Clean up the 4 mocked up configuration pages
This commit is contained in:
parent
0cc89b301e
commit
07ad4e7a31
6 changed files with 65 additions and 137 deletions
|
|
@ -233,9 +233,9 @@
|
|||
DD8EBF42285058FA00426DCA /* DisplayConfig.swift */,
|
||||
DD2553562855B02500E55709 /* LoRaConfig.swift */,
|
||||
DD2553582855B52700E55709 /* PositionConfig.swift */,
|
||||
DD25535C285666C700E55709 /* PowerConfig.swift */,
|
||||
DD8169FA271F1F3A00F4AB02 /* MeshLog.swift */,
|
||||
DD8169FE272476C700F4AB02 /* LogDocument.swift */,
|
||||
DD25535C285666C700E55709 /* PowerConfig.swift */,
|
||||
);
|
||||
path = Settings;
|
||||
sourceTree = "<group>";
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ struct NodeDetail: View {
|
|||
var node: NodeInfoEntity
|
||||
|
||||
var body: some View {
|
||||
|
||||
let hwModelString = node.user?.hwModel ?? "UNSET"
|
||||
|
||||
HStack {
|
||||
|
||||
|
|
@ -87,8 +89,6 @@ struct NodeDetail: View {
|
|||
HStack {
|
||||
if self.bleManager.connectedPeripheral != nil && self.bleManager.connectedPeripheral.num == node.num && self.bleManager.connectedPeripheral.num == node.num {
|
||||
|
||||
let hwModelString = node.user?.hwModel ?? "UNSET"
|
||||
|
||||
if hwModelString == "TBEAM" || hwModelString == "TECHO" || hwModelString.contains("4631") {
|
||||
|
||||
Button(action: {
|
||||
|
|
@ -117,35 +117,32 @@ struct NodeDetail: View {
|
|||
}
|
||||
}
|
||||
|
||||
Button(action: {
|
||||
|
||||
isPresentingRebootConfirm = true
|
||||
|
||||
Button(action: {
|
||||
|
||||
isPresentingRebootConfirm = true
|
||||
|
||||
}) {
|
||||
|
||||
Image(systemName: "arrow.triangle.2.circlepath")
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
.imageScale(.small)
|
||||
.foregroundColor(Color.accentColor)
|
||||
Text("Reboot")
|
||||
.font(.caption)
|
||||
}) {
|
||||
|
||||
Image(systemName: "arrow.triangle.2.circlepath")
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
.imageScale(.small)
|
||||
.foregroundColor(Color.accentColor)
|
||||
Text("Reboot")
|
||||
.font(.caption)
|
||||
|
||||
}
|
||||
.padding()
|
||||
.background(Color(.systemGray6))
|
||||
.clipShape(Capsule())
|
||||
.confirmationDialog(
|
||||
"Are you sure?",
|
||||
isPresented: $isPresentingRebootConfirm
|
||||
}
|
||||
.padding()
|
||||
.background(Color(.systemGray6))
|
||||
.clipShape(Capsule())
|
||||
.confirmationDialog(
|
||||
"Are you sure?",
|
||||
isPresented: $isPresentingRebootConfirm
|
||||
) {
|
||||
Button("Reboot Node?", role: .destructive) {
|
||||
let success = bleManager.sendReboot(destNum: node.num, wantResponse: false)
|
||||
Button("Reboot Node?", role: .destructive) {
|
||||
let success = bleManager.sendReboot(destNum: node.num, wantResponse: false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
.padding(5)
|
||||
Divider()
|
||||
|
|
|
|||
|
|
@ -110,9 +110,9 @@ struct DisplayConfig: View {
|
|||
@Environment(\.managedObjectContext) var context
|
||||
@EnvironmentObject var bleManager: BLEManager
|
||||
|
||||
@State var isConnected: Bool = false
|
||||
|
||||
@State var gpsFormat: Config.DisplayConfig.GpsCoordinateFormat = .gpsFormatDec
|
||||
@State var screenOnSeconds = 0
|
||||
@State var screenCarouselInterval = 0
|
||||
@State var gpsFormat = 0
|
||||
|
||||
var body: some View {
|
||||
|
||||
|
|
@ -121,9 +121,9 @@ struct DisplayConfig: View {
|
|||
Form {
|
||||
Section(header: Text("Timing")) {
|
||||
|
||||
Picker("Screen on for", selection: $gpsFormat ) {
|
||||
ForEach(ScreenOnSeconds.allCases) { lu in
|
||||
Text(lu.description)
|
||||
Picker("Screen on for", selection: $screenOnSeconds ) {
|
||||
ForEach(ScreenOnSeconds.allCases) { sos in
|
||||
Text(sos.description)
|
||||
}
|
||||
}
|
||||
.pickerStyle(DefaultPickerStyle())
|
||||
|
|
@ -132,9 +132,9 @@ struct DisplayConfig: View {
|
|||
.font(.caption)
|
||||
.listRowSeparator(.visible)
|
||||
|
||||
Picker("Carousel Interval", selection: $gpsFormat ) {
|
||||
ForEach(ScreenCarouselSeconds.allCases) { lu in
|
||||
Text(lu.description)
|
||||
Picker("Carousel Interval", selection: $screenCarouselInterval ) {
|
||||
ForEach(ScreenCarouselSeconds.allCases) { scs in
|
||||
Text(scs.description)
|
||||
}
|
||||
}
|
||||
.pickerStyle(DefaultPickerStyle())
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
import SwiftUI
|
||||
|
||||
|
||||
enum RegionCodes : Int, CaseIterable, Identifiable {
|
||||
|
||||
case unset = 0
|
||||
|
|
@ -96,9 +95,9 @@ struct LoRaConfig: View {
|
|||
@Environment(\.managedObjectContext) var context
|
||||
@EnvironmentObject var bleManager: BLEManager
|
||||
|
||||
@State var region: Config.LoRaConfig.RegionCode = .us
|
||||
|
||||
@State var modemPreset: Config.LoRaConfig.ModemPreset = .longFast
|
||||
@State var region = 1
|
||||
@State var modemPreset = 0
|
||||
@State var numberOfHops = 0
|
||||
|
||||
var body: some View {
|
||||
|
||||
|
|
@ -130,9 +129,20 @@ struct LoRaConfig: View {
|
|||
.listRowSeparator(.visible)
|
||||
.listRowSeparator(.visible)
|
||||
}
|
||||
|
||||
Section(header: Text("Mesh Options")) {
|
||||
|
||||
Picker("Number of hops", selection: $numberOfHops) {
|
||||
ForEach(0..<8) {
|
||||
if $0 == 0 {
|
||||
Text("Default")
|
||||
} else {
|
||||
Text("\($0) Hops")
|
||||
}
|
||||
}
|
||||
}
|
||||
.pickerStyle(DefaultPickerStyle())
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
.navigationTitle("LoRa Config")
|
||||
.navigationBarItems(trailing:
|
||||
|
|
|
|||
|
|
@ -114,9 +114,9 @@ struct PositionConfig: View {
|
|||
@State var smartPositionEnabled = true
|
||||
@State var deviceGpsEnabled = true
|
||||
@State var fixedPosition = false
|
||||
@State var gpsUpdateInterval: Int32 = 0
|
||||
@State var gpsAttemptTime: Int32 = 0
|
||||
@State var positionBroadcastSeconds: Int32 = 0
|
||||
@State var gpsUpdateInterval = 0
|
||||
@State var gpsAttemptTime = 0
|
||||
@State var positionBroadcastSeconds = 0
|
||||
|
||||
var body: some View {
|
||||
|
||||
|
|
|
|||
|
|
@ -8,82 +8,13 @@
|
|||
import Foundation
|
||||
import SwiftUI
|
||||
|
||||
enum ChargeCurrents: Int, CaseIterable, Identifiable {
|
||||
|
||||
case maunset = 0
|
||||
case ma100 = 1
|
||||
case ma190 = 2
|
||||
case ma280 = 3
|
||||
case ma360 = 4
|
||||
case ma450 = 5
|
||||
case ma550 = 6
|
||||
case ma630 = 7
|
||||
case ma700 = 8
|
||||
case ma780 = 9
|
||||
case ma880 = 10
|
||||
case ma960 = 11
|
||||
case ma1000 = 12
|
||||
case ma1080 = 13
|
||||
case ma1160 = 14
|
||||
case ma1240 = 15
|
||||
case ma1320 = 16
|
||||
|
||||
var id: Int { self.rawValue }
|
||||
var description: String {
|
||||
get {
|
||||
switch self {
|
||||
|
||||
case .maunset:
|
||||
return "UNSET (default)"
|
||||
case .ma100:
|
||||
return "100 mA"
|
||||
case .ma190:
|
||||
return "190 mA"
|
||||
case .ma280:
|
||||
return "280 mA"
|
||||
case .ma360:
|
||||
return "360 mA"
|
||||
case .ma450:
|
||||
return "450 mA"
|
||||
case .ma550:
|
||||
return "550 mA"
|
||||
case .ma630:
|
||||
return "630 mA"
|
||||
case .ma700:
|
||||
return "700 mA"
|
||||
case .ma780:
|
||||
return "780 mA"
|
||||
case .ma880:
|
||||
return "880 mA"
|
||||
case .ma960:
|
||||
return "960 mA"
|
||||
case .ma1000:
|
||||
return "1000 mA"
|
||||
case .ma1080:
|
||||
return "1080 mA"
|
||||
case .ma1160:
|
||||
return "1160 mA"
|
||||
case .ma1240:
|
||||
return "1240 mA"
|
||||
case .ma1320:
|
||||
return "1320 mA"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct PowerConfig: View {
|
||||
|
||||
@Environment(\.managedObjectContext) var context
|
||||
@EnvironmentObject var bleManager: BLEManager
|
||||
|
||||
@State var chargeCurrent = 0
|
||||
@State var deviceGpsEnabled = true
|
||||
@State var fixedPosition = false
|
||||
@State var gpsUpdateInterval: Int32 = 0
|
||||
@State var gpsAttemptTime: Int32 = 0
|
||||
@State var positionBroadcastSeconds: Int32 = 0
|
||||
@State var isPowerSaving = false
|
||||
@State var isAlwaysPowered = false
|
||||
|
||||
var body: some View {
|
||||
|
||||
|
|
@ -91,36 +22,26 @@ struct PowerConfig: View {
|
|||
|
||||
Form {
|
||||
|
||||
Section(header: Text("Charging Options")) {
|
||||
Section(header: Text("States")) {
|
||||
|
||||
Picker("Charge Current", selection: $chargeCurrent) {
|
||||
ForEach(ChargeCurrents.allCases) { cc in
|
||||
Text(cc.description)
|
||||
}
|
||||
}
|
||||
.pickerStyle(DefaultPickerStyle())
|
||||
|
||||
Text("Sets the charge control current of devices with a battery charger that can be configured. This is passed into the axp power management chip like on the tbeam.")
|
||||
.font(.caption)
|
||||
.listRowSeparator(.visible)
|
||||
|
||||
|
||||
Toggle(isOn: $fixedPosition) {
|
||||
Toggle(isOn: $isPowerSaving) {
|
||||
|
||||
Label("Fixed Position", systemImage: "location.square.fill")
|
||||
Label("Power Saving", systemImage: "powersleep")
|
||||
}
|
||||
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
|
||||
if fixedPosition {
|
||||
|
||||
Text("Set to current location here")
|
||||
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.")
|
||||
.font(.caption)
|
||||
.listRowSeparator(.visible)
|
||||
|
||||
Toggle(isOn: $isAlwaysPowered) {
|
||||
|
||||
Label("Always Powered", systemImage: "powerplug.fill")
|
||||
}
|
||||
}
|
||||
Section(header: Text("Position Flags")) {
|
||||
Text("TODO")
|
||||
.font(.caption)
|
||||
.listRowSeparator(.visible)
|
||||
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
|
||||
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.")
|
||||
.font(.caption)
|
||||
.listRowSeparator(.visible)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue