mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Firmware update updates
This commit is contained in:
parent
d9e72fe359
commit
4fd351d340
3 changed files with 76 additions and 19 deletions
|
|
@ -133,6 +133,56 @@ enum HardwareModels: String, CaseIterable, Identifiable {
|
|||
}
|
||||
|
||||
}
|
||||
func platform() -> HardwarePlatforms {
|
||||
|
||||
switch self {
|
||||
|
||||
case .UNSET:
|
||||
return HardwarePlatforms.NONE
|
||||
case .TLORA_V2:
|
||||
return HardwarePlatforms.ESP32
|
||||
case .TLORA_V1:
|
||||
return HardwarePlatforms.ESP32
|
||||
case .TLORA_V2_1_1P6:
|
||||
return HardwarePlatforms.ESP32
|
||||
case .TBEAM:
|
||||
return HardwarePlatforms.ESP32
|
||||
case .HELTEC_V2_0:
|
||||
return HardwarePlatforms.ESP32
|
||||
case .TBEAM_V0P7:
|
||||
return HardwarePlatforms.ESP32
|
||||
case .T_ECHO:
|
||||
return HardwarePlatforms.NRF52
|
||||
case .TLORA_V1_1P3:
|
||||
return HardwarePlatforms.ESP32
|
||||
case .RAK4631:
|
||||
return HardwarePlatforms.NRF52
|
||||
case .HELTEC_V2_1:
|
||||
return HardwarePlatforms.ESP32
|
||||
case .HELTEC_V1:
|
||||
return HardwarePlatforms.ESP32
|
||||
case .LILYGO_TBEAM_S3_CORE:
|
||||
return HardwarePlatforms.ESP32
|
||||
case .RAK11200:
|
||||
return HardwarePlatforms.ESP32
|
||||
case .NANO_G1:
|
||||
return HardwarePlatforms.ESP32
|
||||
case .TLORA_V2_1_1P8:
|
||||
return HardwarePlatforms.ESP32
|
||||
case .TLORA_T3_S3:
|
||||
return HardwarePlatforms.ESP32
|
||||
case .NANO_G1_EXPLORER:
|
||||
return HardwarePlatforms.ESP32
|
||||
case .STATION_G1:
|
||||
return HardwarePlatforms.ESP32
|
||||
case .M5STACK:
|
||||
return HardwarePlatforms.ESP32
|
||||
case .HELTEC_V3:
|
||||
return HardwarePlatforms.ESP32
|
||||
case .HELTEC_WSL_V3:
|
||||
return HardwarePlatforms.ESP32
|
||||
}
|
||||
}
|
||||
func protoEnumValue() -> HardwareModel {
|
||||
|
||||
switch self {
|
||||
|
|
@ -188,6 +238,7 @@ enum HardwareModels: String, CaseIterable, Identifiable {
|
|||
|
||||
enum HardwarePlatforms: String, CaseIterable, Identifiable {
|
||||
|
||||
case NONE
|
||||
case ESP32
|
||||
case NRF52
|
||||
case STM32
|
||||
|
|
@ -196,6 +247,8 @@ enum HardwarePlatforms: String, CaseIterable, Identifiable {
|
|||
var description: String {
|
||||
switch self {
|
||||
|
||||
case .NONE:
|
||||
return "None"
|
||||
case .ESP32:
|
||||
return "Expressif ESP 32"
|
||||
case .NRF52:
|
||||
|
|
|
|||
|
|
@ -420,7 +420,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
} else {
|
||||
let version = decodedInfo.myInfo.firmwareVersion[...(lastDotIndex ?? String.Index(utf16Offset: 6, in: decodedInfo.myInfo.firmwareVersion))]
|
||||
nowKnown = true
|
||||
connectedVersion = String(version)
|
||||
connectedVersion = String(version.dropLast())
|
||||
}
|
||||
|
||||
let supportedVersion = connectedVersion == "0.0.0" || self.minimumVersion.compare(connectedVersion, options: .numeric) == .orderedAscending || minimumVersion.compare(connectedVersion, options: .numeric) == .orderedSame
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ struct Firmware: View {
|
|||
let hwModel: HardwareModels = HardwareModels.allCases.first(where: { $0.rawValue == node?.user?.hwModel ?? "UNSET" }) ?? HardwareModels.UNSET
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
Text("Firmware Version: \(node?.metadata?.firmwareVersion ?? "Unknown")")
|
||||
.font(.title3)
|
||||
Text("Current Version: \(bleManager.connectedVersion)")
|
||||
.font(.largeTitle)
|
||||
Text("Your device supports the following firmware: ")
|
||||
.font(.callout)
|
||||
HStack {
|
||||
|
|
@ -44,19 +44,23 @@ struct Firmware: View {
|
|||
}
|
||||
.padding(.bottom)
|
||||
|
||||
if hwModel == HardwareModels.RAK4631 {
|
||||
if hwModel.platform() == HardwarePlatforms.NRF52 {
|
||||
VStack(alignment: .leading) {
|
||||
Text("nRF Device Firmware Update App")
|
||||
.font(.title3)
|
||||
Text("You can update your Meshtastic device over bluetooth using the Nordic DFU app. This currently works for RAK NRF devices.")
|
||||
.font(.caption)
|
||||
Link("Get NRF DFU from the App Store", destination: URL(string: "https://apps.apple.com/us/app/nrf-device-firmware-update/id1624454660")!)
|
||||
.font(.callout)
|
||||
if hwModel == HardwareModels.RAK4631 {
|
||||
Text("nRF OTA Device Firmware Update App")
|
||||
.font(.title3)
|
||||
Text("You can update your Meshtastic device over bluetooth using the Nordic DFU app. This currently works for RAK NRF devices.")
|
||||
.font(.caption)
|
||||
Link("Get NRF DFU from the App Store", destination: URL(string: "https://apps.apple.com/us/app/nrf-device-firmware-update/id1624454660")!)
|
||||
.font(.callout)
|
||||
} else {
|
||||
Text("OTA Updates are not supported on the this NRF Device.")
|
||||
.font(.title3)
|
||||
Link("Drag & Drop Firmware Update", destination: URL(string: "https://meshtastic.org/docs/getting-started/flashing-firmware/nrf52/drag-n-drop")!)
|
||||
.font(.callout)
|
||||
}
|
||||
}
|
||||
} else if hwModel == HardwareModels.T_ECHO {
|
||||
Text("OTA Updates are not supported on the this NRF Device.")
|
||||
.font(.title3)
|
||||
} else {
|
||||
} else if hwModel.platform() == HardwarePlatforms.ESP32 {
|
||||
VStack(alignment: .leading) {
|
||||
Text("ESP32 Device Firmware Update")
|
||||
.font(.title3)
|
||||
|
|
@ -88,13 +92,12 @@ struct Firmware: View {
|
|||
Spacer()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Text("OTA Updates are not supported on your platform.")
|
||||
.font(.title3)
|
||||
}
|
||||
|
||||
}.padding()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
Text("Firmware Releases")
|
||||
.font(.title3)
|
||||
|
|
@ -141,6 +144,7 @@ struct Firmware: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
.padding(.bottom, 5)
|
||||
.onAppear(perform: loadData)
|
||||
.navigationTitle("Firmware Updates")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue