diff --git a/Meshtastic/Views/Messages/ChannelMessageList.swift b/Meshtastic/Views/Messages/ChannelMessageList.swift index ec47a979..d75fea7b 100644 --- a/Meshtastic/Views/Messages/ChannelMessageList.swift +++ b/Meshtastic/Views/Messages/ChannelMessageList.swift @@ -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 ? "✔️" : "")") diff --git a/Meshtastic/Views/Nodes/DeviceMetricsLog.swift b/Meshtastic/Views/Nodes/DeviceMetricsLog.swift index 9d21d95d..abb3c8b6 100644 --- a/Meshtastic/Views/Nodes/DeviceMetricsLog.swift +++ b/Meshtastic/Views/Nodes/DeviceMetricsLog.swift @@ -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 { diff --git a/Meshtastic/Views/Nodes/EnvironmentMetricsLog.swift b/Meshtastic/Views/Nodes/EnvironmentMetricsLog.swift index 3283a01d..a7efebf0 100644 --- a/Meshtastic/Views/Nodes/EnvironmentMetricsLog.swift +++ b/Meshtastic/Views/Nodes/EnvironmentMetricsLog.swift @@ -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) {