mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Add snr to messages, finish tables for metrics
This commit is contained in:
parent
f88375c7a1
commit
54f13e7827
3 changed files with 60 additions and 22 deletions
|
|
@ -104,6 +104,11 @@ struct ChannelMessageList: View {
|
|||
let messageDate = Date(timeIntervalSince1970: TimeInterval(message.messageTimestamp))
|
||||
Text("Date \(messageDate, style: .date) \(messageDate.formattedDate(format: "h:mm:ss a"))").font(.caption2).foregroundColor(.gray)
|
||||
}
|
||||
if !currentUser {
|
||||
VStack {
|
||||
Text("SNR \(message.snr)")
|
||||
}
|
||||
}
|
||||
if currentUser && message.receivedACK {
|
||||
VStack {
|
||||
Text("Received Ack \(message.receivedACK ? "✔️" : "")")
|
||||
|
|
|
|||
|
|
@ -64,27 +64,32 @@ struct DeviceMetricsLog: View {
|
|||
}
|
||||
}
|
||||
TableColumn("Voltage") { dm in
|
||||
Text(String(format: "%.6f", dm.voltage ?? 0))
|
||||
if dm.metricsType == 0 {
|
||||
Text("\(String(format: "%.2f", dm.voltage))")
|
||||
}
|
||||
}
|
||||
TableColumn("Channel Utilization") { dm in
|
||||
Text(String(format: "%.2f", dm.channelUtilization))
|
||||
if dm.metricsType == 0 {
|
||||
Text(String(format: "%.2f", dm.channelUtilization))
|
||||
}
|
||||
}
|
||||
TableColumn("Airtime") { dm in
|
||||
Text("\(String(format: "%.2f", dm.airUtilTx))%")
|
||||
if dm.metricsType == 0 {
|
||||
Text("\(String(format: "%.2f", dm.airUtilTx))%")
|
||||
}
|
||||
}
|
||||
TableColumn("Time Stamp") { dm in
|
||||
Text(dm.time?.formattedDate(format: "MM/dd/yy hh:mm") ?? "Unknown time")
|
||||
if dm.metricsType == 0 {
|
||||
Text(dm.time?.formattedDate(format: "MM/dd/yy hh:mm") ?? "Unknown time")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
ScrollView {
|
||||
|
||||
Grid(alignment: .topLeading, horizontalSpacing: 2) {
|
||||
|
||||
GridRow {
|
||||
|
||||
Text("Batt")
|
||||
.font(.callout)
|
||||
.fontWeight(.bold)
|
||||
|
|
@ -103,22 +108,15 @@ struct DeviceMetricsLog: View {
|
|||
}
|
||||
Divider()
|
||||
ForEach(node.telemetries!.reversed() as! [TelemetryEntity], id: \.self) { (dm: TelemetryEntity) in
|
||||
|
||||
if dm.metricsType == 0 {
|
||||
|
||||
GridRow {
|
||||
|
||||
if dm.batteryLevel == 0 {
|
||||
|
||||
Text("USB")
|
||||
.font(.callout)
|
||||
|
||||
} else {
|
||||
|
||||
Text("\(String(dm.batteryLevel))%")
|
||||
.font(.callout)
|
||||
}
|
||||
|
||||
Text(String(dm.voltage))
|
||||
.font(.callout)
|
||||
Text("\(String(format: "%.2f", dm.channelUtilization))%")
|
||||
|
|
@ -163,18 +161,15 @@ struct DeviceMetricsLog: View {
|
|||
|
||||
} else {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
|
||||
exportString = TelemetryToCsvFile(telemetry: node.telemetries!.array as! [TelemetryEntity], metricsType: 0)
|
||||
isExporting = true
|
||||
|
||||
} label: {
|
||||
|
||||
Label("Save", systemImage: "square.and.arrow.down")
|
||||
}
|
||||
.buttonStyle(.bordered)
|
||||
|
|
@ -205,7 +200,6 @@ struct DeviceMetricsLog: View {
|
|||
if case .success = result {
|
||||
|
||||
print("Device Telemetry log download succeeded.")
|
||||
|
||||
self.isExporting = false
|
||||
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,48 @@ struct EnvironmentMetricsLog: View {
|
|||
|
||||
NavigationStack {
|
||||
|
||||
ScrollView {
|
||||
let tempReadingType = (!(node.telemetryConfig?.environmentDisplayFahrenheit ?? false)) ? "°C" : "°F"
|
||||
if UIDevice.current.userInterfaceIdiom == .pad || UIDevice.current.userInterfaceIdiom == .mac {
|
||||
//Add a table for mac and ipad
|
||||
Table(node.telemetries!.reversed() as! [TelemetryEntity]) {
|
||||
TableColumn("Temperature") { em in
|
||||
if em.metricsType == 1 {
|
||||
Text("\(String(format: "%.2f", em.temperature))\(tempReadingType)")
|
||||
}
|
||||
}
|
||||
TableColumn("Humidity") { em in
|
||||
if em.metricsType == 1 {
|
||||
Text("\(String(format: "%.2f", em.relativeHumidity))")
|
||||
}
|
||||
}
|
||||
TableColumn("Barometric Pressure") { em in
|
||||
if em.metricsType == 1 {
|
||||
Text("\(String(format: "%.2f", em.barometricPressure))")
|
||||
}
|
||||
}
|
||||
TableColumn("Gas Resistance") { em in
|
||||
if em.metricsType == 1 {
|
||||
Text("\(String(format: "%.2f", em.gasResistance))")
|
||||
}
|
||||
}
|
||||
TableColumn("Current") { em in
|
||||
if em.metricsType == 1 {
|
||||
Text("\(String(format: "%.2f", em.current))")
|
||||
}
|
||||
}
|
||||
TableColumn("Voltage") { em in
|
||||
if em.metricsType == 1 {
|
||||
Text("\(String(format: "%.2f", em.voltage))")
|
||||
}
|
||||
}
|
||||
TableColumn("Time Stamp") { em in
|
||||
if em.metricsType == 1 {
|
||||
Text(em.time?.formattedDate(format: "MM/dd/yy hh:mm") ?? "Unknown time")
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ScrollView {
|
||||
|
||||
Grid(alignment: .topLeading, horizontalSpacing: 2) {
|
||||
|
||||
|
|
@ -55,8 +96,6 @@ struct EnvironmentMetricsLog: View {
|
|||
|
||||
if em.metricsType == 1 {
|
||||
|
||||
let tempReadingType = (!(node.telemetryConfig?.environmentDisplayFahrenheit ?? false)) ? "°C" : "°F"
|
||||
|
||||
GridRow {
|
||||
|
||||
Text("\(String(format: "%.2f", em.temperature))\(tempReadingType)")
|
||||
|
|
@ -80,8 +119,8 @@ struct EnvironmentMetricsLog: View {
|
|||
.padding(.leading, 15)
|
||||
.padding(.trailing, 5)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HStack {
|
||||
|
||||
Button(role: .destructive) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue