mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Protobufs cleanup, add position config view
This commit is contained in:
parent
90e7ac6f75
commit
5e113c7f1d
4 changed files with 67 additions and 24 deletions
|
|
@ -416,13 +416,6 @@ struct Config {
|
|||
/// 0 for default of 1 minute
|
||||
var waitBluetoothSecs: UInt32 = 0
|
||||
|
||||
///
|
||||
/// Power management state machine option.
|
||||
/// See [power management](/docs/software/other/power) for details.
|
||||
/// 0 for default of 15 minutes
|
||||
/// IMPORTANT NOTE FOR DEVICE CLIENTS: YOU MUST SEND SOME SORT OF PACKET TO THE PHONE AT LEAST THIS OFTEN OR THE DEVICE WILL DECIDE YOU ARE GONE!
|
||||
var phoneTimeoutSecs: UInt32 = 0
|
||||
|
||||
///
|
||||
/// Power management state machine option.
|
||||
/// See [power management](/docs/software/other/power) for details.
|
||||
|
|
@ -1363,7 +1356,6 @@ extension Config.PowerConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImple
|
|||
5: .standard(proto: "is_power_saving"),
|
||||
6: .standard(proto: "adc_multiplier_override"),
|
||||
7: .standard(proto: "wait_bluetooth_secs"),
|
||||
8: .standard(proto: "phone_timeout_secs"),
|
||||
9: .standard(proto: "mesh_sds_timeout_secs"),
|
||||
10: .standard(proto: "sds_secs"),
|
||||
11: .standard(proto: "ls_secs"),
|
||||
|
|
@ -1383,7 +1375,6 @@ extension Config.PowerConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImple
|
|||
case 5: try { try decoder.decodeSingularBoolField(value: &self.isPowerSaving) }()
|
||||
case 6: try { try decoder.decodeSingularFloatField(value: &self.adcMultiplierOverride) }()
|
||||
case 7: try { try decoder.decodeSingularUInt32Field(value: &self.waitBluetoothSecs) }()
|
||||
case 8: try { try decoder.decodeSingularUInt32Field(value: &self.phoneTimeoutSecs) }()
|
||||
case 9: try { try decoder.decodeSingularUInt32Field(value: &self.meshSdsTimeoutSecs) }()
|
||||
case 10: try { try decoder.decodeSingularUInt32Field(value: &self.sdsSecs) }()
|
||||
case 11: try { try decoder.decodeSingularUInt32Field(value: &self.lsSecs) }()
|
||||
|
|
@ -1415,9 +1406,6 @@ extension Config.PowerConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImple
|
|||
if self.waitBluetoothSecs != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.waitBluetoothSecs, fieldNumber: 7)
|
||||
}
|
||||
if self.phoneTimeoutSecs != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.phoneTimeoutSecs, fieldNumber: 8)
|
||||
}
|
||||
if self.meshSdsTimeoutSecs != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.meshSdsTimeoutSecs, fieldNumber: 9)
|
||||
}
|
||||
|
|
@ -1441,7 +1429,6 @@ extension Config.PowerConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImple
|
|||
if lhs.isPowerSaving != rhs.isPowerSaving {return false}
|
||||
if lhs.adcMultiplierOverride != rhs.adcMultiplierOverride {return false}
|
||||
if lhs.waitBluetoothSecs != rhs.waitBluetoothSecs {return false}
|
||||
if lhs.phoneTimeoutSecs != rhs.phoneTimeoutSecs {return false}
|
||||
if lhs.meshSdsTimeoutSecs != rhs.meshSdsTimeoutSecs {return false}
|
||||
if lhs.sdsSecs != rhs.sdsSecs {return false}
|
||||
if lhs.lsSecs != rhs.lsSecs {return false}
|
||||
|
|
|
|||
|
|
@ -26,44 +26,52 @@ enum TelemetrySensorType: SwiftProtobuf.Enum {
|
|||
typealias RawValue = Int
|
||||
|
||||
///
|
||||
/// No external telemetry sensor
|
||||
/// No external telemetry sensor explicitly set
|
||||
case notSet // = 0
|
||||
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
/// Moderate accuracy temperature
|
||||
case dht11 // = 1
|
||||
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
/// High accuracy temperature
|
||||
case ds18B20 // = 2
|
||||
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
/// Moderate accuracy temperature and humidity
|
||||
case dht12 // = 3
|
||||
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
/// Moderate accuracy temperature and humidity
|
||||
case dht21 // = 4
|
||||
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
/// Moderate accuracy temperature and humidity
|
||||
case dht22 // = 5
|
||||
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
/// High accuracy temperature, pressure, humidity
|
||||
case bme280 // = 6
|
||||
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
/// High accuracy temperature, pressure, humidity, and air resistance
|
||||
case bme680 // = 7
|
||||
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
/// Very high accuracy temperature
|
||||
case mcp9808 // = 8
|
||||
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
/// Moderate accuracy temperature and humidity
|
||||
case shtc3 // = 9
|
||||
|
||||
///
|
||||
/// Moderate accuracy current and voltage
|
||||
case ina260 // = 10
|
||||
|
||||
///
|
||||
/// Moderate accuracy current and voltage
|
||||
case ina219 // = 11
|
||||
case UNRECOGNIZED(Int)
|
||||
|
||||
init() {
|
||||
|
|
@ -82,6 +90,8 @@ enum TelemetrySensorType: SwiftProtobuf.Enum {
|
|||
case 7: self = .bme680
|
||||
case 8: self = .mcp9808
|
||||
case 9: self = .shtc3
|
||||
case 10: self = .ina260
|
||||
case 11: self = .ina219
|
||||
default: self = .UNRECOGNIZED(rawValue)
|
||||
}
|
||||
}
|
||||
|
|
@ -98,6 +108,8 @@ enum TelemetrySensorType: SwiftProtobuf.Enum {
|
|||
case .bme680: return 7
|
||||
case .mcp9808: return 8
|
||||
case .shtc3: return 9
|
||||
case .ina260: return 10
|
||||
case .ina219: return 11
|
||||
case .UNRECOGNIZED(let i): return i
|
||||
}
|
||||
}
|
||||
|
|
@ -119,6 +131,8 @@ extension TelemetrySensorType: CaseIterable {
|
|||
.bme680,
|
||||
.mcp9808,
|
||||
.shtc3,
|
||||
.ina260,
|
||||
.ina219,
|
||||
]
|
||||
}
|
||||
|
||||
|
|
@ -280,6 +294,8 @@ extension TelemetrySensorType: SwiftProtobuf._ProtoNameProviding {
|
|||
7: .same(proto: "BME680"),
|
||||
8: .same(proto: "MCP9808"),
|
||||
9: .same(proto: "SHTC3"),
|
||||
10: .same(proto: "INA260"),
|
||||
11: .same(proto: "INA219"),
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ enum RegionCodes : Int, CaseIterable, Identifiable {
|
|||
case .eu868:
|
||||
return "European Union 868mhz"
|
||||
case .cn:
|
||||
return "CN"
|
||||
return "China"
|
||||
case .jp:
|
||||
return "Japan"
|
||||
case .anz:
|
||||
|
|
|
|||
40
MeshtasticApple/Views/Settings/PositionConfig.swift
Normal file
40
MeshtasticApple/Views/Settings/PositionConfig.swift
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
//
|
||||
// PositionConfig.swift
|
||||
// Meshtastic Apple
|
||||
//
|
||||
// Copyright (c) Garth Vander Houwen 6/11/22.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct PositionConfig: View {
|
||||
|
||||
@Environment(\.managedObjectContext) var context
|
||||
@EnvironmentObject var bleManager: BLEManager
|
||||
|
||||
var body: some View {
|
||||
|
||||
VStack {
|
||||
|
||||
Form {
|
||||
Section(header: Text("Heading")) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
.navigationTitle("Position 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())
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue