From a8e4c2a6531de464f1782bdbd70db21aa8f41aff Mon Sep 17 00:00:00 2001 From: Blake McAnally Date: Fri, 28 Jun 2024 21:29:51 -0500 Subject: [PATCH] bump protos --- .../Sources/meshtastic/config.pb.swift | 11 +++++++ .../Sources/meshtastic/powermon.pb.swift | 30 +++++++++---------- scripts/gen_protos.sh | 8 ++--- 3 files changed, 30 insertions(+), 19 deletions(-) diff --git a/MeshtasticProtobufs/Sources/meshtastic/config.pb.swift b/MeshtasticProtobufs/Sources/meshtastic/config.pb.swift index 7735f554c..20b719c53 100644 --- a/MeshtasticProtobufs/Sources/meshtastic/config.pb.swift +++ b/MeshtasticProtobufs/Sources/meshtastic/config.pb.swift @@ -630,6 +630,11 @@ public struct Config { /// I2C address of INA_2XX to use for reading device battery voltage public var deviceBatteryInaAddress: UInt32 = 0 + /// + /// If non-zero, we want powermon log outputs. With the particular (bitfield) sources enabled. + /// Note: we picked an ID of 32 so that lower more efficient IDs can be used for more frequently used options. + public var powermonEnables: UInt64 = 0 + public var unknownFields = SwiftProtobuf.UnknownStorage() public init() {} @@ -2079,6 +2084,7 @@ extension Config.PowerConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImple 7: .standard(proto: "ls_secs"), 8: .standard(proto: "min_wake_secs"), 9: .standard(proto: "device_battery_ina_address"), + 32: .standard(proto: "powermon_enables"), ] public mutating func decodeMessage(decoder: inout D) throws { @@ -2095,6 +2101,7 @@ extension Config.PowerConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImple case 7: try { try decoder.decodeSingularUInt32Field(value: &self.lsSecs) }() case 8: try { try decoder.decodeSingularUInt32Field(value: &self.minWakeSecs) }() case 9: try { try decoder.decodeSingularUInt32Field(value: &self.deviceBatteryInaAddress) }() + case 32: try { try decoder.decodeSingularUInt64Field(value: &self.powermonEnables) }() default: break } } @@ -2125,6 +2132,9 @@ extension Config.PowerConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImple if self.deviceBatteryInaAddress != 0 { try visitor.visitSingularUInt32Field(value: self.deviceBatteryInaAddress, fieldNumber: 9) } + if self.powermonEnables != 0 { + try visitor.visitSingularUInt64Field(value: self.powermonEnables, fieldNumber: 32) + } try unknownFields.traverse(visitor: &visitor) } @@ -2137,6 +2147,7 @@ extension Config.PowerConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImple if lhs.lsSecs != rhs.lsSecs {return false} if lhs.minWakeSecs != rhs.minWakeSecs {return false} if lhs.deviceBatteryInaAddress != rhs.deviceBatteryInaAddress {return false} + if lhs.powermonEnables != rhs.powermonEnables {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } diff --git a/MeshtasticProtobufs/Sources/meshtastic/powermon.pb.swift b/MeshtasticProtobufs/Sources/meshtastic/powermon.pb.swift index c6762ef12..1da844845 100644 --- a/MeshtasticProtobufs/Sources/meshtastic/powermon.pb.swift +++ b/MeshtasticProtobufs/Sources/meshtastic/powermon.pb.swift @@ -22,17 +22,17 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// Note: There are no 'PowerMon' messages normally in use (PowerMons are sent only as structured logs - slogs). ///But we wrap our State enum in this message to effectively nest a namespace (without our linter yelling at us) -struct PowerMon { +public struct PowerMon { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() /// Any significant power changing event in meshtastic should be tagged with a powermon state transition. ///If you are making new meshtastic features feel free to add new entries at the end of this definition. - enum State: SwiftProtobuf.Enum { - typealias RawValue = Int + public enum State: SwiftProtobuf.Enum { + public typealias RawValue = Int case none // = 0 case cpuDeepSleep // = 1 case cpuLightSleep // = 2 @@ -62,11 +62,11 @@ struct PowerMon { case gpsActive // = 2048 case UNRECOGNIZED(Int) - init() { + public init() { self = .none } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .none case 1: self = .cpuDeepSleep @@ -85,7 +85,7 @@ struct PowerMon { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .none: return 0 case .cpuDeepSleep: return 1 @@ -106,14 +106,14 @@ struct PowerMon { } - init() {} + public init() {} } #if swift(>=4.2) extension PowerMon.State: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [PowerMon.State] = [ + public static let allCases: [PowerMon.State] = [ .none, .cpuDeepSleep, .cpuLightSleep, @@ -142,26 +142,26 @@ extension PowerMon.State: @unchecked Sendable {} fileprivate let _protobuf_package = "meshtastic" extension PowerMon: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".PowerMon" - static let _protobuf_nameMap = SwiftProtobuf._NameMap() + public static let protoMessageName: String = _protobuf_package + ".PowerMon" + public static let _protobuf_nameMap = SwiftProtobuf._NameMap() - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let _ = try decoder.nextFieldNumber() { } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: PowerMon, rhs: PowerMon) -> Bool { + public static func ==(lhs: PowerMon, rhs: PowerMon) -> Bool { if lhs.unknownFields != rhs.unknownFields {return false} return true } } extension PowerMon.State: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "None"), 1: .same(proto: "CPU_DeepSleep"), 2: .same(proto: "CPU_LightSleep"), diff --git a/scripts/gen_protos.sh b/scripts/gen_protos.sh index 4c7cb2901..0967e9df1 100755 --- a/scripts/gen_protos.sh +++ b/scripts/gen_protos.sh @@ -2,14 +2,14 @@ # simple sanity checking for repo if [ ! -d "./protobufs" ]; then - echo 'Please check out the protobuf submodule by running: `git submodule update --init`' - exit + git submodule update --init +else + git submodule update fi # simple sanity checking for executable if [ ! -x "$(which protoc)" ]; then - echo 'Please install swift-protobuf by running: `brew install swift-protobuf`' - exit + brew install swift-protobuf fi protoc --proto_path=./protobufs --swift_opt=Visibility=Public --swift_out=./MeshtasticProtobufs/Sources ./protobufs/meshtastic/*.proto