diff --git a/Meshtastic/Meshtastic.xcdatamodeld/MeshtasticDataModelV22.xcdatamodel/contents b/Meshtastic/Meshtastic.xcdatamodeld/MeshtasticDataModelV22.xcdatamodel/contents
index 5ce393b1..b47fba63 100644
--- a/Meshtastic/Meshtastic.xcdatamodeld/MeshtasticDataModelV22.xcdatamodel/contents
+++ b/Meshtastic/Meshtastic.xcdatamodeld/MeshtasticDataModelV22.xcdatamodel/contents
@@ -64,7 +64,6 @@
-
@@ -263,6 +262,7 @@
+
diff --git a/Meshtastic/Persistence/UpdateCoreData.swift b/Meshtastic/Persistence/UpdateCoreData.swift
index 6bb41d61..2e6ed8a2 100644
--- a/Meshtastic/Persistence/UpdateCoreData.swift
+++ b/Meshtastic/Persistence/UpdateCoreData.swift
@@ -588,6 +588,7 @@ func upsertPositionConfigPacket(config: Meshtastic.Config.PositionConfig, nodeNu
newPositionConfig.deviceGpsEnabled = config.gpsEnabled
newPositionConfig.rxGpio = Int32(config.rxGpio)
newPositionConfig.txGpio = Int32(config.txGpio)
+ newPositionConfig.gpsEnGpio = Int32(config.gpsEnGpio)
newPositionConfig.fixedPosition = config.fixedPosition
newPositionConfig.positionBroadcastSeconds = Int32(truncatingIfNeeded: config.positionBroadcastSecs)
newPositionConfig.broadcastSmartMinimumIntervalSecs = Int32(config.broadcastSmartMinimumIntervalSecs)
@@ -599,6 +600,7 @@ func upsertPositionConfigPacket(config: Meshtastic.Config.PositionConfig, nodeNu
fetchedNode[0].positionConfig?.deviceGpsEnabled = config.gpsEnabled
fetchedNode[0].positionConfig?.rxGpio = Int32(config.rxGpio)
fetchedNode[0].positionConfig?.txGpio = Int32(config.txGpio)
+ fetchedNode[0].positionConfig?.gpsEnGpio = Int32(config.gpsEnGpio)
fetchedNode[0].positionConfig?.fixedPosition = config.fixedPosition
fetchedNode[0].positionConfig?.positionBroadcastSeconds = Int32(config.positionBroadcastSecs)
fetchedNode[0].positionConfig?.broadcastSmartMinimumIntervalSecs = Int32(config.broadcastSmartMinimumIntervalSecs)
diff --git a/Meshtastic/Views/Settings/Config/DeviceConfig.swift b/Meshtastic/Views/Settings/Config/DeviceConfig.swift
index 17623ad2..675ef69e 100644
--- a/Meshtastic/Views/Settings/Config/DeviceConfig.swift
+++ b/Meshtastic/Views/Settings/Config/DeviceConfig.swift
@@ -27,7 +27,6 @@ struct DeviceConfig: View {
@State var rebroadcastMode = 0
@State var doubleTapAsButtonPress = false
@State var isManaged = false
- @State var gpsEnGPIO = 0
var body: some View {
VStack {
@@ -123,18 +122,6 @@ struct DeviceConfig: View {
}
}
.pickerStyle(DefaultPickerStyle())
- Picker("GPS EN GPIO", selection: $gpsEnGPIO) {
- ForEach(0..<46) {
- if $0 == 0 {
- Text("unset")
- } else {
- Text("Pin \($0)")
- }
- }
- }
- .pickerStyle(DefaultPickerStyle())
- Text("(Re)define PIN_GPS_EN for your board.")
- .font(.caption)
}
}
.disabled(self.bleManager.connectedPeripheral == nil || node?.deviceConfig == nil)
@@ -281,11 +268,6 @@ struct DeviceConfig: View {
if newBuzzerGPIO != node!.deviceConfig!.buttonGpio { hasChanges = true }
}
}
- .onChange(of: gpsEnGPIO) { newgpsEnGpio in
- if node != nil && node?.deviceConfig != nil {
- if newgpsEnGpio != node!.deviceConfig!.gpsEnGpio { hasChanges = true }
- }
- }
.onChange(of: rebroadcastMode) { newRebroadcastMode in
if node != nil && node?.deviceConfig != nil {
if newRebroadcastMode != node!.deviceConfig!.rebroadcastMode { hasChanges = true }
@@ -308,7 +290,6 @@ struct DeviceConfig: View {
self.debugLogEnabled = node?.deviceConfig?.debugLogEnabled ?? false
self.buttonGPIO = Int(node?.deviceConfig?.buttonGpio ?? 0)
self.buzzerGPIO = Int(node?.deviceConfig?.buzzerGpio ?? 0)
- self.gpsEnGPIO = Int(node?.deviceConfig?.gpsEnGpio ?? 0)
self.rebroadcastMode = Int(node?.deviceConfig?.rebroadcastMode ?? 0)
self.doubleTapAsButtonPress = node?.deviceConfig?.doubleTapAsButtonPress ?? false
self.isManaged = node?.deviceConfig?.isManaged ?? false
diff --git a/Meshtastic/Views/Settings/Config/PositionConfig.swift b/Meshtastic/Views/Settings/Config/PositionConfig.swift
index 746926dd..4b66a453 100644
--- a/Meshtastic/Views/Settings/Config/PositionConfig.swift
+++ b/Meshtastic/Views/Settings/Config/PositionConfig.swift
@@ -38,6 +38,7 @@ struct PositionConfig: View {
@State var deviceGpsEnabled = true
@State var rxGpio = 0
@State var txGpio = 0
+ @State var gpsEnGpio = 0
@State var fixedPosition = false
@State var positionBroadcastSeconds = 0
@State var broadcastSmartMinimumDistance = 0
@@ -231,6 +232,18 @@ struct PositionConfig: View {
}
}
.pickerStyle(DefaultPickerStyle())
+ Picker("GPS EN GPIO", selection: $gpsEnGpio) {
+ ForEach(0..<46) {
+ if $0 == 0 {
+ Text("unset")
+ } else {
+ Text("Pin \($0)")
+ }
+ }
+ }
+ .pickerStyle(DefaultPickerStyle())
+ Text("(Re)define PIN_GPS_EN for your board.")
+ .font(.caption)
} else {
Toggle(isOn: $fixedPosition) {
Label("Fixed Position", systemImage: "location.square.fill")
@@ -277,6 +290,7 @@ struct PositionConfig: View {
pc.broadcastSmartMinimumDistance = UInt32(broadcastSmartMinimumDistance)
pc.rxGpio = UInt32(rxGpio)
pc.txGpio = UInt32(txGpio)
+ pc.gpsEnGpio = UInt32(gpsEnGpio)
var pf: PositionFlags = []
if includeAltitude { pf.insert(.Altitude) }
if includeAltitudeMsl { pf.insert(.AltitudeMsl) }
@@ -338,6 +352,11 @@ struct PositionConfig: View {
if newTxGpio != node!.positionConfig!.txGpio { hasChanges = true }
}
}
+ .onChange(of: txGpio) { newGpsEnGpio in
+ if node != nil && node!.positionConfig != nil {
+ if newGpsEnGpio != node!.positionConfig!.gpsEnGpio { hasChanges = true }
+ }
+ }
.onChange(of: smartPositionEnabled) { newSmartPositionEnabled in
if node != nil && node!.positionConfig != nil {
if newSmartPositionEnabled != node!.positionConfig!.smartPositionEnabled { hasChanges = true }
@@ -424,6 +443,7 @@ struct PositionConfig: View {
self.deviceGpsEnabled = node?.positionConfig?.deviceGpsEnabled ?? true
self.rxGpio = Int(node?.positionConfig?.rxGpio ?? 0)
self.txGpio = Int(node?.positionConfig?.txGpio ?? 0)
+ self.gpsEnGpio = Int(node?.positionConfig?.gpsEnGpio ?? 0)
self.fixedPosition = node?.positionConfig?.fixedPosition ?? false
self.positionBroadcastSeconds = Int(node?.positionConfig?.positionBroadcastSeconds ?? 900)
self.broadcastSmartMinimumIntervalSecs = Int(node?.positionConfig?.broadcastSmartMinimumIntervalSecs ?? 30)