mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
12 hour clock display config value
This commit is contained in:
parent
30de672389
commit
be263b412a
4 changed files with 21 additions and 1 deletions
|
|
@ -1512,6 +1512,9 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"12 Hour Clock" : {
|
||||
|
||||
},
|
||||
"25" : {
|
||||
"localizations" : {
|
||||
|
|
@ -27693,6 +27696,9 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Sets the screen clock format to 12-hour." : {
|
||||
|
||||
},
|
||||
"Settings" : {
|
||||
"localizations" : {
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@
|
|||
<attribute name="screenCarouselInterval" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
||||
<attribute name="screenOnSeconds" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
||||
<attribute name="units" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
||||
<attribute name="use12HClock" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
|
||||
<attribute name="wakeOnTapOrMotion" optional="YES" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
|
||||
<relationship name="displayConfigNode" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="NodeInfoEntity" inverseName="displayConfig" inverseEntity="NodeInfoEntity"/>
|
||||
</entity>
|
||||
|
|
|
|||
|
|
@ -581,6 +581,7 @@ func upsertDisplayConfigPacket(config: Config.DisplayConfig, nodeNum: Int64, ses
|
|||
newDisplayConfig.displayMode = Int32(config.displaymode.rawValue)
|
||||
newDisplayConfig.units = Int32(config.units.rawValue)
|
||||
newDisplayConfig.headingBold = config.headingBold
|
||||
newDisplayConfig.use12HClock = config.use12HClock
|
||||
fetchedNode[0].displayConfig = newDisplayConfig
|
||||
} else {
|
||||
|
||||
|
|
@ -592,6 +593,7 @@ func upsertDisplayConfigPacket(config: Config.DisplayConfig, nodeNum: Int64, ses
|
|||
fetchedNode[0].displayConfig?.oledType = Int32(config.oled.rawValue)
|
||||
fetchedNode[0].displayConfig?.displayMode = Int32(config.displaymode.rawValue)
|
||||
fetchedNode[0].displayConfig?.units = Int32(config.units.rawValue)
|
||||
fetchedNode[0].displayConfig?.use12HClock = config.use12HClock
|
||||
fetchedNode[0].displayConfig?.headingBold = config.headingBold
|
||||
}
|
||||
if sessionPasskey != nil {
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ struct DisplayConfig: View {
|
|||
@State var oledType = 0
|
||||
@State var displayMode = 0
|
||||
@State var units = 0
|
||||
@State var use12HourClock = false
|
||||
|
||||
var body: some View {
|
||||
Form {
|
||||
|
|
@ -74,6 +75,11 @@ struct DisplayConfig: View {
|
|||
.font(.callout)
|
||||
}
|
||||
.pickerStyle(DefaultPickerStyle())
|
||||
Toggle(isOn: $use12HourClock) {
|
||||
Label("12 Hour Clock", systemImage: "clock")
|
||||
Text("Sets the screen clock format to 12-hour.")
|
||||
}
|
||||
.tint(Color.accentColor)
|
||||
}
|
||||
Section(header: Text("Timing & Format")) {
|
||||
VStack(alignment: .leading) {
|
||||
|
|
@ -141,6 +147,7 @@ struct DisplayConfig: View {
|
|||
dc.oled = OledTypes(rawValue: oledType)!.protoEnumValue()
|
||||
dc.displaymode = DisplayModes(rawValue: displayMode)!.protoEnumValue()
|
||||
dc.units = Units(rawValue: units)!.protoEnumValue()
|
||||
dc.use12HClock = use12HourClock
|
||||
|
||||
let adminMessageId = bleManager.saveDisplayConfig(config: dc, fromUser: connectedNode!.user!, toUser: node!.user!)
|
||||
if adminMessageId > 0 {
|
||||
|
|
@ -211,6 +218,9 @@ struct DisplayConfig: View {
|
|||
.onChange(of: units) { oldUnits, newUnits in
|
||||
if oldUnits != newUnits && newUnits != node?.displayConfig?.units ?? -1 { hasChanges = true }
|
||||
}
|
||||
.onChange(of: use12HourClock) { oldUse12HourClock, newUse12HourClock in
|
||||
if oldUse12HourClock != newUse12HourClock && newUse12HourClock != node?.displayConfig?.use12HClock { hasChanges = true }
|
||||
}
|
||||
}
|
||||
func setDisplayValues() {
|
||||
self.gpsFormat = Int(node?.displayConfig?.gpsFormat ?? 0)
|
||||
|
|
@ -222,6 +232,7 @@ struct DisplayConfig: View {
|
|||
self.oledType = Int(node?.displayConfig?.oledType ?? 0)
|
||||
self.displayMode = Int(node?.displayConfig?.displayMode ?? 0)
|
||||
self.units = Int(node?.displayConfig?.units ?? 0)
|
||||
self.hasChanges = false
|
||||
self.use12HourClock = node?.displayConfig?.use12HClock ?? false
|
||||
self.hasChanges = node?.displayConfig?.use12HClock ?? false
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue