diff --git a/Meshtastic/Meshtastic.xcdatamodeld/MeshtasticDataModelV2.xcdatamodel/contents b/Meshtastic/Meshtastic.xcdatamodeld/MeshtasticDataModelV2.xcdatamodel/contents
index a21fa1a7..b8af8a6b 100644
--- a/Meshtastic/Meshtastic.xcdatamodeld/MeshtasticDataModelV2.xcdatamodel/contents
+++ b/Meshtastic/Meshtastic.xcdatamodeld/MeshtasticDataModelV2.xcdatamodel/contents
@@ -39,6 +39,8 @@
+
+
@@ -59,6 +61,7 @@
+
@@ -251,4 +254,13 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Meshtastic/Views/Messages/ChannelMessageList.swift b/Meshtastic/Views/Messages/ChannelMessageList.swift
index aa8cfacc..6146e275 100644
--- a/Meshtastic/Views/Messages/ChannelMessageList.swift
+++ b/Meshtastic/Views/Messages/ChannelMessageList.swift
@@ -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)
}
diff --git a/Meshtastic/Views/Messages/Contacts.swift b/Meshtastic/Views/Messages/Contacts.swift
index 1be82171..17afdf04 100644
--- a/Meshtastic/Views/Messages/Contacts.swift
+++ b/Meshtastic/Views/Messages/Contacts.swift
@@ -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")
diff --git a/Meshtastic/Views/Messages/UserMessageList.swift b/Meshtastic/Views/Messages/UserMessageList.swift
index 236880fc..12760a29 100644
--- a/Meshtastic/Views/Messages/UserMessageList.swift
+++ b/Meshtastic/Views/Messages/UserMessageList.swift
@@ -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)
}
diff --git a/Meshtastic/Views/Settings/Config/Module/ExternalNotificationConfig.swift b/Meshtastic/Views/Settings/Config/Module/ExternalNotificationConfig.swift
index 0fb79150..2d703880 100644
--- a/Meshtastic/Views/Settings/Config/Module/ExternalNotificationConfig.swift
+++ b/Meshtastic/Views/Settings/Config/Module/ExternalNotificationConfig.swift
@@ -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())
}
}