Merge pull request #252 from meshtastic/2.0.6_Working_Changes

2.0.6 working changes
This commit is contained in:
Garth Vander Houwen 2022-11-29 21:43:11 -08:00 committed by GitHub
commit fa54be085a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 54 additions and 29 deletions

View file

@ -39,6 +39,8 @@
</uniquenessConstraints>
</entity>
<entity name="DeviceConfigEntity" representedClassName="DeviceConfigEntity" syncable="YES" codeGenerationType="class">
<attribute name="buttonGpio" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="buzzerGpio" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="debugLogEnabled" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
<attribute name="role" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="serialEnabled" optional="YES" attributeType="Boolean" defaultValueString="0" usesScalarValueType="YES"/>
@ -59,6 +61,7 @@
<attribute name="enabled" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
<attribute name="output" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="outputMilliseconds" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="usePWM" optional="YES" attributeType="Boolean" defaultValueString="YES" usesScalarValueType="YES"/>
<relationship name="externalNotificationConfigNode" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="NodeInfoEntity" inverseName="externalNotificationConfig" inverseEntity="NodeInfoEntity"/>
</entity>
<entity name="LoRaConfigEntity" representedClassName="LoRaConfigEntity" syncable="YES" codeGenerationType="class">
@ -251,4 +254,13 @@
<fetchRequest name="fetchedPropertyFetchRequest" entity="MessageEntity" predicateString="((toUser.num == $FETCH_SOURCE.num) OR (fromUser.num == $FETCH_SOURCE.num)) AND toUser != nil AND fromUser != nil AND isEmoji == false AND admin = false"/>
</fetchedProperty>
</entity>
<entity name="WaypointEntity" representedClassName="WaypointEntity" syncable="YES" codeGenerationType="class">
<attribute name="expire" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="id" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="latitudeI" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="locked" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
<attribute name="longDescription" optional="YES" attributeType="String" maxValueString="100"/>
<attribute name="longitudeI" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="name" optional="YES" attributeType="String" maxValueString="30"/>
</entity>
</model>

View file

@ -29,7 +29,7 @@ struct ChannelMessageList: View {
@State private var deleteMessageId: Int64 = 0
@State private var replyMessageId: Int64 = 0
@State private var sendPositionWithMessage: Bool = false
@State private var refreshId = UUID()
//@State private var refreshId = UUID()
var body: some View {
NavigationStack {
@ -218,13 +218,13 @@ struct ChannelMessageList: View {
.scrollDismissesKeyboard(.immediately)
.onAppear(perform: {
self.bleManager.context = context
refreshId = UUID()
// refreshId = UUID()
if channel.allPrivateMessages.count > 0 {
scrollView.scrollTo(channel.allPrivateMessages.last!.messageId)
}
})
.onChange(of: channel.allPrivateMessages, perform: { messages in
refreshId = UUID()
// refreshId = UUID()
if channel.allPrivateMessages.count > 0 {
scrollView.scrollTo(channel.allPrivateMessages.last!.messageId)
}

View file

@ -86,8 +86,10 @@ struct Contacts: View {
.contextMenu {
Button {
channel.mute = !channel.mute
do {
try context.save()
self.context.refresh(channel, mergeChanges: true)
} catch {
context.rollback()
print("💥 Save Channel Mute Error")

View file

@ -28,7 +28,6 @@ struct UserMessageList: View {
@State private var deleteMessageId: Int64 = 0
@State private var replyMessageId: Int64 = 0
@State private var sendPositionWithMessage: Bool = false
@State private var refreshId = UUID()
var body: some View {
NavigationStack {
@ -220,13 +219,11 @@ struct UserMessageList: View {
.scrollDismissesKeyboard(.immediately)
.onAppear(perform: {
self.bleManager.context = context
refreshId = UUID()
if user.messageList.count > 0 {
scrollView.scrollTo(user.messageList.last!.messageId)
}
})
.onChange(of: user.messageList, perform: { messages in
refreshId = UUID()
if user.messageList.count > 0 {
scrollView.scrollTo(user.messageList.last!.messageId)
}

View file

@ -59,6 +59,7 @@ struct ExternalNotificationConfig: View {
@State var alertBell = false
@State var alertMessage = false
@State var active = false
@State var usePWM = true
@State var output = 0
@State var outputMilliseconds = 0
@ -79,36 +80,43 @@ struct ExternalNotificationConfig: View {
Label("Alert when receiving a message", systemImage: "message")
}
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
}
Section(header: Text("GPIO")) {
Toggle(isOn: $active) {
Label("Active", systemImage: "togglepower")
Toggle(isOn: $usePWM) {
Label("Use PWM Buzzer", systemImage: "light.beacon.max.fill")
}
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
Text("Specifies whether the external circuit is triggered when the device's GPIO is low or high.")
.font(.caption)
.listRowSeparator(.visible)
Picker("GPIO to monitor", selection: $output) {
ForEach(0..<40) {
if $0 == 0 {
Text("Unset")
} else {
Text("Pin \($0)")
}
if !usePWM {
Section(header: Text("GPIO")) {
Toggle(isOn: $active) {
Label("Active", systemImage: "togglepower")
}
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
Text("Specifies whether the external circuit is triggered when the device's GPIO is low or high.")
.font(.caption)
.listRowSeparator(.visible)
Picker("GPIO to monitor", selection: $output) {
ForEach(0..<40) {
if $0 == 0 {
Text("Unset")
} else {
Text("Pin \($0)")
}
}
}
}
.pickerStyle(DefaultPickerStyle())
Text("Specifies the GPIO that your external circuit is attached to on the device.")
.font(.caption)
Picker("GPIO Output Duration", selection: $outputMilliseconds ) {
ForEach(OutputIntervals.allCases) { oi in
Text(oi.description)
.pickerStyle(DefaultPickerStyle())
Text("Specifies the GPIO that your external circuit is attached to on the device.")
.font(.caption)
Picker("GPIO Output Duration", selection: $outputMilliseconds ) {
ForEach(OutputIntervals.allCases) { oi in
Text(oi.description)
}
}
.pickerStyle(DefaultPickerStyle())
Text("Specifies how long the monitored GPIO should output.")
.font(.caption)
}
.pickerStyle(DefaultPickerStyle())
Text("Specifies how long the monitored GPIO should output.")
.font(.caption)
}
}
.disabled(bleManager.connectedPeripheral == nil)
Button {
@ -157,6 +165,7 @@ struct ExternalNotificationConfig: View {
self.active = node?.externalNotificationConfig?.active ?? false
self.output = Int(node?.externalNotificationConfig?.output ?? 0)
self.outputMilliseconds = Int(node?.externalNotificationConfig?.outputMilliseconds ?? 0)
self.usePWM = node?.externalNotificationConfig?.usePWM ?? true
self.hasChanges = false
}
.onChange(of: enabled) { newEnabled in
@ -189,6 +198,11 @@ struct ExternalNotificationConfig: View {
if newOutputMs != node!.externalNotificationConfig!.outputMilliseconds { hasChanges = true }
}
}
.onChange(of: usePWM) { newUsePWM in
if node != nil && node!.externalNotificationConfig != nil {
if newUsePWM != node!.externalNotificationConfig!.usePWM { hasChanges = true }
}
}
.navigationViewStyle(StackNavigationViewStyle())
}
}