From e8b6f00dc2abf8486aab9efaee66c413f74d5e3d Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Mon, 5 Aug 2024 19:35:41 -0700 Subject: [PATCH] Device hardware updates --- Meshtastic/Resources/DeviceHardware.json | 64 +++++++++++++------ .../Views/Nodes/Helpers/NodeInfoItem.swift | 31 ++++++++- Meshtastic/Views/Nodes/NodeList.swift | 1 + 3 files changed, 73 insertions(+), 23 deletions(-) diff --git a/Meshtastic/Resources/DeviceHardware.json b/Meshtastic/Resources/DeviceHardware.json index ad538bd0..16c50d25 100644 --- a/Meshtastic/Resources/DeviceHardware.json +++ b/Meshtastic/Resources/DeviceHardware.json @@ -5,7 +5,7 @@ "platformioTarget": "tlora-v2", "architecture": "esp32", "activelySupported": false, - "displayName": "T-LoRa V2" + "displayName": "LILYGO T-LoRa V2" }, { "hwModel": 2, @@ -13,7 +13,7 @@ "platformioTarget": "tlora-v1", "architecture": "esp32", "activelySupported": false, - "displayName": "T-LoRa V1" + "displayName": "LILYGO T-LoRa V1" }, { "hwModel": 3, @@ -21,7 +21,7 @@ "platformioTarget": "tlora-v2-1-1_6", "architecture": "esp32", "activelySupported": true, - "displayName": "T-LoRa V2.1-1.6" + "displayName": "LILYGO T-LoRa V2.1-1.6" }, { "hwModel": 4, @@ -29,7 +29,7 @@ "platformioTarget": "tbeam", "architecture": "esp32", "activelySupported": true, - "displayName": "T-Beam" + "displayName": "LILYGO T-Beam" }, { "hwModel": 5, @@ -45,7 +45,7 @@ "platformioTarget": "tbeam0_7", "architecture": "esp32", "activelySupported": false, - "displayName": "T-Beam V0.7" + "displayName": "LILYGO T-Beam V0.7" }, { "hwModel": 7, @@ -53,7 +53,7 @@ "platformioTarget": "t-echo", "architecture": "nrf52840", "activelySupported": true, - "displayName": "T-Echo" + "displayName": "LILYGO T-Echo" }, { "hwModel": 8, @@ -61,7 +61,7 @@ "platformioTarget": "tlora-v1_3", "architecture": "esp32", "activelySupported": false, - "displayName": "T-LoRa V1.1-1.3" + "displayName": "LILYGO T-LoRa V1.1-1.3" }, { "hwModel": 9, @@ -69,7 +69,7 @@ "platformioTarget": "rak4631", "architecture": "nrf52840", "activelySupported": true, - "displayName": "RAK4631" + "displayName": "RAK WisBlock 4631" }, { "hwModel": 10, @@ -93,7 +93,7 @@ "platformioTarget": "tbeam-s3-core", "architecture": "esp32-s3", "activelySupported": true, - "displayName": "T-Beam S3 Core" + "displayName": "LILYGO T-Beam S3 Core" }, { "hwModel": 13, @@ -101,7 +101,7 @@ "platformioTarget": "rak11200", "architecture": "esp32", "activelySupported": false, - "displayName": "RAK11200" + "displayName": "RAK WisBlock 11200" }, { "hwModel": 14, @@ -117,7 +117,7 @@ "platformioTarget": "tlora-v2-1-1_8", "architecture": "esp32", "activelySupported": true, - "displayName": "T-LoRa V2.1-1.8" + "displayName": "LILYGO T-LoRa V2.1-1.8" }, { "hwModel": 16, @@ -125,7 +125,7 @@ "platformioTarget": "tlora-t3s3-v1", "architecture": "esp32-s3", "activelySupported": true, - "displayName": "T-LoRa T3-S3" + "displayName": "LILYGO T-LoRa T3-S3" }, { "hwModel": 17, @@ -143,6 +143,14 @@ "activelySupported": true, "displayName": "Nano G2 Ultra" }, + { + "hwModel": 21, + "hwModelSlug": "WIO_WM1110", + "platformioTarget": "wio-tracker-wm1110", + "architecture": "nrf52840", + "activelySupported": true, + "displayName": "Seeed Wio WM1110 Tracker" + }, { "hwModel": 25, "hwModelSlug": "STATION_G1", @@ -157,7 +165,7 @@ "platformioTarget": "rak11310", "architecture": "rp2040", "activelySupported": true, - "displayName": "RAK11310" + "displayName": "RAK WisBlock 11310" }, { "hwModel": 29, @@ -165,7 +173,7 @@ "platformioTarget": "canaryone", "architecture": "nrf52840", "activelySupported": true, - "displayName": "CanaryOne" + "displayName": "Canary One" }, { "hwModel": 30, @@ -277,7 +285,7 @@ "platformioTarget": "t-deck", "architecture": "esp32-s3", "activelySupported": true, - "displayName": "T-Deck" + "displayName": "LILYGO T-Deck" }, { "hwModel": 51, @@ -285,7 +293,7 @@ "platformioTarget": "t-watch-s3", "architecture": "esp32-s3", "activelySupported": true, - "displayName": "T-Watch S3" + "displayName": "LILYGO T-Watch S3" }, { "hwModel": 52, @@ -360,11 +368,27 @@ "displayName": "RadioMaster 900 Bandit Nano" }, { - "hwModel": 21, - "hwModelSlug": "WIO_WM1110", - "platformioTarget": "wio-tracker-wm1110", + "hwModel": 67, + "hwModelSlug": "HELTEC_VISION_MASTER_E213", + "platformioTarget": "heltec-vision-master-e213", + "architecture": "esp32-s3", + "activelySupported": true, + "displayName": "Heltec Vision Master E213" + }, + { + "hwModel": 68, + "hwModelSlug": "HELTEC_VISION_MASTER_E290", + "platformioTarget": "heltec-vision-master-e290", + "architecture": "esp32-s3", + "activelySupported": true, + "displayName": "Heltec Vision Master E290" + }, + { + "hwModel": 71, + "hwModelSlug": "TRACKER_T1000_E", + "platformioTarget": "tracker-t1000-e", "architecture": "nrf52840", "activelySupported": true, - "displayName": "Seeed Wio WM1110 Tracker" + "displayName": "Seeed Card Tracker T1000-E" } ] diff --git a/Meshtastic/Views/Nodes/Helpers/NodeInfoItem.swift b/Meshtastic/Views/Nodes/Helpers/NodeInfoItem.swift index 5fd83c77..34dcdece 100644 --- a/Meshtastic/Views/Nodes/Helpers/NodeInfoItem.swift +++ b/Meshtastic/Views/Nodes/Helpers/NodeInfoItem.swift @@ -11,8 +11,9 @@ import MapKit struct NodeInfoItem: View { - @ObservedObject - var node: NodeInfoEntity + @ObservedObject var node: NodeInfoEntity + @State private var currentDevice: DeviceHardware? + @State private var deviceHardware: [DeviceHardware] = [] var modemPreset: ModemPresets = ModemPresets( rawValue: UserDefaults.modemPreset @@ -29,7 +30,7 @@ struct NodeInfoItem: View { .aspectRatio(contentMode: .fit) .frame(width: 65, height: 65) .cornerRadius(5) - Text(String(node.user!.hwModel ?? "unset".localized)) + Text(String(currentDevice?.displayName ?? (node.user?.hwModel ?? "unset".localized))) .font(.callout) } else { Image(systemName: "person.crop.circle.badge.questionmark") @@ -41,6 +42,30 @@ struct NodeInfoItem: View { .font(.callout) } } + .onAppear(perform: { + if currentDevice == nil { + Api().loadDeviceHardwareData { (hw) in + for device in hw { + let currentHardware = node.user?.hwModel ?? "UNSET" + let deviceString = device.hwModelSlug.replacingOccurrences(of: "_", with: "") + if deviceString == currentHardware { + currentDevice = device + } + } + } + } + }) + .onChange(of: node) { newNode in + Api().loadDeviceHardwareData { (hw) in + for device in hw { + let currentHardware = newNode.user?.hwModel ?? "UNSET" + let deviceString = device.hwModelSlug.replacingOccurrences(of: "_", with: "") + if deviceString == currentHardware { + currentDevice = device + } + } + } + } } HStack(alignment: .center) { Spacer() diff --git a/Meshtastic/Views/Nodes/NodeList.swift b/Meshtastic/Views/Nodes/NodeList.swift index 10df4299..7e9cf865 100644 --- a/Meshtastic/Views/Nodes/NodeList.swift +++ b/Meshtastic/Views/Nodes/NodeList.swift @@ -37,6 +37,7 @@ struct NodeList: View { @State private var isPresentingDeleteNodeAlert = false @State private var deleteNodeId: Int64 = 0 + var boolFilters: [Bool] {[ isOnline, isFavorite,