diff --git a/Meshtastic/Enums/HardwareModels.swift b/Meshtastic/Enums/HardwareModels.swift index b9ddcf77..9911e465 100644 --- a/Meshtastic/Enums/HardwareModels.swift +++ b/Meshtastic/Enums/HardwareModels.swift @@ -7,32 +7,55 @@ import Foundation // Default of 0 is Client -enum HardwareModels: Int, CaseIterable, Identifiable { +enum HardwareModels: String, CaseIterable, Identifiable { - case UNSET = 0 - case TLORA_V2 = 1 - case TLORA_V1 = 2 - case TLORA_V2_1_1P6 = 3 - case TBEAM = 4 - case HELTEC_V2_0 = 5 - case TBEAM_V0P7 = 6 - case T_ECHO = 7 - case TLORA_V1_1P3 = 8 - case RAK4631 = 9 - case HELTEC_V2_1 = 10 - case HELTEC_V1 = 11 - case LILYGO_TBEAM_S3_CORE = 12 - case RAK11200 = 13 - case NANO_G1 = 14 - case TLORA_V2_1_1P8 = 15 - case TLORA_T3_S3 = 16 - case NANO_G1_EXPLORER = 17 - case STATION_G1 = 25 - case M5STACK = 42 - case HELTEC_V3 = 43 - case HELTEC_WSL_V3 = 45 + case UNSET + case TLORA_V2 + case TLORA_V1 + case TLORA_V2_1_1P6 + case TBEAM + case HELTEC_V2_0 + case TBEAM_V0P7 + case T_ECHO + case TLORA_V1_1P3 + case RAK4631 + case HELTEC_V2_1 + case HELTEC_V1 + case LILYGO_TBEAM_S3_CORE + case RAK11200 + case NANO_G1 + case TLORA_V2_1_1P8 + case TLORA_T3_S3 + case NANO_G1_EXPLORER + case STATION_G1 + case M5STACK + case HELTEC_V3 + case HELTEC_WSL_V3 - var id: Int { self.rawValue } +// case UNSET = 0 +// case TLORA_V2 = 1 +// case TLORA_V1 = 2 +// case TLORA_V2_1_1P6 = 3 +// case TBEAM = 4 +// case HELTEC_V2_0 = 5 +// case TBEAM_V0P7 = 6 +// case T_ECHO = 7 +// case TLORA_V1_1P3 = 8 +// case RAK4631 = 9 +// case HELTEC_V2_1 = 10 +// case HELTEC_V1 = 11 +// case LILYGO_TBEAM_S3_CORE = 12 +// case RAK11200 = 13 +// case NANO_G1 = 14 +// case TLORA_V2_1_1P8 = 15 +// case TLORA_T3_S3 = 16 +// case NANO_G1_EXPLORER = 17 +// case STATION_G1 = 25 +// case M5STACK = 42 +// case HELTEC_V3 = 43 +// case HELTEC_WSL_V3 = 45 + + var id: String { self.rawValue } var description: String { switch self { diff --git a/Meshtastic/Views/Settings/Config/LoRaConfig.swift b/Meshtastic/Views/Settings/Config/LoRaConfig.swift index 51af0fb1..cb34e10a 100644 --- a/Meshtastic/Views/Settings/Config/LoRaConfig.swift +++ b/Meshtastic/Views/Settings/Config/LoRaConfig.swift @@ -46,7 +46,12 @@ struct LoRaConfig: View { VStack { Form { - if node != nil && node?.num ?? 0 != bleManager.connectedPeripheral.num { + if node != nil && node?.metadata == nil && node?.num ?? 0 != bleManager.connectedPeripheral.num { + Text("There has been no response to a request for device metadata over the admin channel for this node.") + .font(.callout) + .foregroundColor(.orange) + + } else if node != nil && node?.num ?? 0 != bleManager.connectedPeripheral.num { // Let users know what is going on if they are using remote admin and don't have the lora config yet if node?.loRaConfig == nil { Text("LoRa config data has been requested but has not yet returned from the remote node. You can check the status of admin message requests in the admin message log.") diff --git a/Meshtastic/Views/Settings/Firmware.swift b/Meshtastic/Views/Settings/Firmware.swift index 55440604..8b1c1d76 100644 --- a/Meshtastic/Views/Settings/Firmware.swift +++ b/Meshtastic/Views/Settings/Firmware.swift @@ -26,6 +26,10 @@ struct Firmware: View { var body: some View { //NavigationSplitView { NavigationStack { + + let hwModel: HardwareModels = HardwareModels.allCases.first(where: { $0.rawValue == node?.user?.hwModel ?? "UNSET" } ) ?? HardwareModels.UNSET + Text(hwModel.firmwareStrings[0] + (node?.metadata?.firmwareVersion ?? "Unknown") ) + .font(.title3) VStack (alignment: .leading) { Text("nRF Device Firmware Update App") .font(.title3) @@ -171,21 +175,17 @@ struct Releases: Codable { var alpha : [Alpha]? = [] enum CodingKeys: String, CodingKey { - case stable = "stable" case alpha = "alpha" } init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - stable = try values.decodeIfPresent([Stable].self , forKey: .stable ) alpha = try values.decodeIfPresent([Alpha].self , forKey: .alpha ) } - init() { - - } + init() {} } struct Alpha: Codable { @@ -196,7 +196,6 @@ struct Alpha: Codable { var zipUrl : String? = nil enum CodingKeys: String, CodingKey { - case id = "id" case title = "title" case pageUrl = "page_url" @@ -205,16 +204,13 @@ struct Alpha: Codable { init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - id = try values.decodeIfPresent(String.self , forKey: .id ) title = try values.decodeIfPresent(String.self , forKey: .title ) pageUrl = try values.decodeIfPresent(String.self , forKey: .pageUrl ) zipUrl = try values.decodeIfPresent(String.self , forKey: .zipUrl ) } - init() { - - } + init() {} } struct Stable: Codable { @@ -225,7 +221,6 @@ struct Stable: Codable { var zipUrl : String? = nil enum CodingKeys: String, CodingKey { - case id = "id" case title = "title" case pageUrl = "page_url" @@ -234,16 +229,13 @@ struct Stable: Codable { init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - id = try values.decodeIfPresent(String.self , forKey: .id ) title = try values.decodeIfPresent(String.self , forKey: .title ) pageUrl = try values.decodeIfPresent(String.self , forKey: .pageUrl ) zipUrl = try values.decodeIfPresent(String.self , forKey: .zipUrl ) } - init() { - - } + init() {} } struct PullRequests: Codable { @@ -254,7 +246,6 @@ struct PullRequests: Codable { var zipUrl : String? = nil enum CodingKeys: String, CodingKey { - case id = "id" case title = "title" case pageUrl = "page_url" @@ -263,14 +254,11 @@ struct PullRequests: Codable { init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - id = try values.decodeIfPresent(String.self , forKey: .id ) title = try values.decodeIfPresent(String.self , forKey: .title ) pageUrl = try values.decodeIfPresent(String.self , forKey: .pageUrl ) zipUrl = try values.decodeIfPresent(String.self , forKey: .zipUrl ) } - init() { - - } + init() {} }