mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Merge remote-tracking branch 'refs/remotes/origin/2.3.12_Working_Changes'
This commit is contained in:
commit
7aa9bbf497
1 changed files with 66 additions and 55 deletions
|
|
@ -20,6 +20,7 @@ struct Settings: View {
|
|||
@State private var selectedNode: Int = 0
|
||||
@State private var preferredNodeNum: Int = 0
|
||||
@State private var selection: SettingsSidebar = .about
|
||||
|
||||
enum SettingsSidebar {
|
||||
case appSettings
|
||||
case routes
|
||||
|
|
@ -51,8 +52,72 @@ struct Settings: View {
|
|||
case appLog
|
||||
case appData
|
||||
}
|
||||
|
||||
var radioConfigurationSection: some View {
|
||||
Section("radio.configuration") {
|
||||
let node = nodes.first(where: { $0.num == preferredNodeNum })
|
||||
if let node,
|
||||
let loRaConfig = node.loRaConfig,
|
||||
let rc = RegionCodes(rawValue: Int(loRaConfig.regionCode)),
|
||||
let user = node.user,
|
||||
!user.isLicensed,
|
||||
rc.dutyCycle > 0 && rc.dutyCycle < 100 {
|
||||
Label {
|
||||
Text("Hourly Duty Cycle")
|
||||
} icon: {
|
||||
Image(systemName: "clock.arrow.circlepath")
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
.foregroundColor(.red)
|
||||
}
|
||||
Text("Your region has a \(rc.dutyCycle)% hourly duty cycle, your radio will stop sending packets when it reaches the hourly limit.")
|
||||
.foregroundColor(.orange)
|
||||
.font(.caption)
|
||||
Text("Limit all periodic broadcast intervals especially telemetry and position. If you need to increase hops, do it on nodes at the edges, not the ones in the middle. MQTT is not advised when you are duty cycle restricted because the gateway node is then doing all the work.")
|
||||
.font(.caption2)
|
||||
.foregroundColor(.gray)
|
||||
}
|
||||
|
||||
NavigationLink {
|
||||
LoRaConfig(node: nodes.first(where: { $0.num == selectedNode }))
|
||||
} label: {
|
||||
Label {
|
||||
Text("lora")
|
||||
} icon: {
|
||||
Image(systemName: "dot.radiowaves.left.and.right")
|
||||
.rotationEffect(.degrees(-90))
|
||||
}
|
||||
}
|
||||
.tag(SettingsSidebar.loraConfig)
|
||||
|
||||
NavigationLink {
|
||||
Channels(node: node)
|
||||
} label: {
|
||||
Label {
|
||||
Text("channels")
|
||||
} icon: {
|
||||
Image(systemName: "fibrechannel")
|
||||
}
|
||||
}
|
||||
.tag(SettingsSidebar.channelConfig)
|
||||
.disabled(selectedNode > 0 && selectedNode != preferredNodeNum)
|
||||
|
||||
NavigationLink {
|
||||
ShareChannels(node: node)
|
||||
} label: {
|
||||
Label {
|
||||
Text("share.channels")
|
||||
} icon: {
|
||||
Image(systemName: "qrcode")
|
||||
}
|
||||
}
|
||||
.tag(SettingsSidebar.shareChannels)
|
||||
.disabled(selectedNode > 0 && selectedNode != preferredNodeNum)
|
||||
}
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
NavigationSplitView {
|
||||
let node = nodes.first(where: { $0.num == preferredNodeNum })
|
||||
List {
|
||||
NavigationLink {
|
||||
AboutMeshtastic()
|
||||
|
|
@ -98,7 +163,6 @@ struct Settings: View {
|
|||
.tag(SettingsSidebar.routeRecorder)
|
||||
}
|
||||
|
||||
let node = nodes.first(where: { $0.num == preferredNodeNum })
|
||||
let hasAdmin = node?.myInfo?.adminIndex ?? 0 > 0 ? true : false
|
||||
|
||||
if !(node?.deviceConfig?.isManaged ?? false) {
|
||||
|
|
@ -160,60 +224,7 @@ struct Settings: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
Section("radio.configuration") {
|
||||
if node != nil && node?.loRaConfig != nil {
|
||||
let rc = RegionCodes(rawValue: Int(node?.loRaConfig?.regionCode ?? 0))
|
||||
if rc?.dutyCycle ?? 0 > 0 && rc?.dutyCycle ?? 0 < 100 {
|
||||
|
||||
Label {
|
||||
Text("Hourly Duty Cycle")
|
||||
} icon: {
|
||||
Image(systemName: "clock.arrow.circlepath")
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
.foregroundColor(.red)
|
||||
}
|
||||
Text("Your region has a \(rc?.dutyCycle ?? 0)% hourly duty cycle, your radio will stop sending packets when it reaches the hourly limit.")
|
||||
.foregroundColor(.orange)
|
||||
.font(.caption)
|
||||
Text("Limit all periodic broadcast intervals especially telemetry and position. If you need to increase hops, do it on nodes at the edges, not the ones in the middle. MQTT is not advised when you are duty cycle restricted because the gateway node is then doing all the work.")
|
||||
.font(.caption2)
|
||||
.foregroundColor(.gray)
|
||||
}
|
||||
}
|
||||
NavigationLink {
|
||||
LoRaConfig(node: nodes.first(where: { $0.num == selectedNode }))
|
||||
} label: {
|
||||
Label {
|
||||
Text("lora")
|
||||
} icon: {
|
||||
Image(systemName: "dot.radiowaves.left.and.right")
|
||||
.rotationEffect(.degrees(-90))
|
||||
}
|
||||
}
|
||||
.tag(SettingsSidebar.loraConfig)
|
||||
NavigationLink {
|
||||
Channels(node: nodes.first(where: { $0.num == preferredNodeNum }))
|
||||
} label: {
|
||||
Label {
|
||||
Text("channels")
|
||||
} icon: {
|
||||
Image(systemName: "fibrechannel")
|
||||
}
|
||||
}
|
||||
.tag(SettingsSidebar.channelConfig)
|
||||
.disabled(selectedNode > 0 && selectedNode != preferredNodeNum)
|
||||
NavigationLink {
|
||||
ShareChannels(node: nodes.first(where: { $0.num == preferredNodeNum }))
|
||||
} label: {
|
||||
Label {
|
||||
Text("share.channels")
|
||||
} icon: {
|
||||
Image(systemName: "qrcode")
|
||||
}
|
||||
}
|
||||
.tag(SettingsSidebar.shareChannels)
|
||||
.disabled(selectedNode > 0 && selectedNode != preferredNodeNum)
|
||||
}
|
||||
radioConfigurationSection
|
||||
Section("device.configuration") {
|
||||
NavigationLink {
|
||||
UserConfig(node: nodes.first(where: { $0.num == selectedNode }))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue