From 30ccfdcd85c35f02b6ad845fb264cbac8fb61006 Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Sun, 5 Mar 2023 18:04:50 +0100 Subject: [PATCH 1/2] (MAJOR) Added success-indication to device updates and forced flushes after nonsuccessful ones. Added exception handling the last missing queues. --- RGB.NET.Core/Devices/AbstractRGBDevice.cs | 2 +- RGB.NET.Core/Update/Devices/IUpdateQueue.cs | 5 ++++ RGB.NET.Core/Update/Devices/UpdateQueue.cs | 6 ++-- .../Generic/AsusUpdateQueue.cs | 12 +++++--- .../Generic/CoolerMasterUpdateQueue.cs | 8 +++-- .../Generic/CorsairDeviceUpdateQueue.cs | 10 +++++-- RGB.NET.Devices.DMX/E131/E131UpdateQueue.cs | 8 +++-- .../DebugDeviceUpdateQueue.cs | 2 +- .../PerDevice/LogitechPerDeviceUpdateQueue.cs | 8 +++-- .../PerKey/LogitechPerKeyUpdateQueue.cs | 8 +++-- .../Zone/LogitechZoneUpdateQueue.cs | 29 +++++++++++++------ .../Generic/MsiDeviceUpdateQueue.cs | 8 +++-- .../Generic/MidiUpdateQueue.cs | 8 +++-- .../Generic/OpenRGBUpdateQueue.cs | 8 +++-- .../PicoPi/PicoPiBulkUpdateQueue.cs | 8 +++-- .../PicoPi/PicoPiHIDUpdateQueue.cs | 8 +++-- .../Generic/RazerUpdateQueue.cs | 8 +++-- .../Generic/SteelSeriesDeviceUpdateQueue.cs | 19 ++++++++++-- .../Generic/SerialPortUpdateQueue.cs | 8 +++-- .../NodeMCU/NodeMCUWS2812USBUpdateQueue.cs | 20 ++++++++++--- .../Generic/WootingUpdateQueue.cs | 8 +++-- 21 files changed, 151 insertions(+), 50 deletions(-) diff --git a/RGB.NET.Core/Devices/AbstractRGBDevice.cs b/RGB.NET.Core/Devices/AbstractRGBDevice.cs index ca6a5b2..6ac90da 100644 --- a/RGB.NET.Core/Devices/AbstractRGBDevice.cs +++ b/RGB.NET.Core/Devices/AbstractRGBDevice.cs @@ -111,7 +111,7 @@ public abstract class AbstractRGBDevice : Placeable, IRGBDevice /// Forces all LEDs to be treated as dirty. /// The collection LEDs to update. - protected virtual IEnumerable GetLedsToUpdate(bool flushLeds) => ((RequiresFlush || flushLeds) ? LedMapping.Values : LedMapping.Values.Where(x => x.IsDirty)).Where(led => led.RequestedColor?.A > 0); + protected virtual IEnumerable GetLedsToUpdate(bool flushLeds) => ((RequiresFlush || flushLeds || UpdateQueue.RequiresFlush) ? LedMapping.Values : LedMapping.Values.Where(x => x.IsDirty)).Where(led => led.RequestedColor?.A > 0); /// /// Gets an enumerable of a custom data and color tuple for the specified leds. diff --git a/RGB.NET.Core/Update/Devices/IUpdateQueue.cs b/RGB.NET.Core/Update/Devices/IUpdateQueue.cs index 3a0f63a..348c16e 100644 --- a/RGB.NET.Core/Update/Devices/IUpdateQueue.cs +++ b/RGB.NET.Core/Update/Devices/IUpdateQueue.cs @@ -11,6 +11,11 @@ namespace RGB.NET.Core; public interface IUpdateQueue : IDisposable where TIdentifier : notnull { + /// + /// Gets a bool indicating if the queue requires a flush of all data due to an internal error. + /// + bool RequiresFlush { get; } + /// /// Sets or merges the provided data set in the current dataset and notifies the trigger that there is new data available. /// diff --git a/RGB.NET.Core/Update/Devices/UpdateQueue.cs b/RGB.NET.Core/Update/Devices/UpdateQueue.cs index 4c169b7..239b689 100644 --- a/RGB.NET.Core/Update/Devices/UpdateQueue.cs +++ b/RGB.NET.Core/Update/Devices/UpdateQueue.cs @@ -19,6 +19,8 @@ public abstract class UpdateQueue : IUpdateQueue _currentDataSet = new(); + public bool RequiresFlush { get; private set; } + #endregion #region Constructors @@ -62,7 +64,7 @@ public abstract class UpdateQueue : IUpdateQueue.Shared.Return(dataSet); } @@ -78,7 +80,7 @@ public abstract class UpdateQueue : IUpdateQueue /// The set of data that needs to be updated. - protected abstract void Update(in ReadOnlySpan<(TIdentifier key, TData color)> dataSet); + protected abstract bool Update(in ReadOnlySpan<(TIdentifier key, TData color)> dataSet); /// /// Sets or merges the provided data set in the current dataset and notifies the trigger that there is new data available. diff --git a/RGB.NET.Devices.Asus/Generic/AsusUpdateQueue.cs b/RGB.NET.Devices.Asus/Generic/AsusUpdateQueue.cs index 27f4f5b..012ed7e 100644 --- a/RGB.NET.Devices.Asus/Generic/AsusUpdateQueue.cs +++ b/RGB.NET.Devices.Asus/Generic/AsusUpdateQueue.cs @@ -43,14 +43,14 @@ public class AsusUpdateQueue : UpdateQueue #region Methods /// - protected override void Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) { try { if ((Device.Type == (uint)AsusDeviceType.KEYBOARD_RGB) || (Device.Type == (uint)AsusDeviceType.NB_KB_RGB)) { if (Device is not IAuraSyncKeyboard keyboard) - return; + return true; foreach ((object customData, Color value) in dataSet) { @@ -88,12 +88,16 @@ public class AsusUpdateQueue : UpdateQueue } Device.Apply(); + + return true; } catch (Exception ex) { - AsusDeviceProvider.Instance.Throw(ex, true); + AsusDeviceProvider.Instance.Throw(ex); } - } + return false; + } + #endregion } \ No newline at end of file diff --git a/RGB.NET.Devices.CoolerMaster/Generic/CoolerMasterUpdateQueue.cs b/RGB.NET.Devices.CoolerMaster/Generic/CoolerMasterUpdateQueue.cs index 07df7cc..4121c4f 100644 --- a/RGB.NET.Devices.CoolerMaster/Generic/CoolerMasterUpdateQueue.cs +++ b/RGB.NET.Devices.CoolerMaster/Generic/CoolerMasterUpdateQueue.cs @@ -37,7 +37,7 @@ public class CoolerMasterUpdateQueue : UpdateQueue #region Methods /// - protected override void Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) { try { @@ -48,11 +48,15 @@ public class CoolerMasterUpdateQueue : UpdateQueue } _CoolerMasterSDK.SetAllLedColor(_deviceMatrix, _deviceIndex); + + return true; } catch (Exception ex) { - CoolerMasterDeviceProvider.Instance.Throw(ex, true); + CoolerMasterDeviceProvider.Instance.Throw(ex); } + + return false; } #endregion diff --git a/RGB.NET.Devices.Corsair/Generic/CorsairDeviceUpdateQueue.cs b/RGB.NET.Devices.Corsair/Generic/CorsairDeviceUpdateQueue.cs index 2cc6b88..fa743e8 100644 --- a/RGB.NET.Devices.Corsair/Generic/CorsairDeviceUpdateQueue.cs +++ b/RGB.NET.Devices.Corsair/Generic/CorsairDeviceUpdateQueue.cs @@ -38,10 +38,12 @@ public class CorsairDeviceUpdateQueue : UpdateQueue #region Methods /// - protected override unsafe void Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override unsafe bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) { try { + if (!_CUESDK.IsConnected) return false; + Span<_CorsairLedColor> colors = new((void*)_colorPtr, dataSet.Length); for (int i = 0; i < colors.Length; i++) { @@ -53,11 +55,15 @@ public class CorsairDeviceUpdateQueue : UpdateQueue CorsairError error = _CUESDK.CorsairSetLedColors(_device.id!, dataSet.Length, _colorPtr); if (error != CorsairError.Success) throw new RGBDeviceException($"Failed to update device '{_device.id}'. (ErrorCode: {error})"); + + return true; } catch (Exception ex) { - CorsairDeviceProvider.Instance.Throw(ex, true); + CorsairDeviceProvider.Instance.Throw(ex); } + + return false; } /// diff --git a/RGB.NET.Devices.DMX/E131/E131UpdateQueue.cs b/RGB.NET.Devices.DMX/E131/E131UpdateQueue.cs index 4fc62e9..57159e9 100644 --- a/RGB.NET.Devices.DMX/E131/E131UpdateQueue.cs +++ b/RGB.NET.Devices.DMX/E131/E131UpdateQueue.cs @@ -59,7 +59,7 @@ public class E131UpdateQueue : UpdateQueue } /// - protected override void Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) { try { @@ -73,11 +73,15 @@ public class E131UpdateQueue : UpdateQueue } _socket.Send(DataPacket, DataPacket.Length); + + return true; } catch (Exception ex) { - DMXDeviceProvider.Instance.Throw(ex, true); + DMXDeviceProvider.Instance.Throw(ex); } + + return false; } /// diff --git a/RGB.NET.Devices.Debug/DebugDeviceUpdateQueue.cs b/RGB.NET.Devices.Debug/DebugDeviceUpdateQueue.cs index ccd0344..1e00c42 100644 --- a/RGB.NET.Devices.Debug/DebugDeviceUpdateQueue.cs +++ b/RGB.NET.Devices.Debug/DebugDeviceUpdateQueue.cs @@ -15,7 +15,7 @@ internal class DebugDeviceUpdateQueue : UpdateQueue #region Methods - protected override void Update(in ReadOnlySpan<(object key, Color color)> dataSet) { } + protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) => true; #endregion } \ No newline at end of file diff --git a/RGB.NET.Devices.Logitech/PerDevice/LogitechPerDeviceUpdateQueue.cs b/RGB.NET.Devices.Logitech/PerDevice/LogitechPerDeviceUpdateQueue.cs index eede537..c32f87d 100644 --- a/RGB.NET.Devices.Logitech/PerDevice/LogitechPerDeviceUpdateQueue.cs +++ b/RGB.NET.Devices.Logitech/PerDevice/LogitechPerDeviceUpdateQueue.cs @@ -25,7 +25,7 @@ public class LogitechPerDeviceUpdateQueue : UpdateQueue #region Methods /// - protected override void Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) { try { @@ -35,11 +35,15 @@ public class LogitechPerDeviceUpdateQueue : UpdateQueue _LogitechGSDK.LogiLedSetLighting((int)Math.Round(color.R * 100), (int)Math.Round(color.G * 100), (int)Math.Round(color.B * 100)); + + return true; } catch (Exception ex) { - LogitechDeviceProvider.Instance.Throw(ex, true); + LogitechDeviceProvider.Instance.Throw(ex); } + + return false; } #endregion diff --git a/RGB.NET.Devices.Logitech/PerKey/LogitechPerKeyUpdateQueue.cs b/RGB.NET.Devices.Logitech/PerKey/LogitechPerKeyUpdateQueue.cs index 5c4efbb..b0bdaf4 100644 --- a/RGB.NET.Devices.Logitech/PerKey/LogitechPerKeyUpdateQueue.cs +++ b/RGB.NET.Devices.Logitech/PerKey/LogitechPerKeyUpdateQueue.cs @@ -25,7 +25,7 @@ public class LogitechPerKeyUpdateQueue : UpdateQueue #region Methods /// - protected override void Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) { try { @@ -40,11 +40,15 @@ public class LogitechPerKeyUpdateQueue : UpdateQueue (int)MathF.Round(color.G * 100), (int)MathF.Round(color.B * 100)); } + + return true; } catch (Exception ex) { - LogitechDeviceProvider.Instance.Throw(ex, true); + LogitechDeviceProvider.Instance.Throw(ex); } + + return false; } #endregion diff --git a/RGB.NET.Devices.Logitech/Zone/LogitechZoneUpdateQueue.cs b/RGB.NET.Devices.Logitech/Zone/LogitechZoneUpdateQueue.cs index a76d5c5..eba7a2d 100644 --- a/RGB.NET.Devices.Logitech/Zone/LogitechZoneUpdateQueue.cs +++ b/RGB.NET.Devices.Logitech/Zone/LogitechZoneUpdateQueue.cs @@ -33,18 +33,29 @@ public class LogitechZoneUpdateQueue : UpdateQueue #region Methods /// - protected override void Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) { - _LogitechGSDK.LogiLedSetTargetDevice(LogitechDeviceCaps.All); - - foreach ((object key, Color color) in dataSet) + try { - int zone = (int)key; - _LogitechGSDK.LogiLedSetLightingForTargetZone(_deviceType, zone, - (int)MathF.Round(color.R * 100), - (int)MathF.Round(color.G * 100), - (int)MathF.Round(color.B * 100)); + _LogitechGSDK.LogiLedSetTargetDevice(LogitechDeviceCaps.All); + + foreach ((object key, Color color) in dataSet) + { + int zone = (int)key; + _LogitechGSDK.LogiLedSetLightingForTargetZone(_deviceType, zone, + (int)MathF.Round(color.R * 100), + (int)MathF.Round(color.G * 100), + (int)MathF.Round(color.B * 100)); + } + + return true; } + catch (Exception ex) + { + LogitechDeviceProvider.Instance.Throw(ex); + } + + return false; } #endregion diff --git a/RGB.NET.Devices.Msi/Generic/MsiDeviceUpdateQueue.cs b/RGB.NET.Devices.Msi/Generic/MsiDeviceUpdateQueue.cs index 4a9acd5..8db204f 100644 --- a/RGB.NET.Devices.Msi/Generic/MsiDeviceUpdateQueue.cs +++ b/RGB.NET.Devices.Msi/Generic/MsiDeviceUpdateQueue.cs @@ -34,17 +34,21 @@ public class MsiDeviceUpdateQueue : UpdateQueue #region Methods /// - protected override void Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) { try { foreach ((object key, Color color) in dataSet) _MsiSDK.SetLedColor(_deviceType, (int)key, color.GetR(), color.GetG(), color.GetB()); + + return true; } catch (Exception ex) { - MsiDeviceProvider.Instance.Throw(ex, true); + MsiDeviceProvider.Instance.Throw(ex); } + + return false; } #endregion diff --git a/RGB.NET.Devices.Novation/Generic/MidiUpdateQueue.cs b/RGB.NET.Devices.Novation/Generic/MidiUpdateQueue.cs index 9a1af35..945c4ff 100644 --- a/RGB.NET.Devices.Novation/Generic/MidiUpdateQueue.cs +++ b/RGB.NET.Devices.Novation/Generic/MidiUpdateQueue.cs @@ -35,17 +35,21 @@ public abstract class MidiUpdateQueue : UpdateQueue #region Methods /// - protected override void Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) { try { foreach ((object key, Color color) in dataSet) SendMessage(CreateMessage(key, color)); + + return true; } catch (Exception ex) { - NovationDeviceProvider.Instance.Throw(ex, true); + NovationDeviceProvider.Instance.Throw(ex); } + + return false; } /// diff --git a/RGB.NET.Devices.OpenRGB/Generic/OpenRGBUpdateQueue.cs b/RGB.NET.Devices.OpenRGB/Generic/OpenRGBUpdateQueue.cs index b6c91b8..fa79e6e 100644 --- a/RGB.NET.Devices.OpenRGB/Generic/OpenRGBUpdateQueue.cs +++ b/RGB.NET.Devices.OpenRGB/Generic/OpenRGBUpdateQueue.cs @@ -49,7 +49,7 @@ public class OpenRGBUpdateQueue : UpdateQueue #region Methods /// - protected override void Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) { try { @@ -57,11 +57,15 @@ public class OpenRGBUpdateQueue : UpdateQueue _colors[(int)key] = new OpenRGBColor(color.GetR(), color.GetG(), color.GetB()); _openRGB.UpdateLeds(_deviceid, _colors); + + return true; } catch (Exception ex) { - OpenRGBDeviceProvider.Instance.Throw(ex, true); + OpenRGBDeviceProvider.Instance.Throw(ex); } + + return false; } #endregion diff --git a/RGB.NET.Devices.PicoPi/PicoPi/PicoPiBulkUpdateQueue.cs b/RGB.NET.Devices.PicoPi/PicoPi/PicoPiBulkUpdateQueue.cs index 4e0a096..8cd251d 100644 --- a/RGB.NET.Devices.PicoPi/PicoPi/PicoPiBulkUpdateQueue.cs +++ b/RGB.NET.Devices.PicoPi/PicoPi/PicoPiBulkUpdateQueue.cs @@ -44,7 +44,7 @@ public class PicoPiBulkUpdateQueue : UpdateQueue #region Methods /// - protected override void Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) { try { @@ -62,11 +62,15 @@ public class PicoPiBulkUpdateQueue : UpdateQueue } _sdk.SendBulkUpdate(buffer, _channel); + + return true; } catch (Exception ex) { - PicoPiDeviceProvider.Instance.Throw(ex, true); + PicoPiDeviceProvider.Instance.Throw(ex); } + + return false; } #endregion diff --git a/RGB.NET.Devices.PicoPi/PicoPi/PicoPiHIDUpdateQueue.cs b/RGB.NET.Devices.PicoPi/PicoPi/PicoPiHIDUpdateQueue.cs index 381d382..b3ff956 100644 --- a/RGB.NET.Devices.PicoPi/PicoPi/PicoPiHIDUpdateQueue.cs +++ b/RGB.NET.Devices.PicoPi/PicoPi/PicoPiHIDUpdateQueue.cs @@ -41,7 +41,7 @@ public class PicoPiHIDUpdateQueue : UpdateQueue #region Methods /// - protected override void Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) { try { @@ -59,11 +59,15 @@ public class PicoPiHIDUpdateQueue : UpdateQueue } _sdk.SendHidUpdate(buffer, _channel); + + return true; } catch (Exception ex) { - PicoPiDeviceProvider.Instance.Throw(ex, true); + PicoPiDeviceProvider.Instance.Throw(ex); } + + return false; } #endregion diff --git a/RGB.NET.Devices.Razer/Generic/RazerUpdateQueue.cs b/RGB.NET.Devices.Razer/Generic/RazerUpdateQueue.cs index 33f8d32..105fee9 100644 --- a/RGB.NET.Devices.Razer/Generic/RazerUpdateQueue.cs +++ b/RGB.NET.Devices.Razer/Generic/RazerUpdateQueue.cs @@ -30,7 +30,7 @@ public abstract class RazerUpdateQueue : UpdateQueue #region Methods /// - protected override void Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) { try { @@ -44,11 +44,15 @@ public abstract class RazerUpdateQueue : UpdateQueue _RazerSDK.DeleteEffect(_lastEffect.Value); _lastEffect = effectId; + + return true; } catch (Exception ex) { - RazerDeviceProvider.Instance.Throw(ex, true); + RazerDeviceProvider.Instance.Throw(ex); } + + return false; } /// diff --git a/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesDeviceUpdateQueue.cs b/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesDeviceUpdateQueue.cs index d5b0c2a..26d744d 100644 --- a/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesDeviceUpdateQueue.cs +++ b/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesDeviceUpdateQueue.cs @@ -46,13 +46,26 @@ internal class SteelSeriesDeviceUpdateQueue : UpdateQueue } catch (Exception ex) { - SteelSeriesDeviceProvider.Instance.Throw(ex, true); + SteelSeriesDeviceProvider.Instance.Throw(ex); } } /// - protected override void Update(in ReadOnlySpan<(object key, Color color)> dataSet) - => SteelSeriesSDK.UpdateLeds(_deviceType, dataSet.ToArray().Select(x => (((SteelSeriesLedId)x.key).GetAPIName(), x.color.ToIntArray())).Where(x => x.Item1 != null).ToList()!); + protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) + { + try + { + SteelSeriesSDK.UpdateLeds(_deviceType, dataSet.ToArray().Select(x => (((SteelSeriesLedId)x.key).GetAPIName(), x.color.ToIntArray())).Where(x => x.Item1 != null).ToList()!); + + return true; + } + catch (Exception ex) + { + SteelSeriesDeviceProvider.Instance.Throw(ex); + } + + return false; + } #endregion } \ No newline at end of file diff --git a/RGB.NET.Devices.WS281X/Generic/SerialPortUpdateQueue.cs b/RGB.NET.Devices.WS281X/Generic/SerialPortUpdateQueue.cs index 78dab04..f1aa16c 100644 --- a/RGB.NET.Devices.WS281X/Generic/SerialPortUpdateQueue.cs +++ b/RGB.NET.Devices.WS281X/Generic/SerialPortUpdateQueue.cs @@ -56,7 +56,7 @@ public abstract class SerialConnectionUpdateQueue : UpdateQueue } /// - protected override void Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) { try { @@ -65,11 +65,15 @@ public abstract class SerialConnectionUpdateQueue : UpdateQueue SerialConnection.ReadTo(Prompt); SendCommand(command); } + + return true; } catch (Exception ex) { - WS281XDeviceProvider.Instance.Throw(ex, true); + WS281XDeviceProvider.Instance.Throw(ex); } + + return false; } /// diff --git a/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBUpdateQueue.cs b/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBUpdateQueue.cs index a3619e2..9e6d30e 100644 --- a/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBUpdateQueue.cs +++ b/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBUpdateQueue.cs @@ -77,13 +77,25 @@ public class NodeMCUWS2812USBUpdateQueue : UpdateQueue } /// - protected override void Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) { - foreach (IGrouping channelData in dataSet.ToArray().Select(x => (((int channel, int key))x.key, x.color)).GroupBy(x => x.Item1.channel)) + try { - byte[] buffer = GetBuffer(channelData); - _sendDataAction(buffer); + foreach (IGrouping channelData in dataSet.ToArray() + .Select(x => (((int channel, int key))x.key, x.color)).GroupBy(x => x.Item1.channel)) + { + byte[] buffer = GetBuffer(channelData); + _sendDataAction(buffer); + } + + return true; } + catch (Exception ex) + { + WS281XDeviceProvider.Instance.Throw(ex); + } + + return false; } private void SendHttp(byte[] buffer) diff --git a/RGB.NET.Devices.Wooting/Generic/WootingUpdateQueue.cs b/RGB.NET.Devices.Wooting/Generic/WootingUpdateQueue.cs index 7e6ae67..3791ba0 100644 --- a/RGB.NET.Devices.Wooting/Generic/WootingUpdateQueue.cs +++ b/RGB.NET.Devices.Wooting/Generic/WootingUpdateQueue.cs @@ -31,7 +31,7 @@ public class WootingUpdateQueue : UpdateQueue #region Methods /// - protected override void Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) { try { @@ -47,11 +47,15 @@ public class WootingUpdateQueue : UpdateQueue _WootingSDK.ArrayUpdateKeyboard(); } + + return true; } catch (Exception ex) { - WootingDeviceProvider.Instance.Throw(ex, true); + WootingDeviceProvider.Instance.Throw(ex); } + + return false; } #endregion From 4a9bbb64dc5a029d44c5a6bf1fbf4b0f3ea3c508 Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Sun, 5 Mar 2023 18:06:08 +0100 Subject: [PATCH 2/2] Added missing doc comment --- RGB.NET.Core/Update/Devices/UpdateQueue.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/RGB.NET.Core/Update/Devices/UpdateQueue.cs b/RGB.NET.Core/Update/Devices/UpdateQueue.cs index 239b689..1cc5eca 100644 --- a/RGB.NET.Core/Update/Devices/UpdateQueue.cs +++ b/RGB.NET.Core/Update/Devices/UpdateQueue.cs @@ -19,6 +19,7 @@ public abstract class UpdateQueue : IUpdateQueue _currentDataSet = new(); + /// public bool RequiresFlush { get; private set; } #endregion