@@ -28,18 +28,7 @@ class Display {
2828 }
2929
3030 _ = self . ddc? . write ( command: . onScreenDisplay, value: 1 )
31-
32- DispatchQueue . global ( qos: . background) . asyncAfter ( deadline: DispatchTime . now ( ) + 0.000001 ) {
33- _ = self . ddc? . write ( command: . onScreenDisplay, value: 1 )
34- }
35-
36- DispatchQueue . global ( qos: . background) . asyncAfter ( deadline: DispatchTime . now ( ) + 0.00001 ) {
37- _ = self . ddc? . write ( command: . onScreenDisplay, value: 1 )
38- }
39-
40- DispatchQueue . global ( qos: . background) . asyncAfter ( deadline: DispatchTime . now ( ) + 0.0001 ) {
41- _ = self . ddc? . write ( command: . onScreenDisplay, value: 1 )
42- }
31+ _ = self . ddc? . write ( command: . onScreenDisplay, value: 1 )
4332 }
4433
4534 func mute( ) {
@@ -51,53 +40,72 @@ class Display {
5140 self . isMuted = true
5241 }
5342
54- _ = self . ddc? . write ( command: . audioSpeakerVolume, value: UInt8 ( value) )
55- self . hideDisplayOsd ( )
43+ DispatchQueue . global ( qos: . userInitiated) . async {
44+ guard self . ddc? . write ( command: . audioSpeakerVolume, value: UInt8 ( value) ) == true else {
45+ return
46+ }
47+
48+ self . hideDisplayOsd ( )
49+ self . showOsd ( command: . audioSpeakerVolume, value: value)
50+ }
5651
5752 if let slider = volumeSliderHandler? . slider {
5853 slider. intValue = Int32 ( value)
5954 }
60-
61- self . showOsd ( command: . audioSpeakerVolume, value: value)
6255 }
6356
6457 func setVolume( to value: Int ) {
6558 if value > 0 {
6659 self . isMuted = false
6760 }
6861
69- _ = self . ddc? . write ( command: . audioSpeakerVolume, value: UInt8 ( value) )
70- self . hideDisplayOsd ( )
62+ DispatchQueue . global ( qos: . userInitiated) . async {
63+ guard self . ddc? . write ( command: . audioSpeakerVolume, value: UInt8 ( value) ) == true else {
64+ return
65+ }
66+
67+ self . hideDisplayOsd ( )
68+ self . showOsd ( command: . audioSpeakerVolume, value: value)
69+ }
7170
7271 if let slider = volumeSliderHandler? . slider {
7372 slider. intValue = Int32 ( value)
7473 }
7574
76- self . showOsd ( command: . audioSpeakerVolume, value: value)
7775 self . saveValue ( value, for: . audioSpeakerVolume)
7876 }
7977
8078 func setBrightness( to value: Int ) {
8179 if self . prefs. bool ( forKey: Utils . PrefKeys. lowerContrast. rawValue) {
8280 if value == 0 {
83- _ = self . ddc? . write ( command: . contrast, value: UInt8 ( value) )
81+ DispatchQueue . global ( qos: . userInitiated) . async {
82+ _ = self . ddc? . write ( command: . contrast, value: UInt8 ( value) )
83+ }
8484
8585 if let slider = contrastSliderHandler? . slider {
8686 slider. intValue = Int32 ( value)
8787 }
8888 } else if self . prefs. integer ( forKey: " \( DDC . Command. brightness. value) - \( self . identifier) " ) == 0 {
8989 let contrastValue = self . prefs. integer ( forKey: " \( DDC . Command. contrast. value) - \( self . identifier) " )
90- _ = self . ddc? . write ( command: . contrast, value: UInt8 ( contrastValue) )
90+
91+ DispatchQueue . global ( qos: . userInitiated) . async {
92+ _ = self . ddc? . write ( command: . contrast, value: UInt8 ( contrastValue) )
93+ }
9194 }
9295 }
9396
94- _ = self . ddc? . write ( command: . brightness, value: UInt8 ( value) )
97+ DispatchQueue . global ( qos: . userInitiated) . async {
98+ guard self . ddc? . write ( command: . brightness, value: UInt8 ( value) ) == true else {
99+ return
100+ }
101+
102+ self . showOsd ( command: . brightness, value: value)
103+ }
95104
96105 if let slider = brightnessSliderHandler? . slider {
97106 slider. intValue = Int32 ( value)
98107 }
99108
100- self . showOsd ( command: . brightness, value: value)
101109 self . saveValue ( value, for: . brightness)
102110 }
103111
0 commit comments