Updated Protobuf comments

This commit is contained in:
Garth Vander Houwen 2022-06-14 16:45:43 -07:00
parent 24642e8c45
commit 9062dac9eb
9 changed files with 190 additions and 54 deletions

View file

@ -23,6 +23,8 @@
DD3501892852FC3B000FC853 /* Settings.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD3501882852FC3B000FC853 /* Settings.swift */; };
DD35018B2852FC79000FC853 /* UserSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD35018A2852FC79000FC853 /* UserSettings.swift */; };
DD41582628582E9B009B0E59 /* DeviceConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD41582528582E9B009B0E59 /* DeviceConfig.swift */; };
DD415828285859C4009B0E59 /* TelemetryConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD415827285859C4009B0E59 /* TelemetryConfig.swift */; };
DD41582A28585C32009B0E59 /* RangeTestConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD41582928585C32009B0E59 /* RangeTestConfig.swift */; };
DD47E3CE26F103C600029299 /* NodeList.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD47E3CD26F103C600029299 /* NodeList.swift */; };
DD47E3D626F17ED900029299 /* CircleText.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD47E3D526F17ED900029299 /* CircleText.swift */; };
DD47E3D926F3093800029299 /* MessageBubble.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD47E3D826F3093800029299 /* MessageBubble.swift */; };
@ -105,6 +107,8 @@
DD3501882852FC3B000FC853 /* Settings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Settings.swift; sourceTree = "<group>"; };
DD35018A2852FC79000FC853 /* UserSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserSettings.swift; sourceTree = "<group>"; };
DD41582528582E9B009B0E59 /* DeviceConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceConfig.swift; sourceTree = "<group>"; };
DD415827285859C4009B0E59 /* TelemetryConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TelemetryConfig.swift; sourceTree = "<group>"; };
DD41582928585C32009B0E59 /* RangeTestConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RangeTestConfig.swift; sourceTree = "<group>"; };
DD45C77427BD4EF80011784F /* MeshtasticDataModel v2.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "MeshtasticDataModel v2.xcdatamodel"; sourceTree = "<group>"; };
DD47E3CD26F103C600029299 /* NodeList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NodeList.swift; sourceTree = "<group>"; };
DD47E3D526F17ED900029299 /* CircleText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CircleText.swift; sourceTree = "<group>"; };
@ -237,6 +241,8 @@
DD2553562855B02500E55709 /* LoRaConfig.swift */,
DD2553582855B52700E55709 /* PositionConfig.swift */,
DD25535C285666C700E55709 /* PowerConfig.swift */,
DD41582928585C32009B0E59 /* RangeTestConfig.swift */,
DD415827285859C4009B0E59 /* TelemetryConfig.swift */,
DD8169FA271F1F3A00F4AB02 /* MeshLog.swift */,
DD8169FE272476C700F4AB02 /* LogDocument.swift */,
);
@ -626,9 +632,11 @@
C9A88B57278B559900BD810A /* apponly.pb.swift in Sources */,
DD4C158E2824AA7E0032668E /* config.pb.swift in Sources */,
DD47E3D926F3093800029299 /* MessageBubble.swift in Sources */,
DD415828285859C4009B0E59 /* TelemetryConfig.swift in Sources */,
C9697F9D279336B700250207 /* LocalMBTileOverlay.swift in Sources */,
DD8169F9271F1A6100F4AB02 /* MeshLogger.swift in Sources */,
DD539502276DAA6A00AD86B1 /* MapLocation.swift in Sources */,
DD41582A28585C32009B0E59 /* RangeTestConfig.swift in Sources */,
DDAF8C6726ED0C8C0058C060 /* remote_hardware.pb.swift in Sources */,
DDAF8C6526ED0A490058C060 /* channel.pb.swift in Sources */,
DDC2E15826CE248E0042C5E4 /* MeshtasticAppleApp.swift in Sources */,

View file

@ -150,7 +150,7 @@ struct Config {
}
///
/// TODO: REPLACE
/// Configuration
struct DeviceConfig {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
@ -182,10 +182,7 @@ struct Config {
///
/// Defines the device's role on the Mesh network
/// unset
/// Behave normally.
/// Router
/// Functions as a router
/// unset - 0
enum Role: SwiftProtobuf.Enum {
typealias RawValue = Int
@ -202,7 +199,7 @@ struct Config {
///
/// Router device role.
/// Uses an agressive algirithem for the flood networking so packets will
/// prefer to be routed over this node. Also assume that this will be generally
/// prefer to be routed over this node. Also assume that this will be
/// unattended and so will turn off the wifi/ble radio as well as the oled screen.
case router // = 2
@ -245,7 +242,7 @@ struct Config {
}
///
/// TODO: REPLACE
/// Position Config
struct PositionConfig {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
@ -376,7 +373,8 @@ struct Config {
}
///
/// TODO: REPLACE
/// Power Config\
/// See [power management](/docs/software/other/power) for additional power management state machine option details.
struct PowerConfig {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
@ -384,12 +382,14 @@ struct Config {
///
/// Sets the current of the battery charger
/// TBEAM 1.1 Only
var chargeCurrent: Config.PowerConfig.ChargeCurrent = .maunset
///
/// If set, we are powered from a low-current source (i.e. solar), so even if it looks like we have power flowing in
/// we should try to minimize power consumption as much as possible.
/// YOU DO NOT NEED TO SET THIS IF YOU'VE set is_router (it is implied in that case).
/// CLI Only Option
var isPowerSaving: Bool = false
///
@ -407,40 +407,43 @@ struct Config {
var adcMultiplierOverride: Float = 0
///
/// Power management state machine option.
/// See [power management](/docs/software/other/power) for details.
/// Wait Bluetooth Seconds
/// The number of seconds for to wait before turning of BLE in No Bluetooth states\
/// 0 for default of 1 minute
var waitBluetoothSecs: UInt32 = 0
///
/// Power management state machine option.
/// See [power management](/docs/software/other/power) for details.
/// 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
/// 0 for default of two hours, MAXUINT for disabled
var meshSdsTimeoutSecs: UInt32 = 0
///
/// Power management state machine option.
/// See [power management](/docs/software/other/power) for details.
/// Super Deep Sleep Seconds
/// While in Light Sleep if mesh_sds_timeout_secs is exceeded we will lower into super deep sleep
/// for this value (default 1 year) or a button press
/// 0 for default of one year
var sdsSecs: UInt32 = 0
///
/// Power management state machine option.
/// See [power management](/docs/software/other/power) for details.
/// Light Sleep Seconds
/// In light sleep the CPU is suspended, LoRa radio is on, BLE is off an GPS is on
/// ESP32 Only
/// 0 for default of 3600
var lsSecs: UInt32 = 0
///
/// Power management state machine option.
/// See [power management](/docs/software/other/power) for details.
/// Minimum Wake Seconds
/// While in light sleep when we receive packets on the LoRa radio we will wake and handle them and stay awake in no BLE mode for this value
/// 0 for default of 10 seconds
var minWakeSecs: UInt32 = 0
var unknownFields = SwiftProtobuf.UnknownStorage()
///
/// Sets the charge control current of devices with a battery charger that can be
/// configured. This is passed into the axp power management chip like on the tbeam.
/// Sets the charge control current of devices with a battery charger that can be configured
/// **TBEAM 1.1 Only**
enum ChargeCurrent: SwiftProtobuf.Enum {
typealias RawValue = Int

View file

@ -21,7 +21,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP
}
///
/// TODO: REPLACE
/// Module Config
struct ModuleConfig {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
@ -169,7 +169,7 @@ struct ModuleConfig {
}
///
/// TODO: REPLACE
/// MQTT Client Config
struct MQTTConfig {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
@ -211,7 +211,7 @@ struct ModuleConfig {
}
///
/// TODO: REPLACE
/// Serial Config
struct SerialConfig {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
@ -357,7 +357,7 @@ struct ModuleConfig {
}
///
/// TODO: REPLACE
/// External Notifications Config
struct ExternalNotificationConfig {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
@ -394,15 +394,14 @@ struct ModuleConfig {
}
///
/// TODO: REPLACE
/// Store and Forward Module Config
struct StoreForwardConfig {
// 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.
///
/// Preferences for the StoreForwardModule
///FIXME - Move this out of UserPreferences and into a section for module configuration. (was 136)
/// Enable the Store and Forward Module
var enabled: Bool = false
///
@ -427,23 +426,23 @@ struct ModuleConfig {
}
///
/// TODO: REPLACE
/// Preferences for the RangeTestModule
struct RangeTestConfig {
// 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.
///
/// Preferences for the RangeTestModule
/// FIXME - Move this out of UserPreferences and into a section for module configuration.
/// Enable the Range Test Module
var enabled: Bool = false
///
/// TODO: REPLACE
/// Send out range test messages from this node
var sender: UInt32 = 0
///
/// TODO: REPLACE
/// Bool value indicating that this node should save a RangeTest.csv file.
/// ESP32 Only
var save: Bool = false
var unknownFields = SwiftProtobuf.UnknownStorage()
@ -460,7 +459,7 @@ struct ModuleConfig {
///
/// Interval in seconds of how often we should try to send our
/// device measurements to the mesh
/// device metrics to the mesh
var deviceUpdateInterval: UInt32 = 0
var environmentUpdateInterval: UInt32 = 0

View file

@ -118,6 +118,9 @@ struct PositionConfig: View {
@State var gpsAttemptTime = 0
@State var positionBroadcastSeconds = 0
@State var includeAltitude = false
@State var includeSatInView = false
var body: some View {
VStack {
@ -195,9 +198,39 @@ struct PositionConfig: View {
}
}
Section(header: Text("Position Flags")) {
Text("TODO")
.font(.caption)
Text("Optional fields to include when assembling position messages. the more fields are included, the larger the message will be - leading to longer airtime and a higher risk of packet loss")
.font(.caption)
.listRowSeparator(.visible)
Toggle(isOn: $includeAltitude) {
Label("Include Altitude", systemImage: "arrow.up")
}
.toggleStyle(DefaultToggleStyle())
.listRowSeparator(.visible)
Toggle(isOn: $includeSatInView) {
Label("Include number of satellites in view", systemImage: "skew")
}
.toggleStyle(DefaultToggleStyle())
.listRowSeparator(.visible)
Toggle(isOn: $includeSatInView) { //64
Label("Include a sequence number incremented per packet", systemImage: "number")
}
.toggleStyle(DefaultToggleStyle())
.listRowSeparator(.visible)
Toggle(isOn: $includeSatInView) { //128
Label("Include positional timestamp", systemImage: "clock")
}
.toggleStyle(DefaultToggleStyle())
.listRowSeparator(.visible)
}
}
}

View file

@ -22,23 +22,13 @@ struct PowerConfig: View {
Form {
Section(header: Text("Warning")) {
Section(header: Text("Enhanced Power Management")) {
Text("These power settings are designed for and and are only useful mostly for solar use cases. Do not use these settings if you are planning on using your device for messaging paired with a phone.")
Text("Meshtastic devices have been improved with simplified role based power management.")
.font(.callout)
.listRowSeparator(.visible)
}
Section(header: Text("States")) {
Toggle(isOn: $isPowerSaving) {
Label("Power Saving", systemImage: "powersleep")
}
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
.disabled(isAlwaysPowered)
Text("If set, we are powered from a low-current source (i.e. solar) and do not intend on using a client to connect via BLE, WiFi or Serial. This setting is assumed and unnessary if you have turned on Router mode.")
.font(.caption)
.listRowSeparator(.visible)
Section(header: Text("State")) {
Toggle(isOn: $isAlwaysPowered) {

View file

@ -0,0 +1,67 @@
//
// TelemetryConfig.swift
// Meshtastic Apple
//
// Copyright (c) Garth Vander Houwen 6/13/22.
//
import SwiftUI
struct RangeTestConfig: View {
@Environment(\.managedObjectContext) var context
@EnvironmentObject var bleManager: BLEManager
@State var enabled = false
@State var sender = false
@State var save = false
var body: some View {
VStack {
Form {
Section(header: Text("Options")) {
Toggle(isOn: $enabled) {
Label("Enabled", systemImage: "figure.walk")
}
.toggleStyle(DefaultToggleStyle())
.listRowSeparator(.visible)
Toggle(isOn: $sender) {
Label("Sender", systemImage: "paperplane")
}
.toggleStyle(DefaultToggleStyle())
Text("This device will send out range test messages.")
.font(.caption)
.listRowSeparator(.visible)
Toggle(isOn: $save) {
Label("Save", systemImage: "square.and.arrow.down.fill")
}
.toggleStyle(DefaultToggleStyle())
Text("Saves a CSV with the range test message details, only available on ESP32 devices with a web server.")
.font(.caption)
.listRowSeparator(.visible)
}
}
.navigationTitle("Range Test Config")
.navigationBarItems(trailing:
ZStack {
ConnectedDevice(bluetoothOn: bleManager.isSwitchedOn, deviceConnected: bleManager.connectedPeripheral != nil, name: (bleManager.connectedPeripheral != nil) ? bleManager.connectedPeripheral.lastFourCode : "????")
})
.onAppear {
self.bleManager.context = context
}
.navigationViewStyle(StackNavigationViewStyle())
}
}
}

View file

@ -95,7 +95,7 @@ struct Settings: View {
}
.disabled(true)
NavigationLink {
DisplayConfig()
RangeTestConfig()
} label: {
Image(systemName: "point.3.connected.trianglepath.dotted")
@ -103,9 +103,8 @@ struct Settings: View {
Text("Range Test")
}
.disabled(true)
NavigationLink {
DisplayConfig()
TelemetryConfig()
} label: {
Image(systemName: "chart.xyaxis.line")
@ -113,11 +112,8 @@ struct Settings: View {
Text("Telemetry (Sensors)")
}
.disabled(true)
}
// Not Implemented:
// Device Config - No interesting settings for end users
// Power Config - All confusion, should delete most and have sensible defaults
// External Notifications - Not Working
// Serial Config - Not sure what the point is
// Store Forward Config - Not Working

View file

@ -26,6 +26,8 @@ struct QrCodeImage {
qrImage = UIImage(cgImage: image)
}
}
let qrCode = filter.outputImage!.transformed(by: transform)
return qrImage
}
}

View file

@ -0,0 +1,38 @@
//
// TelemetryConfig.swift
// Meshtastic Apple
//
// Copyright (c) Garth Vander Houwen 6/13/22.
//
import SwiftUI
struct TelemetryConfig: View {
@Environment(\.managedObjectContext) var context
@EnvironmentObject var bleManager: BLEManager
@State var isPowerSaving = false
@State var isAlwaysPowered = false
var body: some View {
VStack {
Form {
}
.navigationTitle("Telemetry Config")
.navigationBarItems(trailing:
ZStack {
ConnectedDevice(bluetoothOn: bleManager.isSwitchedOn, deviceConnected: bleManager.connectedPeripheral != nil, name: (bleManager.connectedPeripheral != nil) ? bleManager.connectedPeripheral.lastFourCode : "????")
})
.onAppear {
self.bleManager.context = context
}
.navigationViewStyle(StackNavigationViewStyle())
}
}
}