Updated Protos

Change battery line type on device metrics chart
Clean up buttons
Update circle text to handle large 4 character short names.
This commit is contained in:
Garth Vander Houwen 2023-08-11 07:10:22 -07:00
parent b589406aed
commit c7d74f85ae
12 changed files with 361 additions and 485 deletions

View file

@ -734,6 +734,14 @@ struct AdminMessage {
///
/// TODO: REPLACE
case remotehardwareConfig // = 8
///
/// TODO: REPLACE
case neighborinfoConfig // = 9
///
/// TODO: REPLACE
case ambientlightingConfig // = 10
case UNRECOGNIZED(Int)
init() {
@ -751,6 +759,8 @@ struct AdminMessage {
case 6: self = .cannedmsgConfig
case 7: self = .audioConfig
case 8: self = .remotehardwareConfig
case 9: self = .neighborinfoConfig
case 10: self = .ambientlightingConfig
default: self = .UNRECOGNIZED(rawValue)
}
}
@ -766,6 +776,8 @@ struct AdminMessage {
case .cannedmsgConfig: return 6
case .audioConfig: return 7
case .remotehardwareConfig: return 8
case .neighborinfoConfig: return 9
case .ambientlightingConfig: return 10
case .UNRECOGNIZED(let i): return i
}
}
@ -802,6 +814,8 @@ extension AdminMessage.ModuleConfigType: CaseIterable {
.cannedmsgConfig,
.audioConfig,
.remotehardwareConfig,
.neighborinfoConfig,
.ambientlightingConfig,
]
}
@ -1412,6 +1426,8 @@ extension AdminMessage.ModuleConfigType: SwiftProtobuf._ProtoNameProviding {
6: .same(proto: "CANNEDMSG_CONFIG"),
7: .same(proto: "AUDIO_CONFIG"),
8: .same(proto: "REMOTEHARDWARE_CONFIG"),
9: .same(proto: "NEIGHBORINFO_CONFIG"),
10: .same(proto: "AMBIENTLIGHTING_CONFIG"),
]
}

View file

@ -507,6 +507,7 @@ struct Config {
var waitBluetoothSecs: UInt32 = 0
///
/// Deprecated in 2.1.X
/// Mesh Super Deep Sleep Timeout Seconds
/// While in Light Sleep if this value is exceeded we will lower into super deep sleep
/// for sds_secs (default 1 year) or a button press

View file

@ -108,14 +108,6 @@ struct DeviceState {
/// Clears the value of `owner`. Subsequent reads from it will return its default value.
mutating func clearOwner() {_uniqueStorage()._owner = nil}
///
/// Deprecated in 2.1.x
/// Old node_db. See NodeInfoLite node_db_lite
var nodeDb: [NodeInfo] {
get {return _storage._nodeDb}
set {_uniqueStorage()._nodeDb = newValue}
}
///
/// Received packets saved for delivery to the phone
var receiveQueue: [MeshPacket] {
@ -446,7 +438,6 @@ extension DeviceState: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
2: .standard(proto: "my_node"),
3: .same(proto: "owner"),
4: .standard(proto: "node_db"),
5: .standard(proto: "receive_queue"),
8: .same(proto: "version"),
7: .standard(proto: "rx_text_message"),
@ -460,7 +451,6 @@ extension DeviceState: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati
fileprivate class _StorageClass {
var _myNode: MyNodeInfo? = nil
var _owner: User? = nil
var _nodeDb: [NodeInfo] = []
var _receiveQueue: [MeshPacket] = []
var _version: UInt32 = 0
var _rxTextMessage: MeshPacket? = nil
@ -477,7 +467,6 @@ extension DeviceState: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati
init(copying source: _StorageClass) {
_myNode = source._myNode
_owner = source._owner
_nodeDb = source._nodeDb
_receiveQueue = source._receiveQueue
_version = source._version
_rxTextMessage = source._rxTextMessage
@ -506,7 +495,6 @@ extension DeviceState: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati
switch fieldNumber {
case 2: try { try decoder.decodeSingularMessageField(value: &_storage._myNode) }()
case 3: try { try decoder.decodeSingularMessageField(value: &_storage._owner) }()
case 4: try { try decoder.decodeRepeatedMessageField(value: &_storage._nodeDb) }()
case 5: try { try decoder.decodeRepeatedMessageField(value: &_storage._receiveQueue) }()
case 7: try { try decoder.decodeSingularMessageField(value: &_storage._rxTextMessage) }()
case 8: try { try decoder.decodeSingularUInt32Field(value: &_storage._version) }()
@ -533,9 +521,6 @@ extension DeviceState: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati
try { if let v = _storage._owner {
try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
} }()
if !_storage._nodeDb.isEmpty {
try visitor.visitRepeatedMessageField(value: _storage._nodeDb, fieldNumber: 4)
}
if !_storage._receiveQueue.isEmpty {
try visitor.visitRepeatedMessageField(value: _storage._receiveQueue, fieldNumber: 5)
}
@ -571,7 +556,6 @@ extension DeviceState: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati
let rhs_storage = _args.1
if _storage._myNode != rhs_storage._myNode {return false}
if _storage._owner != rhs_storage._owner {return false}
if _storage._nodeDb != rhs_storage._nodeDb {return false}
if _storage._receiveQueue != rhs_storage._receiveQueue {return false}
if _storage._version != rhs_storage._version {return false}
if _storage._rxTextMessage != rhs_storage._rxTextMessage {return false}

File diff suppressed because it is too large Load diff

View file

@ -40,60 +40,77 @@ enum PortNum: SwiftProtobuf.Enum {
/// Deprecated: do not use in new code (formerly called OPAQUE)
/// A message sent from a device outside of the mesh, in a form the mesh does not understand
/// NOTE: This must be 0, because it is documented in IMeshService.aidl to be so
/// ENCODING: binary undefined
case unknownApp // = 0
///
/// A simple UTF-8 text message, which even the little micros in the mesh
/// can understand and show on their screen eventually in some circumstances
/// even signal might send messages in this form (see below)
/// ENCODING: UTF-8 Plaintext (?)
case textMessageApp // = 1
///
/// Reserved for built-in GPIO/example app.
/// See remote_hardware.proto/HardwareMessage for details on the message sent/received to this port number
/// ENCODING: Protobuf
case remoteHardwareApp // = 2
///
/// The built-in position messaging app.
/// Payload is a [Position](/docs/developers/protobufs/api#position) message
/// ENCODING: Protobuf
case positionApp // = 3
///
/// The built-in user info app.
/// Payload is a [User](/docs/developers/protobufs/api#user) message
/// ENCODING: Protobuf
case nodeinfoApp // = 4
///
/// Protocol control packets for mesh protocol use.
/// Payload is a [Routing](/docs/developers/protobufs/api#routing) message
/// ENCODING: Protobuf
case routingApp // = 5
///
/// Admin control packets.
/// Payload is a [AdminMessage](/docs/developers/protobufs/api#adminmessage) message
/// ENCODING: Protobuf
case adminApp // = 6
///
/// Compressed TEXT_MESSAGE payloads.
/// ENCODING: UTF-8 Plaintext (?) with Unishox2 Compression
/// NOTE: The Device Firmware converts a TEXT_MESSAGE_APP to TEXT_MESSAGE_COMPRESSED_APP if the compressed
/// payload is shorter. There's no need for app developers to do this themselves. Also the firmware will decompress
/// any incoming TEXT_MESSAGE_COMPRESSED_APP payload and convert to TEXT_MESSAGE_APP.
case textMessageCompressedApp // = 7
///
/// Waypoint payloads.
/// Payload is a [Waypoint](/docs/developers/protobufs/api#waypoint) message
/// ENCODING: Protobuf
case waypointApp // = 8
///
/// Audio Payloads.
/// Encapsulated codec2 packets. On 2.4 GHZ Bandwidths only for now
/// ENCODING: codec2 audio frames
/// NOTE: audio frames contain a 3 byte header (0xc0 0xde 0xc2) and a one byte marker for the decompressed bitrate.
/// This marker comes from the 'moduleConfig.audio.bitrate' enum minus one.
case audioApp // = 9
///
/// Provides a 'ping' service that replies to any packet it receives.
/// Also serves as a small example module.
/// ENCODING: ASCII Plaintext
case replyApp // = 32
///
/// Used for the python IP tunnel feature
/// ENCODING: IP Packet. Handled by the python API, firmware ignores this one and pases on.
case ipTunnelApp // = 33
///
@ -102,26 +119,31 @@ enum PortNum: SwiftProtobuf.Enum {
/// network is forwarded to the RX pin while sending a packet to TX will go out to the Mesh network.
/// Maximum packet size of 240 bytes.
/// Module is disabled by default can be turned on by setting SERIAL_MODULE_ENABLED = 1 in SerialPlugh.cpp.
/// ENCODING: binary undefined
case serialApp // = 64
///
/// STORE_FORWARD_APP (Work in Progress)
/// Maintained by Jm Casler (MC Hamster) : jm@casler.org
/// ENCODING: Protobuf
case storeForwardApp // = 65
///
/// Optional port for messages for the range test module.
/// ENCODING: ASCII Plaintext
case rangeTestApp // = 66
///
/// Provides a format to send and receive telemetry data from the Meshtastic network.
/// Maintained by Charles Crossan (crossan007) : crossan007@gmail.com
/// ENCODING: Protobuf
case telemetryApp // = 67
///
/// Experimental tools for estimating node position without a GPS
/// Maintained by Github user a-f-G-U-C (a Meshtastic contributor)
/// Project files at https://github.com/a-f-G-U-C/Meshtastic-ZPS
/// ENCODING: arrays of int64 fields
case zpsApp // = 68
///
@ -129,15 +151,18 @@ enum PortNum: SwiftProtobuf.Enum {
/// as if they did using their LoRa chip.
/// Maintained by GitHub user GUVWAF.
/// Project files at https://github.com/GUVWAF/Meshtasticator
/// ENCODING: Protobuf (?)
case simulatorApp // = 69
///
/// Provides a traceroute functionality to show the route a packet towards
/// a certain destination would take on the mesh.
/// ENCODING: Protobuf
case tracerouteApp // = 70
///
/// Aggregates edge info for the network by sending out a list of each node's neighbors
/// ENCODING: Protobuf
case neighborinfoApp // = 71
///
@ -148,6 +173,7 @@ enum PortNum: SwiftProtobuf.Enum {
///
/// ATAK Forwarder Module https://github.com/paulmandal/atak-forwarder
/// ENCODING: libcotshrink
case atakForwarder // = 257
///

View file

@ -50,7 +50,7 @@ struct Connect: View {
if bleManager.connectedPeripheral != nil && bleManager.connectedPeripheral.peripheral.state == .connected {
HStack {
VStack(alignment: .center) {
CircleText(text: node?.user?.shortName ?? "???", color: Color(UIColor(hex: UInt32(node?.num ?? 0))), circleSize: 80, fontSize: (node?.user?.shortName ?? "???").isEmoji() ? 52 : 30, textColor: UIColor(hex: UInt32(node?.num ?? 0)).isLight() ? .black : .white )
CircleText(text: node?.user?.shortName ?? "???", color: Color(UIColor(hex: UInt32(node?.num ?? 0))), circleSize: 90, fontSize: (node?.user?.shortName ?? "???").isEmoji() ? 52 : (node?.user?.shortName?.count ?? 0 == 4 ? 26 : 36), textColor: UIColor(hex: UInt32(node?.num ?? 0)).isLight() ? .black : .white )
}
.padding(.trailing)
VStack(alignment: .leading) {

View file

@ -30,7 +30,7 @@ struct CircleText: View {
struct CircleText_Previews: PreviewProvider {
static var previews: some View {
CircleText(text: "RDDN", color: Color.accentColor)
CircleText(text: "MOMO", color: Color.accentColor)
.previewLayout(.fixed(width: 300, height: 100))
}
}

View file

@ -47,8 +47,7 @@ struct DeviceMetricsLog: View {
.accessibilityLabel("Line Series")
.accessibilityValue("X: \(point.time!), Y: \(point.batteryLevel)")
.foregroundStyle(batteryChartColor)
.interpolationMethod(.cardinal)
//.interpolationMethod(.catmullRom(alpha: 1.0))
.interpolationMethod(.catmullRom(alpha: 1.0))
Plot {
PointMark(
@ -181,7 +180,7 @@ struct DeviceMetricsLog: View {
.buttonBorderShape(.capsule)
.controlSize(.large)
.padding(.bottom)
.padding(.trailing)
.padding(.leading)
.confirmationDialog(
"are.you.sure",
isPresented: $isPresentingClearLogConfirm,
@ -195,6 +194,7 @@ struct DeviceMetricsLog: View {
}
}
}
Button {
exportString = telemetryToCsvFile(telemetry: deviceMetrics, metricsType: 0)
isExporting = true

View file

@ -169,7 +169,7 @@ struct EnvironmentMetricsLog: View {
.buttonBorderShape(.capsule)
.controlSize(.large)
.padding(.bottom)
.padding(.trailing)
.padding(.leading)
.confirmationDialog(
"are.you.sure",
isPresented: $isPresentingClearLogConfirm,
@ -191,7 +191,7 @@ struct EnvironmentMetricsLog: View {
.buttonBorderShape(.capsule)
.controlSize(.large)
.padding(.bottom)
.padding(.leading)
.padding(.trailing)
}
.navigationTitle("Environment Metrics Log")
.navigationBarTitleDisplayMode(.inline)

View file

@ -38,7 +38,7 @@ struct NodeList: View {
LazyVStack(alignment: .leading) {
HStack {
VStack(alignment: .leading) {
CircleText(text: node.user?.shortName ?? "???", color: Color(UIColor(hex: UInt32(node.num))), circleSize: 65, fontSize: (node.user?.shortName ?? "???").isEmoji() ? 44 : 22, brightness: 0.0, textColor: UIColor(hex: UInt32(node.num)).isLight() ? .black : .white)
CircleText(text: node.user?.shortName ?? "???", color: Color(UIColor(hex: UInt32(node.num))), circleSize: 65, fontSize: (node.user?.shortName ?? "???").isEmoji() ? 44 : (node.user?.shortName?.count ?? 0 == 4 ? 19 : 26), brightness: 0.0, textColor: UIColor(hex: UInt32(node.num)).isLight() ? .black : .white)
.padding(.trailing, 5)
let deviceMetrics = node.telemetries?.filtered(using: NSPredicate(format: "metricsType == 0"))
if deviceMetrics?.count ?? 0 >= 1 {

View file

@ -127,7 +127,7 @@ struct PositionLog: View {
.buttonBorderShape(.capsule)
.controlSize(.large)
.padding(.bottom)
.padding(.trailing)
.padding(.leading)
.confirmationDialog(
"are.you.sure",
isPresented: $isPresentingClearLogConfirm,
@ -154,7 +154,7 @@ struct PositionLog: View {
.buttonBorderShape(.capsule)
.controlSize(.large)
.padding(.bottom)
.padding(.leading)
.padding(.trailing)
}
.fileExporter(
isPresented: $isExporting,

View file

@ -67,23 +67,24 @@ struct MeshLog: View {
print(error)
}
} label: {
Label("Clear Log", systemImage: "trash.fill")
Label("Clear", systemImage: "trash.fill")
}
.buttonStyle(.bordered)
.buttonBorderShape(.capsule)
.controlSize(.large)
.padding()
Spacer()
.padding(.bottom)
.padding(.leading)
Button {
isExporting = true
} label: {
Label("Save Log", systemImage: "square.and.arrow.down")
Label("Save", systemImage: "square.and.arrow.down")
}
.buttonStyle(.bordered)
.buttonBorderShape(.capsule)
.controlSize(.large)
.padding()
.padding(.bottom)
.padding(.trailing)
Spacer()
}
.padding(.bottom, 10)