From 0cc89b301eb914480c9b2a7d5647ba8caad8bacb Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Sun, 12 Jun 2022 18:31:12 -0700 Subject: [PATCH] Update shutdown button logic, add loraconfig to core data, add always on as on option for screen on seconds --- .../MeshtasticDataModel v 3.xcdatamodel/contents | 8 +++++++- MeshtasticApple/Views/Nodes/NodeDetail.swift | 6 ++++++ MeshtasticApple/Views/Settings/DisplayConfig.swift | 3 +++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/MeshtasticApple/Meshtastic.xcdatamodeld/MeshtasticDataModel v 3.xcdatamodel/contents b/MeshtasticApple/Meshtastic.xcdatamodeld/MeshtasticDataModel v 3.xcdatamodel/contents index a5ab71a8..7d5d50e1 100644 --- a/MeshtasticApple/Meshtastic.xcdatamodeld/MeshtasticDataModel v 3.xcdatamodel/contents +++ b/MeshtasticApple/Meshtastic.xcdatamodeld/MeshtasticDataModel v 3.xcdatamodel/contents @@ -1,5 +1,10 @@ - + + + + + + @@ -99,5 +104,6 @@ + \ No newline at end of file diff --git a/MeshtasticApple/Views/Nodes/NodeDetail.swift b/MeshtasticApple/Views/Nodes/NodeDetail.swift index db5a979e..e8a30a25 100644 --- a/MeshtasticApple/Views/Nodes/NodeDetail.swift +++ b/MeshtasticApple/Views/Nodes/NodeDetail.swift @@ -87,6 +87,10 @@ 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: { isPresentingShutdownConfirm = true @@ -111,6 +115,8 @@ struct NodeDetail: View { let success = bleManager.sendShutdown(destNum: node.num, wantResponse: false) } } + } + Button(action: { diff --git a/MeshtasticApple/Views/Settings/DisplayConfig.swift b/MeshtasticApple/Views/Settings/DisplayConfig.swift index aefc89ac..cd370dd8 100644 --- a/MeshtasticApple/Views/Settings/DisplayConfig.swift +++ b/MeshtasticApple/Views/Settings/DisplayConfig.swift @@ -46,6 +46,7 @@ enum ScreenOnSeconds: Int, CaseIterable, Identifiable { case fiveMinutes = 300 case tenMinutes = 600 case fifteenMinutes = 900 + case max = 2147483647 var id: Int { self.rawValue } var description: String { @@ -63,6 +64,8 @@ enum ScreenOnSeconds: Int, CaseIterable, Identifiable { return "Ten Minutes" case .fifteenMinutes: return "Fifteen Minutes" + case .max: + return "Always On" } } }