Commit 1cd9034d authored by Micha's avatar Micha

changes tool set and small namespace corrections

parent 266f81b7
......@@ -88,7 +88,7 @@ namespace MarmeLED
update();
}
public void setAnimation(animation _anim, int numberIterations, int speedPerCent)
public void setAnimation(Animation.animation _anim, int numberIterations, int speedPerCent)
{
// set sender
_anim.initMarmeLED(this, numberGlasses, LedPerGlass);
......
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
......@@ -11,6 +11,7 @@
<AssemblyName>MarmeLED</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
......@@ -20,6 +21,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
......@@ -28,6 +30,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
......
......@@ -6,147 +6,150 @@ using System.Threading.Tasks;
namespace MarmeLED
{
public abstract class animation
{
//public int numberIterations { get; set; }
public MarmeLED_v2 marmeLED { get; set; }
public abstract void Start();
public abstract void Run();
public abstract void Stop();
public int glassesAmount { get; set; }
public int ledsAmount { get; set; }
namespace Animation
{
public abstract class animation
{
//public int numberIterations { get; set; }
public MarmeLED_v2 marmeLED { get; set; }
public abstract void Start();
public abstract void Run();
public abstract void Stop();
public int glassesAmount { get; set; }
public int ledsAmount { get; set; }
public void initMarmeLED(MarmeLED_v2 marmeled, int numberOfGlasses, int ledsPerGlass)
{
marmeLED = marmeled;
glassesAmount = numberOfGlasses;
ledsAmount = ledsPerGlass;
}
public void initMarmeLED(MarmeLED_v2 marmeled, int numberOfGlasses, int ledsPerGlass)
{
marmeLED = marmeled;
glassesAmount = numberOfGlasses;
ledsAmount = ledsPerGlass;
}
}
}
public class waveLight : animation
{
private List<int> values_red;
private List<int> values_green;
private List<int> values_blue;
private byte base_red, base_green, base_blue;
public class waveLight : animation
{
private List<int> values_red;
private List<int> values_green;
private List<int> values_blue;
private byte base_red, base_green, base_blue;
public waveLight(byte red, byte green, byte blue)
//: base(marmeLed)
{
base_red = red;
base_blue = blue;
base_green = green;
values_red = new List<int>();
values_blue = new List<int>();
values_green = new List<int>();
}
public waveLight(byte red, byte green, byte blue)
//: base(marmeLed)
{
base_red = red;
base_blue = blue;
base_green = green;
values_red = new List<int>();
values_blue = new List<int>();
values_green = new List<int>();
}
public override void Start()
{
for (int i = 0; i < glassesAmount; i++)
{
//values.Add((int)(255 * Math.Sin(Math.PI / glassesAmount * i)));
// scale given color
values_red.Add((int)(base_red * Math.Sin(Math.PI / glassesAmount * i)));
values_green.Add((int)(base_green * Math.Sin(Math.PI / glassesAmount * i)));
values_blue.Add((int)(base_blue * Math.Sin(Math.PI / glassesAmount * i)));
marmeLED.switchAllOff();
}
}
public override void Start()
{
for (int i = 0; i < glassesAmount; i++)
{
//values.Add((int)(255 * Math.Sin(Math.PI / glassesAmount * i)));
// scale given color
values_red.Add((int)(base_red * Math.Sin(Math.PI / glassesAmount * i)));
values_green.Add((int)(base_green * Math.Sin(Math.PI / glassesAmount * i)));
values_blue.Add((int)(base_blue * Math.Sin(Math.PI / glassesAmount * i)));
marmeLED.switchAllOff();
}
}
public override void Run()
{
for (int i = 0; i < glassesAmount; i++)
{
marmeLED.setGlass(i, (byte)values_red[i], (byte)values_green[i], (byte)values_blue[i]);
}
marmeLED.update();
rollOne(ref values_red);
rollOne(ref values_green);
rollOne(ref values_blue);
}
public override void Run()
{
public override void Stop()
{
marmeLED.switchAllOff();
}
for (int i = 0; i < glassesAmount; i++)
{
marmeLED.setGlass(i, (byte)values_red[i], (byte)values_green[i], (byte)values_blue[i]);
}
marmeLED.update();
rollOne(ref values_red);
rollOne(ref values_green);
rollOne(ref values_blue);
}
private void rollOne(ref List<int> vals)
{
// get last element index
int lastIndex = vals.Count - 1;
// get last element
int last = vals[lastIndex];
// remove last element
vals.RemoveAt(lastIndex);
// add last element to front
vals.Insert(0, last);
}
}
public override void Stop()
{
marmeLED.switchAllOff();
}
public class rotate : animation
{
private List<int> values_red;
private List<int> values_green;
private List<int> values_blue;
private byte base_red, base_green, base_blue;
public rotate(byte red, byte green, byte blue)
//: base(marmeLed)
{
base_red = red;
base_blue = blue;
base_green = green;
values_red = new List<int>();
values_blue = new List<int>();
values_green = new List<int>();
}
private void rollOne(ref List<int> vals)
{
// get last element index
int lastIndex = vals.Count - 1;
// get last element
int last = vals[lastIndex];
// remove last element
vals.RemoveAt(lastIndex);
// add last element to front
vals.Insert(0, last);
}
}
public override void Start()
{
for (int i = 0; i < ledsAmount; i++)
{
//values.Add((int)(255 * Math.Sin(Math.PI / glassesAmount * i)));
// scale given color
values_red.Add((int)(base_red * Math.Sin(Math.PI / ledsAmount * i)));
values_green.Add((int)(base_green * Math.Sin(Math.PI / ledsAmount * i)));
values_blue.Add((int)(base_blue * Math.Sin(Math.PI / ledsAmount * i)));
marmeLED.switchAllOff();
}
}
public class rotate : animation
{
private List<int> values_red;
private List<int> values_green;
private List<int> values_blue;
private byte base_red, base_green, base_blue;
public rotate(byte red, byte green, byte blue)
//: base(marmeLed)
{
base_red = red;
base_blue = blue;
base_green = green;
values_red = new List<int>();
values_blue = new List<int>();
values_green = new List<int>();
}
public override void Run()
{
for (int i = 0; i < ledsAmount; i++)
{
for (int j = 0; j < glassesAmount; j++)
{
marmeLED.setLED(j, i, (byte)values_red[i], (byte)values_green[i], (byte)values_blue[i]);
}
}
marmeLED.update();
rollOne(ref values_red);
rollOne(ref values_green);
rollOne(ref values_blue);
}
public override void Start()
{
for (int i = 0; i < ledsAmount; i++)
{
//values.Add((int)(255 * Math.Sin(Math.PI / glassesAmount * i)));
// scale given color
values_red.Add((int)(base_red * Math.Sin(Math.PI / ledsAmount * i)));
values_green.Add((int)(base_green * Math.Sin(Math.PI / ledsAmount * i)));
values_blue.Add((int)(base_blue * Math.Sin(Math.PI / ledsAmount * i)));
marmeLED.switchAllOff();
}
}
public override void Stop()
{
marmeLED.switchAllOff();
}
public override void Run()
{
for (int i = 0; i < ledsAmount; i++)
{
for (int j = 0; j < glassesAmount; j++)
{
marmeLED.setLED(j, i, (byte)values_red[i], (byte)values_green[i], (byte)values_blue[i]);
}
}
marmeLED.update();
rollOne(ref values_red);
rollOne(ref values_green);
rollOne(ref values_blue);
}
private void rollOne(ref List<int> vals)
{
// get last element index
int lastIndex = vals.Count - 1;
// get last element
int last = vals[lastIndex];
// remove last element
vals.RemoveAt(lastIndex);
// add last element to front
vals.Insert(0, last);
}
}
}
public override void Stop()
{
marmeLED.switchAllOff();
}
private void rollOne(ref List<int> vals)
{
// get last element index
int lastIndex = vals.Count - 1;
// get last element
int last = vals[lastIndex];
// remove last element
vals.RemoveAt(lastIndex);
// add last element to front
vals.Insert(0, last);
}
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup>
</configuration>
\ No newline at end of file
</configuration>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
......@@ -7,10 +7,11 @@
<ProjectGuid>{E45020EB-A814-46E7-93D4-8318A63455CA}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MarmeLEDRevision</RootNamespace>
<RootNamespace>MarmeLEDExample</RootNamespace>
<AssemblyName>MarmeLEDRevision</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
......@@ -21,6 +22,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
......@@ -30,6 +32,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
......
......@@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MarmeLED;
using MarmeLED.Animation;
using System.Threading;
/*
......@@ -13,7 +14,7 @@ using System.Threading;
* On the other hand, all of this is completely free software and you are not just allowed but encouraged to improve this mess!
*/
namespace MarmeLEDRevision
namespace MarmeLEDExample
{
class Program
{
......
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup>
</configuration>
\ No newline at end of file
</configuration>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
......@@ -11,6 +11,7 @@
<AssemblyName>MarmeLEDSimu2</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
......@@ -21,6 +22,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
......@@ -30,6 +32,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
......@@ -63,6 +66,7 @@
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
......
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.18331
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------
namespace MarmeLEDSimu2.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MarmeLEDSimu2.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
namespace MarmeLEDSimu2.Properties {
using System;
/// <summary>
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
/// </summary>
// Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
// -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MarmeLEDSimu2.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
/// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.18331
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------
namespace MarmeLEDSimu2.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
namespace MarmeLEDSimu2.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}
......@@ -9,22 +9,14 @@ using System.Drawing.Design;
using MarmeLED.Utils.Text;
using System.Windows.Forms.Design;
internal class resfinder
{
// Trick from Bob Powell
}
/*
* This control comes from Bob Powell and is only ported to this application. Cheers go to him!
*/
namespace MarmeLED.UserControls.Buttons
{
/// <summary>
/// Determines the angle from which "light" shines
/// </summary>
struct Angle
{
public const float Up = 50F;
public const float Down = Angle.Up + 180F;
}
[Description("Round (Elliptical) Button Control"),
ToolboxBitmap(typeof(resfinder), "RoundButton.Images.RoundButton.bmp")]
public class RoundButton : System.Windows.Forms.Button
......@@ -619,6 +611,16 @@ namespace MarmeLED.UserControls.Buttons
}
#endregion Event Handlers
/// <summary>
/// Determines the angle from which "light" shines
/// </summary>
struct Angle
{
public const float Up = 50F;
public const float Down = Angle.Up + 180F;
}
}
#region RecessEditor
......@@ -662,4 +664,9 @@ namespace MarmeLED.UserControls.Buttons
#endregion
}
internal class resfinder
{
// Trick from Bob Powell
}
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment