From 32fe4f1ca197fa314595d4051b1b560d0e67eb27 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Fri, 23 Feb 2024 08:00:34 -0800 Subject: [PATCH] Hide esp32 sleep options --- Meshtastic/Helpers/BLEManager.swift | 2 +- Meshtastic/Helpers/MeshPackets.swift | 3 +- .../Views/Settings/Config/PowerConfig.swift | 53 +++++++++---------- 3 files changed, 28 insertions(+), 30 deletions(-) diff --git a/Meshtastic/Helpers/BLEManager.swift b/Meshtastic/Helpers/BLEManager.swift index d80dbd15..045fb762 100644 --- a/Meshtastic/Helpers/BLEManager.swift +++ b/Meshtastic/Helpers/BLEManager.swift @@ -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 { diff --git a/Meshtastic/Helpers/MeshPackets.swift b/Meshtastic/Helpers/MeshPackets.swift index ef5ba3eb..1b641181 100644 --- a/Meshtastic/Helpers/MeshPackets.swift +++ b/Meshtastic/Helpers/MeshPackets.swift @@ -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) diff --git a/Meshtastic/Views/Settings/Config/PowerConfig.swift b/Meshtastic/Views/Settings/Config/PowerConfig.swift index e76e5f83..ae3536cd 100644 --- a/Meshtastic/Views/Settings/Config/PowerConfig.swift +++ b/Meshtastic/Views/Settings/Config/PowerConfig.swift @@ -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)