Handle duty cycle of 0 for UNSET region

This commit is contained in:
Garth Vander Houwen 2024-02-21 17:42:46 -08:00
parent e9c8de9837
commit dd1c1522b5
8 changed files with 11 additions and 7 deletions

View file

@ -95,6 +95,7 @@ struct Channels: View {
}
}
.sheet(isPresented: $isPresentingEditView) {
#if targetEnvironment(macCatalyst)
Text("channel")
.font(.largeTitle)
@ -324,17 +325,16 @@ struct Channels: View {
.padding(.bottom)
#endif
}
.presentationDetents([.medium, .large])
.presentationDetents([.fraction(0.45), .fraction(0.55), .fraction(0.65)])
.presentationDragIndicator(.visible)
}
if node?.myInfo?.channels?.array.count ?? 0 < 8 && node != nil {
Button {
let lastChannel = node?.myInfo?.channels?.lastObject as? ChannelEntity
let channelIndexes = node?.myInfo?.channels?.compactMap({(ch) -> Int in
return (ch as AnyObject).index
})
var firstChannelIndex = firstMissingChannelIndex(channelIndexes ?? [])
let firstChannelIndex = firstMissingChannelIndex(channelIndexes ?? [])
channelKeySize = 16
let key = generateChannelKey(size: channelKeySize)
channelName = ""

View file

@ -32,7 +32,7 @@ struct MQTTConfig: View {
Form {
if node != nil && node?.loRaConfig != nil {
let rc = RegionCodes(rawValue: Int(node?.loRaConfig?.regionCode ?? 0))
if rc?.dutyCycle ?? 0 <= 10 {
if rc?.dutyCycle ?? 0 > 0 && rc?.dutyCycle ?? 0 < 100 {
Text("Your region has a \(rc?.dutyCycle ?? 0)% duty cycle. MQTT is not advised when you are duty cycle restricted, the extra traffic will quickly overwhelm your LoRa mesh.")
.font(.callout)
.foregroundColor(.red)

View file

@ -129,7 +129,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 < 1 {
if rc?.dutyCycle ?? 0 > 0 && rc?.dutyCycle ?? 0 < 100 {
Label {
Text("Hourly Duty Cycle")
@ -144,7 +144,6 @@ struct Settings: View {
Text("Limit all periodic broadcasts 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 {

View file

@ -65,6 +65,7 @@
"detection.sensor"="Detection Sensor";
"device"="Gerät";
"device.config"="Gerätekonfiguration";
"device.configuration"="Device Configuration";
"device.metrics.delete"="Delete all device metrics?";
"device.metrics.log"="Device Metrics Log";
"device.role.client"="Client (Standard) - Mit App verbundener Client.";

View file

@ -67,6 +67,7 @@
"detection.sensor.log"="Detection Sensor Log";
"device"="Device";
"device.config"="Device Config";
"device.configuration"="Device Configuration";
"device.metrics.delete"="Delete all device metrics?";
"device.metrics.log"="Device Metrics Log";
"device.role.client"="App connected or stand alone messaging device.";

View file

@ -67,6 +67,7 @@
"detection.sensor.log"="יומן חיישן זיהוי";
"device"="מכשיר";
"device.config"="הגדרות מכשיר";
"device.configuration"="Device Configuration";
"device.metrics.delete"="נקה יומן מכשיר?";
"device.metrics.log"="יומן מכשיר";
"device.role.client"="אפליקציה מחוברת או מכשיר תקשורת עצמאי.";

View file

@ -67,6 +67,7 @@
"detection.sensor"="Detection Sensor";
"device"="Urządzenie";
"device.config"="Konfiguracja urządzenia";
"device.configuration"="Device Configuration";
"device.metrics.delete"="Usunąć wszystkie metryki urządzenia?";
"device.metrics.log"="Dziennik metryk urządzenia";
"device.role.client"="Klient (domyślnie) - Klient połączony z aplikacją.";

View file

@ -65,6 +65,7 @@
"detection.sensor"="Detection Sensor";
"device"="电台";
"device.config"="电台配置";
"device.configuration"="Device Configuration";
"device.metrics.delete"="删除所有电台指标?";
"device.metrics.log"="电台指标日志";
"device.role.client"="标准模式 - App 可以连接到电台进行收发操作,并且会自动转发 Mesh 网络中其他节点的消息。";