Hide esp32 sleep options

This commit is contained in:
Garth Vander Houwen 2024-02-23 08:00:34 -08:00
parent 4fe467f988
commit 32fe4f1ca1
3 changed files with 28 additions and 30 deletions

View file

@ -532,7 +532,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate
connectedPeripheral.name = myInfo?.bleName ?? "unknown".localized
connectedPeripheral.longName = myInfo?.bleName ?? "unknown".localized
}
tryClearExistingChannels()
//tryClearExistingChannels()
}
// NodeInfo
if decodedInfo.nodeInfo.num > 0 {// && !invalidVersion {

View file

@ -155,8 +155,7 @@ func channelPacket (channel: Channel, fromNum: Int64, context: NSManagedObjectCo
guard let mutableChannels = fetchedMyInfo[0].channels!.mutableCopy() as? NSMutableOrderedSet else {
return
}
if mutableChannels.contains(newChannel) {
let oldChannel = mutableChannels.first(where: {($0 as AnyObject).index == newChannel.index }) as! ChannelEntity
if let oldChannel = mutableChannels.first(where: {($0 as AnyObject).index == newChannel.index }) as? ChannelEntity {
newChannel.mute = oldChannel.mute
let index = mutableChannels.index(of: oldChannel as Any)
mutableChannels.replaceObject(at: index, with: newChannel)

View file

@ -31,7 +31,7 @@ struct PowerConfig: View {
if currentDevice?.architecture == .esp32 || currentDevice?.architecture == .esp32S3 {
Toggle(isOn: $isPowerSaving) {
Label("Power Saving", systemImage: "bolt")
Text("Will sleep everything as much as possible, for the tracker and sensor role this will also include the lora radio. Don't use this setting if you want to use your device with the phone apps.")
Text("Will sleep everything as much as possible, for the tracker and sensor role this will also include the lora radio. Don't use this setting if you want to use your device with the phone apps or are using a device without a user button.")
}
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
}
@ -71,32 +71,31 @@ struct PowerConfig: View {
} header: {
Text("Battery")
}
Section {
Picker("power.wait.bluetooth.secs", selection: $waitBluetoothSecs) {
ForEach(PowerIntervals.allCases) {
Text($0.description)
}
}
.pickerStyle(DefaultPickerStyle())
Picker("power.ls.secs", selection: $lsSecs) {
ForEach(PowerIntervals.allCases) {
Text($0.description)
}
}
.pickerStyle(DefaultPickerStyle())
Picker("power.min.wake.secs", selection: $minWakeSecs) {
ForEach(PowerIntervals.allCases) {
Text($0.description)
}
}
.pickerStyle(DefaultPickerStyle())
} header: {
Text("Sleep")
}
// Section {
// Picker("power.wait.bluetooth.secs", selection: $waitBluetoothSecs) {
// ForEach(PowerIntervals.allCases) {
// Text($0.description)
// }
// }
// .pickerStyle(DefaultPickerStyle())
//
// Picker("power.ls.secs", selection: $lsSecs) {
// ForEach(PowerIntervals.allCases) {
// Text($0.description)
// }
// }
// .pickerStyle(DefaultPickerStyle())
//
// Picker("power.min.wake.secs", selection: $minWakeSecs) {
// ForEach(PowerIntervals.allCases) {
// Text($0.description)
// }
// }
// .pickerStyle(DefaultPickerStyle())
//
// } header: {
// Text("Sleep")
// }
}
}
.disabled(self.bleManager.connectedPeripheral == nil || node?.powerConfig == nil)