1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Added devices display in settings

Corsair layouts - Added LL Fans, led strips and AIO pump. Fixed MM800 paths
This commit is contained in:
SpoinkyNL 2019-08-24 13:08:48 +02:00
parent 6da0e54056
commit bc9dccef31
14 changed files with 658 additions and 1011 deletions

View File

@ -62,7 +62,6 @@ namespace Artemis.Core.Services
using (var g = _rgbService.GraphicsDecorator.GetGraphics())
{
g.Clear(Color.Black);
foreach (var module in modules)
module.Render(args.DeltaTime, _rgbService.Surface, g);
}

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Artemis.Core.Events;
using Artemis.Core.RGB.NET;
@ -42,8 +43,7 @@ namespace Artemis.Core.Services
public void AddDeviceProvider(IRGBDeviceProvider deviceProvider)
{
Surface.LoadDevices(deviceProvider);
Surface.AlignDevices();
if (deviceProvider.Devices == null)
return;

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 460 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

View File

@ -0,0 +1,29 @@
<?xml version="1.0"?>
<Device xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Name>Corsair RGB LED Strip</Name>
<Description>Physical layout of Corsairs RGB LED Strip</Description>
<Type>Cooler</Type>
<Lighting>Key</Lighting>
<Vendor>Corsair</Vendor>
<Model>RGB LED Strip</Model>
<Width>270</Width>
<Height>9</Height>
<LedUnitWidth>25</LedUnitWidth>
<LedUnitHeight>9</LedUnitHeight>
<ImageBasePath>Images\Corsair\Customs</ImageBasePath>
<DeviceImage>LEDSTRIP.png</DeviceImage>
<Leds>
<Led Id="LedStripe1">
<X>10</X>
</Led>
<Led Id="LedStripe2" />
<Led Id="LedStripe3" />
<Led Id="LedStripe4" />
<Led Id="LedStripe5" />
<Led Id="LedStripe6" />
<Led Id="LedStripe7" />
<Led Id="LedStripe8" />
<Led Id="LedStripe9" />
<Led Id="LedStripe10" />
</Leds>
</Device>

View File

@ -0,0 +1,96 @@
<?xml version="1.0"?>
<Device xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Name>Corsair LL RGB Fan</Name>
<Description>Physical layout of Corsairs LL RGB Fan</Description>
<Type>Fan</Type>
<Lighting>Key</Lighting>
<Vendor>Corsair</Vendor>
<Model>MM800 RGB</Model>
<Width>140</Width>
<Height>140</Height>
<LedUnitWidth>20</LedUnitWidth>
<LedUnitHeight>20</LedUnitHeight>
<ImageBasePath>Images\Corsair\Customs</ImageBasePath>
<DeviceImage>LLFAN.png</DeviceImage>
<Leds>
<Led Id="Fan1">
<Shape>Circle</Shape>
<X>59.5</X>
<Y>40</Y>
</Led>
<Led Id="Fan4">
<Shape>Circle</Shape>
<Y>+</Y>
</Led>
<Led Id="Fan3">
<Shape>Circle</Shape>
<X>-</X>
<Y>+</Y>
</Led>
<Led Id="Fan2">
<Shape>Circle</Shape>
<X>-</X>
<Y>-</Y>
</Led>
<Led Id="Fan5">
<Shape>Circle</Shape>
<X>59.5</X>
<Y>0</Y>
</Led>
<Led Id="Fan16">
<Shape>Circle</Shape>
<X>90.5</X>
<Y>7.6</Y>
</Led>
<Led Id="Fan15">
<Shape>Circle</Shape>
<X>113</X>
<Y>29.8</Y>
</Led>
<Led Id="Fan14">
<Shape>Circle</Shape>
<X>120.5</X>
<Y>59.9</Y>
</Led>
<Led Id="Fan13">
<Shape>Circle</Shape>
<X>113</X>
<Y>90.4</Y>
</Led>
<Led Id="Fan12">
<Shape>Circle</Shape>
<X>90.5</X>
<Y>113.1</Y>
</Led>
<Led Id="Fan11">
<Shape>Circle</Shape>
<X>59.5</X>
<Y>120.5</Y>
</Led>
<Led Id="Fan10">
<Shape>Circle</Shape>
<X>30.7</X>
<Y>113.1</Y>
</Led>
<Led Id="Fan9">
<Shape>Circle</Shape>
<X>8</X>
<Y>90.4</Y>
</Led>
<Led Id="Fan8">
<Shape>Circle</Shape>
<X>0.4</X>
<Y>59.9</Y>
</Led>
<Led Id="Fan7">
<Shape>Circle</Shape>
<X>7.9</X>
<Y>29.8</Y>
</Led>
<Led Id="Fan6">
<Shape>Circle</Shape>
<X>28</X>
<Y>7.6</Y>
</Led>
</Leds>
</Device>

View File

@ -0,0 +1,22 @@
<?xml version="1.0"?>
<Device xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Name>Corsair H115i RGB Pump</Name>
<Description>Physical layout of Corsairs H115i RGB Pump</Description>
<Type>Cooler</Type>
<Lighting>Key</Lighting>
<Vendor>Corsair</Vendor>
<Model>H115i RGB Pump</Model>
<Width>80</Width>
<Height>80</Height>
<LedUnitWidth>62</LedUnitWidth>
<LedUnitHeight>63</LedUnitHeight>
<ImageBasePath>Images\Corsair\Customs</ImageBasePath>
<DeviceImage>PUMP.png</DeviceImage>
<Leds>
<Led Id="Cooler1">
<Shape>M0.188,0.055 L0.11,0.118 L0.046,0.185 L0.033,0.542 L0.047,0.83 L0.121,0.912 L0.188,0.964 L0.506,0.978 L0.827,0.965 L0.899,0.905 L0.969,0.825 L0.984,0.489 L0.97,0.189 L0.899,0.108 L0.821,0.052 L0.482,0.039z M0.207,0.085 L0.14,0.138 L0.086,0.197 L0.072,0.544 L0.084,0.813 L0.144,0.88 L0.207,0.928 L0.084,0.814 L0.15,0.884 L0.203,0.929 L0.502,0.94 L0.804,0.931 L0.867,0.88 L0.934,0.804 L0.949,0.484 L0.933,0.208 L0.875,0.136 L0.812,0.087 L0.484,0.073 L0.204,0.086z M0.403,0.389 L0.415,0.407 L0.42,0.433 L0.451,0.439 L0.441,0.408z M0.459,0.351 L0.473,0.379 L0.479,0.404 L0.51,0.415 L0.506,0.392 L0.501,0.376z M0.519,0.307 L0.534,0.339 L0.541,0.372 L0.572,0.385 L0.597,0.407 L0.606,0.42 L0.612,0.417 L0.612,0.401 L0.602,0.374 L0.56,0.33z M0.388,0.427 L0.4,0.471 L0.4,0.51 L0.389,0.544 L0.375,0.571 L0.365,0.584 L0.404,0.566 L0.452,0.546 L0.508,0.529 L0.563,0.519 L0.6,0.518 L0.621,0.524 L0.634,0.537 L0.638,0.543 L0.649,0.525 L0.655,0.501 L0.651,0.48 L0.62,0.445 L0.569,0.402 L0.507,0.354 L0.514,0.378 L0.526,0.419 L0.525,0.468 L0.513,0.507 L0.516,0.461 L0.513,0.434 L0.45,0.392 L0.461,0.44 L0.459,0.488 L0.45,0.522 L0.455,0.489 L0.455,0.459z M0.325,0.634 L0.325,0.609 L0.308,0.599 L0.292,0.598 L0.275,0.601 L0.262,0.609 L0.25,0.622 L0.244,0.638 L0.246,0.659 L0.255,0.676 L0.273,0.689 L0.297,0.691 L0.316,0.69 L0.327,0.684 L0.331,0.664 L0.321,0.659 L0.313,0.674 L0.298,0.678 L0.282,0.674 L0.266,0.665 L0.262,0.646 L0.266,0.628 L0.277,0.615 L0.297,0.611 L0.312,0.613z M0.358,0.606 L0.372,0.603 L0.388,0.603 L0.405,0.611 L0.417,0.631 L0.418,0.652 L0.415,0.671 L0.404,0.682 L0.392,0.692 L0.372,0.692 L0.36,0.69 L0.347,0.681 L0.336,0.664 L0.331,0.647 L0.334,0.626 L0.347,0.611z M0.357,0.627 L0.367,0.615 L0.378,0.611 L0.394,0.62 L0.4,0.639 L0.397,0.663 L0.39,0.674 L0.381,0.68 L0.369,0.68 L0.358,0.666 L0.354,0.652 L0.353,0.635z M0.421,0.604 L0.458,0.603 L0.479,0.606 L0.488,0.62 L0.488,0.63 L0.486,0.642 L0.479,0.648 L0.472,0.651 L0.484,0.666 L0.493,0.683 L0.5,0.689 L0.506,0.695 L0.501,0.698 L0.493,0.698 L0.486,0.696 L0.474,0.687 L0.462,0.672 L0.451,0.65 L0.445,0.647 L0.444,0.679 L0.452,0.684 L0.455,0.69 L0.434,0.692 L0.421,0.69 L0.418,0.688 L0.422,0.681 L0.428,0.678 L0.427,0.64 L0.426,0.613z M0.447,0.613 L0.459,0.613 L0.466,0.618 L0.467,0.63 L0.462,0.638 L0.454,0.642 L0.447,0.639z M0.555,0.626 L0.555,0.609 L0.546,0.604 L0.533,0.599 L0.517,0.601 L0.506,0.61 L0.502,0.621 L0.502,0.637 L0.509,0.645 L0.525,0.653 L0.537,0.66 L0.542,0.668 L0.54,0.675 L0.534,0.68 L0.524,0.68 L0.515,0.676 L0.509,0.669 L0.505,0.66 L0.501,0.661 L0.501,0.674 L0.507,0.684 L0.517,0.689 L0.537,0.691 L0.55,0.685 L0.559,0.674 L0.559,0.673 L0.56,0.66 L0.555,0.647 L0.544,0.638 L0.524,0.631 L0.518,0.624 L0.522,0.613 L0.531,0.608 L0.54,0.612 L0.546,0.617 L0.549,0.625z M0.595,0.603 L0.605,0.603 L0.638,0.68 L0.643,0.686 L0.634,0.689 L0.614,0.689 L0.609,0.686 L0.614,0.682 L0.609,0.664 L0.584,0.664 L0.576,0.681 L0.584,0.688 L0.576,0.691 L0.56,0.691 L0.555,0.688 L0.564,0.68 L0.567,0.668z M0.596,0.63 L0.587,0.647 L0.604,0.649z M0.649,0.602 L0.678,0.602 L0.675,0.61 L0.675,0.682 L0.68,0.69 L0.648,0.69 L0.653,0.683 L0.655,0.611z M0.688,0.603 L0.738,0.602 L0.75,0.607 L0.756,0.619 L0.755,0.633 L0.75,0.644 L0.745,0.649 L0.738,0.65 L0.752,0.669 L0.764,0.684 L0.773,0.692 L0.767,0.698 L0.758,0.698 L0.749,0.693 L0.735,0.685 L0.721,0.658 L0.715,0.647 L0.71,0.644 L0.716,0.679 L0.72,0.688 L0.713,0.691 L0.693,0.691 L0.687,0.687 L0.691,0.68 L0.692,0.672 L0.691,0.609z M0.716,0.612 L0.729,0.614 L0.735,0.623 L0.734,0.634 L0.729,0.64 L0.716,0.644z</Shape>
<X>8.6</X>
<Y>7.2</Y>
</Led>
</Leds>
</Device>

View File

@ -10,7 +10,7 @@
<Height>298</Height>
<LedUnitWidth>20</LedUnitWidth>
<LedUnitHeight>54</LedUnitHeight>
<ImageBasePath>Images\Corsair\Mousepad</ImageBasePath>
<ImageBasePath>Images\Corsair\Mousepads</ImageBasePath>
<DeviceImage>MM800RGB.png</DeviceImage>
<Leds>
<Led Id="Mousepad1">

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using Artemis.Core;
using Artemis.Core.Extensions;
using Artemis.Core.Plugins.Abstract;
@ -21,6 +22,7 @@ namespace Artemis.Plugins.Modules.General
private readonly RGBSurface _surface;
private Dictionary<Led, Color> _colors;
private double _circlePosition;
private Color _color;
public GeneralModule(PluginInfo pluginInfo, IRgbService rgbService, PluginSettings settings) : base(pluginInfo)
{
@ -35,6 +37,7 @@ namespace Artemis.Plugins.Modules.General
rgbService.DeviceReloaded += (sender, args) => PopulateColors();
var testSetting = _settings.GetSetting("TestSetting", DateTime.Now);
_color = ColorHelpers.GetRandomRainbowColor();
}
public override void EnablePlugin()
@ -58,12 +61,36 @@ namespace Artemis.Plugins.Modules.General
public override void Render(double deltaTime, RGBSurface surface, Graphics graphics)
{
// _circlePosition += deltaTime * 200;
// if (_circlePosition > 500)
// _circlePosition = -200;
// var rect = new Rectangle((int) _circlePosition * 4, 0 , 200, 200);
// graphics.FillEllipse(new SolidBrush(Color.Blue), rect);
// return;
_circlePosition += deltaTime * 50;
if (_circlePosition > 600)
{
_circlePosition = -200;
_color = ColorHelpers.GetRandomRainbowColor();
}
var rect = new Rectangle((int) _circlePosition * 4, 0, 200, (int) surface.Leds.Max(l => l.AbsoluteLedRectangle.Y + l.AbsoluteLedRectangle.Height));
graphics.FillRectangle(new SolidBrush(_color), rect);
// // Lets do this in the least performant way possible
// foreach (var surfaceLed in _surface.Leds)
// {
// var rectangle = surfaceLed.AbsoluteLedRectangle.ToDrawingRectangle();
// if (surfaceLed.Id == LedId.Fan1)
// {
// graphics.FillRectangle(new SolidBrush(Color.Red), rectangle);
// }
// if (surfaceLed.Id == LedId.Fan2)
// {
// graphics.FillRectangle(new SolidBrush(Color.Blue), rectangle);
// }
// if (surfaceLed.Id == LedId.Fan3)
// {
// graphics.FillRectangle(new SolidBrush(Color.Green), rectangle);
// }
// }
return;
// Lets do this in the least performant way possible
foreach (var surfaceLed in _surface.Leds)
@ -98,9 +125,12 @@ namespace Artemis.Plugins.Modules.General
private void PopulateColors()
{
_colors = new Dictionary<Led, Color>();
foreach (var surfaceLed in _surface.Leds)
_colors.Add(surfaceLed, ColorHelpers.GetRandomRainbowColor());
lock (_colors)
{
_colors = new Dictionary<Led, Color>();
foreach (var surfaceLed in _surface.Leds)
_colors.Add(surfaceLed, ColorHelpers.GetRandomRainbowColor());
}
}
}
}

View File

@ -4,20 +4,91 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:settings="clr-namespace:Artemis.UI.ViewModels.Controls.Settings"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:s="https://github.com/canton7/Stylet"
d:DataContext="{d:DesignInstance settings:RgbDeviceSettingsViewModel}"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Grid.ColumnSpan="2" Text="{Binding Name}" />
<TextBlock Grid.Row="1" Grid.Column="0" Text="{Binding Manufacturer}" />
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Type}" />
</Grid>
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Button.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.PopupBox.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.TextBlock.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<materialDesign:Card
Width="200">
<Grid>
<Grid.RowDefinitions>
<RowDefinition
Height="140" />
<RowDefinition
Height="*" />
<RowDefinition
Height="Auto" />
</Grid.RowDefinitions>
<Rectangle Grid.Row="0" Height="140" Width="196" Fill="{DynamicResource MaterialDesignPaper}"></Rectangle>
<Image
Grid.Row="0"
Source="{Binding Device.DeviceInfo.Image}"
Height="130"
Width="190" RenderOptions.BitmapScalingMode="HighQuality"/>
<Button
Grid.Row="0"
Style="{StaticResource MaterialDesignFloatingActionMiniAccentButton}"
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
Margin="0 0 16 -20"
ToolTip="Identify"
Command="{s:Action Identity}">
<materialDesign:PackIcon Kind="AlarmLight" />
</Button>
<StackPanel
Grid.Row="1"
Margin="8 24 8 0">
<TextBlock FontWeight="Bold" Text="{Binding Device.DeviceInfo.Model}" />
<TextBlock TextWrapping="Wrap" VerticalAlignment="Center">
<Run Text="{Binding Device.DeviceInfo.Manufacturer, Mode=OneWay}" />
-
<Run Text="{Binding Device.DeviceInfo.DeviceType, Mode=OneWay}" />
</TextBlock>
</StackPanel>
<StackPanel
HorizontalAlignment="Right"
Grid.Row="2"
Orientation="Horizontal"
Margin="8">
<Button
Style="{StaticResource MaterialDesignToolButton}"
Width="30"
Padding="2 0 2 0"
materialDesign:RippleAssist.IsCentered="True">
<materialDesign:PackIcon
Kind="ShareVariant" />
</Button>
<Button
Style="{StaticResource MaterialDesignToolButton}"
Width="30"
Padding="2 0 2 0"
materialDesign:RippleAssist.IsCentered="True">
<materialDesign:PackIcon
Kind="Heart" />
</Button>
<materialDesign:PopupBox
Style="{StaticResource MaterialDesignToolPopupBox}"
Padding="2 0 2 0">
<StackPanel>
<Button
Content="More" />
<Button
Content="Options" />
</StackPanel>
</materialDesign:PopupBox>
</StackPanel>
</Grid>
</materialDesign:Card>
</UserControl>

View File

@ -23,16 +23,22 @@
</Grid>
<TextBlock Style="{StaticResource MaterialDesignHeadlineTextBlock}">Devices</TextBlock>
<StackPanel>
<TextBlock>A list of devices and options to disable them</TextBlock>
<TextBlock>A list of devices and options to disable them</TextBlock>
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Margin="0 12 0 0">
<ItemsControl ItemsSource="{Binding DeviceSettingsViewModels}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<ContentControl xaml:View.Model="{Binding}"/>
<ContentControl xaml:View.Model="{Binding}" Margin="5" HorizontalAlignment="Left" VerticalAlignment="Top" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</ScrollViewer>
<TextBlock Style="{StaticResource MaterialDesignHeadlineTextBlock}">Plugins</TextBlock>
<Grid>