diff --git a/Meshtastic.xcodeproj/project.pbxproj b/Meshtastic.xcodeproj/project.pbxproj index a816ab6f..9e943b50 100644 --- a/Meshtastic.xcodeproj/project.pbxproj +++ b/Meshtastic.xcodeproj/project.pbxproj @@ -462,6 +462,7 @@ DDDB445129F8ACF900EE2349 /* Date.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Date.swift; sourceTree = ""; }; DDDB445329F8AD1600EE2349 /* Data.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Data.swift; sourceTree = ""; }; DDDBC87A2BC62E4E001E8DF7 /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = ""; }; + DDDBC87C2BC65682001E8DF7 /* MeshtasticDataModelV 34.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "MeshtasticDataModelV 34.xcdatamodel"; sourceTree = ""; }; DDDC22312BA76701002C44F1 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = ""; }; DDDC22322BA76961002C44F1 /* zh-Hant-TW */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant-TW"; path = "zh-Hant-TW.lproj/Localizable.strings"; sourceTree = ""; }; DDDC22372BA92344002C44F1 /* MeshMapContent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeshMapContent.swift; sourceTree = ""; }; @@ -1927,6 +1928,7 @@ DD3CC6BA28E366DF00FA9159 /* Meshtastic.xcdatamodeld */ = { isa = XCVersionGroup; children = ( + DDDBC87C2BC65682001E8DF7 /* MeshtasticDataModelV 34.xcdatamodel */, DDF45C382BC46B16005ED5F2 /* MeshtasticDataModelV33.xcdatamodel */, DD9681A22BBB22BE00FD2C47 /* MeshtasticDataModelV32.xcdatamodel */, DDDCD5712BB3246500BE6B60 /* MeshtasticDataModelV 31.xcdatamodel */, @@ -1961,7 +1963,7 @@ DD5D0A9A2931AD6B00F7EA61 /* MeshtasticDataModelV2.xcdatamodel */, DD3CC6BB28E366DF00FA9159 /* MeshtasticDataModel.xcdatamodel */, ); - currentVersion = DDF45C382BC46B16005ED5F2 /* MeshtasticDataModelV33.xcdatamodel */; + currentVersion = DDDBC87C2BC65682001E8DF7 /* MeshtasticDataModelV 34.xcdatamodel */; name = Meshtastic.xcdatamodeld; path = Meshtastic/Meshtastic.xcdatamodeld; sourceTree = ""; diff --git a/Meshtastic/Export/WriteCsvFile.swift b/Meshtastic/Export/WriteCsvFile.swift index 3261cbc3..628ce3d1 100644 --- a/Meshtastic/Export/WriteCsvFile.swift +++ b/Meshtastic/Export/WriteCsvFile.swift @@ -30,7 +30,7 @@ func telemetryToCsvFile(telemetry: [TelemetryEntity], metricsType: Int) -> Strin } } else if metricsType == 1 { // Create Environment Telemetry Header - csvString = "Temperature, Relative Humidity, Barometric Pressure, Gas Resistance, \("voltage".localized), \("current".localized), \("timestamp".localized)" + csvString = "Temperature, Relative Humidity, Barometric Pressure, Indoor Air Quality, Gas Resistance, \("voltage".localized), \("current".localized), \("timestamp".localized)" for dm in telemetry { if dm.metricsType == 1 { csvString += "\n" @@ -40,6 +40,8 @@ func telemetryToCsvFile(telemetry: [TelemetryEntity], metricsType: Int) -> Strin csvString += ", " csvString += String(dm.barometricPressure) csvString += ", " + csvString += String(dm.iaq) + csvString += ", " csvString += String(dm.gasResistance) csvString += ", " csvString += String(dm.voltage) diff --git a/Meshtastic/Helpers/MeshPackets.swift b/Meshtastic/Helpers/MeshPackets.swift index b422848e..b4a8243a 100644 --- a/Meshtastic/Helpers/MeshPackets.swift +++ b/Meshtastic/Helpers/MeshPackets.swift @@ -698,6 +698,7 @@ func telemetryPacket(packet: MeshPacket, connectedNode: Int64, context: NSManage // Environment Metrics telemetry.barometricPressure = telemetryMessage.environmentMetrics.barometricPressure telemetry.current = telemetryMessage.environmentMetrics.current + telemetry.iaq = Int32(truncatingIfNeeded: telemetryMessage.environmentMetrics.iaq) telemetry.gasResistance = telemetryMessage.environmentMetrics.gasResistance telemetry.relativeHumidity = telemetryMessage.environmentMetrics.relativeHumidity telemetry.temperature = telemetryMessage.environmentMetrics.temperature diff --git a/Meshtastic/Meshtastic.xcdatamodeld/.xccurrentversion b/Meshtastic/Meshtastic.xcdatamodeld/.xccurrentversion index 7da03638..554e9b2e 100644 --- a/Meshtastic/Meshtastic.xcdatamodeld/.xccurrentversion +++ b/Meshtastic/Meshtastic.xcdatamodeld/.xccurrentversion @@ -3,6 +3,6 @@ _XCCurrentVersionName - MeshtasticDataModelV33.xcdatamodel + MeshtasticDataModelV 34.xcdatamodel diff --git a/Meshtastic/Meshtastic.xcdatamodeld/MeshtasticDataModelV 34.xcdatamodel/contents b/Meshtastic/Meshtastic.xcdatamodeld/MeshtasticDataModelV 34.xcdatamodel/contents new file mode 100644 index 00000000..296e4582 --- /dev/null +++ b/Meshtastic/Meshtastic.xcdatamodeld/MeshtasticDataModelV 34.xcdatamodel/contents @@ -0,0 +1,455 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Meshtastic/Protobufs/meshtastic/telemetry.pb.swift b/Meshtastic/Protobufs/meshtastic/telemetry.pb.swift index aa2ebae4..d7837ab9 100644 --- a/Meshtastic/Protobufs/meshtastic/telemetry.pb.swift +++ b/Meshtastic/Protobufs/meshtastic/telemetry.pb.swift @@ -225,6 +225,11 @@ struct EnvironmentMetrics { /// Current measured (To be depreciated in favor of PowerMetrics in Meshtastic 3.x) var current: Float = 0 + /// + /// relative scale IAQ value as measured by Bosch BME680 . value 0-500. + /// Belongs to Air Quality but is not particle but VOC measurement. Other VOC values can also be put in here. + var iaq: UInt32 = 0 + var unknownFields = SwiftProtobuf.UnknownStorage() init() {} @@ -520,6 +525,7 @@ extension EnvironmentMetrics: SwiftProtobuf.Message, SwiftProtobuf._MessageImple 4: .standard(proto: "gas_resistance"), 5: .same(proto: "voltage"), 6: .same(proto: "current"), + 7: .same(proto: "iaq"), ] mutating func decodeMessage(decoder: inout D) throws { @@ -534,6 +540,7 @@ extension EnvironmentMetrics: SwiftProtobuf.Message, SwiftProtobuf._MessageImple case 4: try { try decoder.decodeSingularFloatField(value: &self.gasResistance) }() case 5: try { try decoder.decodeSingularFloatField(value: &self.voltage) }() case 6: try { try decoder.decodeSingularFloatField(value: &self.current) }() + case 7: try { try decoder.decodeSingularUInt32Field(value: &self.iaq) }() default: break } } @@ -558,6 +565,9 @@ extension EnvironmentMetrics: SwiftProtobuf.Message, SwiftProtobuf._MessageImple if self.current != 0 { try visitor.visitSingularFloatField(value: self.current, fieldNumber: 6) } + if self.iaq != 0 { + try visitor.visitSingularUInt32Field(value: self.iaq, fieldNumber: 7) + } try unknownFields.traverse(visitor: &visitor) } @@ -568,6 +578,7 @@ extension EnvironmentMetrics: SwiftProtobuf.Message, SwiftProtobuf._MessageImple if lhs.gasResistance != rhs.gasResistance {return false} if lhs.voltage != rhs.voltage {return false} if lhs.current != rhs.current {return false} + if lhs.iaq != rhs.iaq {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } diff --git a/Meshtastic/Views/Nodes/EnvironmentMetricsLog.swift b/Meshtastic/Views/Nodes/EnvironmentMetricsLog.swift index b20f873d..9108b656 100644 --- a/Meshtastic/Views/Nodes/EnvironmentMetricsLog.swift +++ b/Meshtastic/Views/Nodes/EnvironmentMetricsLog.swift @@ -86,7 +86,7 @@ struct EnvironmentMetricsLog: View { TableColumn("Barometric Pressure") { em in Text("\(String(format: "%.1f", em.barometricPressure)) hPa") } - TableColumn("gas.resistance") { em in + TableColumn("Indoor Air Quality") { em in Text("\(String(format: "%.1f", em.gasResistance)) ohms") } TableColumn("current") { em in @@ -121,7 +121,7 @@ struct EnvironmentMetricsLog: View { Text("Bar") .font(.caption) .fontWeight(.bold) - Text("gas") + Text("IAQ") .font(.caption) .fontWeight(.bold) Text("timestamp") diff --git a/protobufs b/protobufs index 68720ed8..22cbd0d4 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 68720ed8dbcb2c055e3d1ecd4f78d60692f59493 +Subproject commit 22cbd0d4cfafa4b8c1e64517e06edc2d7a22cca9