Skip to content

Commit

Permalink
♻️ Rename effects so that Color is only used for effects where a co…
Browse files Browse the repository at this point in the history
…lor is actually configurable.

e.g. While color cycle is generally understandable, it starts being a problem when we have `ColorWave`, that could actually be a wave one one color, with only brightness changes.
I don't particularly like the use of the word spectrum, but it is more generic than rainbow, and easily understandable, so here it is 🤷‍♂️
  • Loading branch information
hexawyz committed Mar 14, 2024
1 parent 02e1c83 commit bc09ee4
Show file tree
Hide file tree
Showing 21 changed files with 191 additions and 146 deletions.
30 changes: 15 additions & 15 deletions Exo.Core/Lighting/Effects/ColorWaveEffect.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
namespace Exo.Lighting.Effects;
using System.ComponentModel;
using System.Runtime.Serialization;
using Exo.Lighting.Effects;

/// <summary>Represents an effect where colors of the rainbow will move in a wave.</summary>
/// <remarks>
/// <para>
/// This is a slightly more advanced version of <see cref="ColorCycleEffect"/> that is designed for adressable lighting zones only.
/// The adressable lighting zones supporting this effect may not necessarily be adressable through software, but the effect will work as long as the lighting controller supports it.
/// </para>
/// <para>
/// Some lighting controllers may support applying this effect across multiple zones, as if they were a single addressable lighting zone.
/// </para>
/// </remarks>
[TypeId(0xB93254E0, 0xD39C, 0x40DF, 0xBF, 0x1F, 0x89, 0xD6, 0xCE, 0xB6, 0x16, 0x15)]
public readonly struct ColorWaveEffect : ISingletonLightingEffect
namespace Exo.Devices.Asus.Aura.Effects;

/// <summary>Represents an effect where a color will move across an area following a wave pattern.</summary>
/// <remarks>This is the monochrome, less common, version of <see cref="SpectrumWaveEffect"/>.</remarks>
[DataContract]
[TypeId(0xF64133DF, 0x043A, 0x4E9F, 0x82, 0xCA, 0x64, 0x89, 0xB8, 0xF7, 0x86, 0xA7)]
public readonly struct ColorWaveEffect : ISingleColorLightEffect
{
/// <summary>Gets a boxed instance of the effect.</summary>
public static ISingletonLightingEffect SharedInstance { get; } = new ColorWaveEffect();
[DataMember(Order = 1)]
[DisplayName("Color")]
public RgbColor Color { get; }

public ColorWaveEffect(RgbColor color) => Color = color;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ namespace Exo.Lighting.Effects;

/// <summary>Represents an effect where colors will cycle through the color wheel.</summary>
[TypeId(0x2818D561, 0x15FB, 0x43B0, 0x9C, 0x2E, 0x9F, 0xF5, 0x08, 0x82, 0x2B, 0x7A)]
public readonly struct ColorCycleEffect : ISingletonLightingEffect
public readonly struct SpectrumCycleEffect : ISingletonLightingEffect
{
/// <summary>Gets a boxed instance of the effect.</summary>
public static ISingletonLightingEffect SharedInstance { get; } = new ColorCycleEffect();
public static ISingletonLightingEffect SharedInstance { get; } = new SpectrumCycleEffect();
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ namespace Exo.Lighting.Effects;

/// <summary>Represents an effect where colors will cycle through the color wheel with adjustable brightness.</summary>
[TypeId(0x7CDBCE50, 0x63FA, 0x42A4, 0x92, 0xE1, 0xDE, 0x7D, 0x91, 0x52, 0x1F, 0x4D)]
public readonly struct ColorCycleWithBrightnessEffect : IBrightnessLightingEffect
public readonly struct SpectrumCycleWithBrightnessEffect : IBrightnessLightingEffect
{
[DataMember(Order = 1)]
[Display(Name = "Brightness")]
public byte BrightnessLevel { get; }

public ColorCycleWithBrightnessEffect(byte brightnessLevel) => BrightnessLevel = brightnessLevel;
public SpectrumCycleWithBrightnessEffect(byte brightnessLevel) => BrightnessLevel = brightnessLevel;
}
18 changes: 18 additions & 0 deletions Exo.Core/Lighting/Effects/SpectrumWaveEffect.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace Exo.Lighting.Effects;

/// <summary>Represents an effect where colors of the rainbow will move in a wave.</summary>
/// <remarks>
/// <para>
/// This is a slightly more advanced version of <see cref="SpectrumCycleEffect"/> that is designed for adressable lighting zones only.
/// The adressable lighting zones supporting this effect may not necessarily be adressable through software, but the effect will work as long as the lighting controller supports it.
/// </para>
/// <para>
/// Some lighting controllers may support applying this effect across multiple zones, as if they were a single addressable lighting zone.
/// </para>
/// </remarks>
[TypeId(0xB93254E0, 0xD39C, 0x40DF, 0xBF, 0x1F, 0x89, 0xD6, 0xCE, 0xB6, 0x16, 0x15)]
public readonly struct SpectrumWaveEffect : ISingletonLightingEffect
{
/// <summary>Gets a boxed instance of the effect.</summary>
public static ISingletonLightingEffect SharedInstance { get; } = new SpectrumWaveEffect();
}
9 changes: 7 additions & 2 deletions Exo.Core/Lighting/Effects/VariableColorChaseEffect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,21 @@ namespace Exo.Lighting.Effects;

/// <summary>Represents a chasing color effect, for a zone that has more than one light.</summary>
[TypeId(0xA4FBC975, 0x3CBF, 0x48AA, 0x9B, 0xFB, 0x1F, 0x12, 0x89, 0xE7, 0xC3, 0xA0)]
public readonly struct VariableColorChaseEffect : ILightingEffect
public readonly struct VariableColorChaseEffect : ISingleColorLightEffect
{
[DataMember(Order = 1)]
[Display(Name = "Color")]
public RgbColor Color { get; }

[DataMember(Order = 2)]
[Display(Name = "Speed")]
[Range(0, 5)]
[DefaultValue(3)]
public PredeterminedEffectSpeed Speed { get; }

public VariableColorChaseEffect(PredeterminedEffectSpeed speed)
public VariableColorChaseEffect(RgbColor color, PredeterminedEffectSpeed speed)
{
Color = color;
Speed = speed;
}
}
15 changes: 10 additions & 5 deletions Exo.Core/Lighting/Effects/VariableColorWaveEffect.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
using System.Runtime.Serialization;

namespace Exo.Lighting.Effects;

/// <summary>Represents an effect where colors of the rainbow will move in a wave.</summary>
[TypeId(0xD11B8022, 0x2C92, 0x467A, 0xB8, 0x63, 0x9B, 0x70, 0x3D, 0x26, 0x5A, 0x70)]
public readonly struct VariableColorWaveEffect : ILightingEffect
/// <summary>Represents an effect where a color will move across an area following a wave pattern.</summary>
[TypeId(0x3798FD63, 0x6B69, 0x4167, 0xAD, 0x09, 0xB0, 0x06, 0x20, 0x82, 0x17, 0x8C)]
public readonly struct VariableColorWaveEffect : ISingleColorLightEffect
{
[DataMember(Order = 1)]
[Display(Name = "Color")]
public RgbColor Color { get; }

[DataMember(Order = 2)]
[Display(Name = "Speed")]
[Range(0, 5)]
[DefaultValue(3)]
public PredeterminedEffectSpeed Speed { get; }

public VariableColorWaveEffect(PredeterminedEffectSpeed speed)
public VariableColorWaveEffect(RgbColor color, PredeterminedEffectSpeed speed)
{
Color = color;
Speed = speed;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ namespace Exo.Lighting.Effects;

/// <summary>Represents an effect where colors of the rainbow will move in a wave.</summary>
[TypeId(0x712094B5, 0xC5B9, 0x4A2B, 0x96, 0x19, 0xE3, 0x3F, 0xB0, 0x49, 0xEE, 0x9F)]
public readonly struct VariableColorCycleEffect : ILightingEffect
public readonly struct VariableSpectrumCycleEffect : ILightingEffect
{
[DataMember(Order = 1)]
[Display(Name = "Speed")]
[Range(0, 5)]
[DefaultValue(3)]
public PredeterminedEffectSpeed Speed { get; }

public VariableColorCycleEffect(PredeterminedEffectSpeed speed)
public VariableSpectrumCycleEffect(PredeterminedEffectSpeed speed)
{
Speed = speed;
}
Expand Down
21 changes: 21 additions & 0 deletions Exo.Core/Lighting/Effects/VariableSpectrumWaveEffect.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
using System.Runtime.Serialization;

namespace Exo.Lighting.Effects;

/// <summary>Represents an effect where colors of the rainbow will move in a wave.</summary>
[TypeId(0xD11B8022, 0x2C92, 0x467A, 0xB8, 0x63, 0x9B, 0x70, 0x3D, 0x26, 0x5A, 0x70)]
public readonly struct VariableSpectrumWaveEffect : ILightingEffect
{
[DataMember(Order = 1)]
[Display(Name = "Speed")]
[Range(0, 5)]
[DefaultValue(3)]
public PredeterminedEffectSpeed Speed { get; }

public VariableSpectrumWaveEffect(PredeterminedEffectSpeed speed)
{
Speed = speed;
}
}
Loading

0 comments on commit bc09ee4

Please sign in to comment.