Skip to content

Commit 8b1a0bc

Browse files
committed
Merge branch 'develop'
2 parents 5f2e839 + b4f7a5e commit 8b1a0bc

File tree

12 files changed

+49
-22
lines changed

12 files changed

+49
-22
lines changed

Assets/logo-512.png

11.1 KB
Loading

Assets/logo.ico

-2.41 KB
Binary file not shown.

Build/Build.cs

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using System.Collections.Generic;
23
using System.Diagnostics;
34
using System.IO;
@@ -38,6 +39,24 @@ class Build : NukeBuild
3839

3940
AbsolutePath ServiceBinPath => SourceDirectory / "TTController.Service" / "bin" / Configuration;
4041

42+
protected override void OnBuildFinished()
43+
{
44+
if (string.Compare(InvokedTargets.Last().Name, "Run", true) != 0)
45+
return;
46+
47+
Console.Out.Flush();
48+
Console.Clear();
49+
50+
var process = Process.Start(new ProcessStartInfo()
51+
{
52+
FileName = ServiceBinPath / "TTController.Service.exe",
53+
WorkingDirectory = ServiceBinPath,
54+
UseShellExecute = false
55+
});
56+
57+
process.WaitForExit();
58+
}
59+
4160
Target Clean => _ => _
4261
.Before(Restore)
4362
.Executes(() =>
@@ -93,15 +112,7 @@ class Build : NukeBuild
93112
});
94113

95114
Target Run => _ => _
96-
.DependsOn(Compile)
97-
.Executes(() =>
98-
{
99-
Process.Start(new ProcessStartInfo()
100-
{
101-
FileName = ServiceBinPath / "TTController.Service.exe",
102-
UseShellExecute = true
103-
});
104-
});
115+
.DependsOn(Compile);
105116

106117
Target Pack => _ => _
107118
.DependsOn(Clean)

Plugins/Effects/TTController.Plugin.RippleEffect/RippleEffect.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public override IDictionary<PortIdentifier, List<LedColor>> GenerateColors(List<
4949
for (var i = 0; i < length; i++)
5050
{
5151
var idx = Wrap(_rotation - i, config.LedCount);
52-
colors[idx] = LedColor.FromHsv(hue, saturation, value - (double)i / length);
52+
colors[idx] = LedColor.FromHsv(hue, saturation, value * (length - i) / length);
5353
}
5454

5555
result.Add(port, colors);

Plugins/SpeedControllers/TTController.Plugin.PwmSpeedController/TTController.Plugin.PwmSpeedController.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
99
</PropertyGroup>
1010
<ItemGroup>
11-
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
11+
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
1212
</ItemGroup>
1313
<ItemGroup>
1414
<ProjectReference Include="..\..\..\Source\TTController.Common\TTController.Common.csproj" />

Source/TTController.Service/Controller/Definition/DpsgControllerDefinition.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace TTController.Service.Controller.Definition
66
{
77
public class DpsgControllerDefinition : IControllerDefinition
88
{
9-
public string Name => "Dpsg Controller";
9+
public string Name => "Dpsg";
1010
public int VendorId => 0x264a;
1111
public IEnumerable<int> ProductIds { get { yield return 0x2329; } }
1212
public int PortCount => 0;

Source/TTController.Service/Controller/Definition/RiingControllerDefinition.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace TTController.Service.Controller.Definition
77
{
88
public class RiingControllerDefinition : IControllerDefinition
99
{
10-
public string Name => "Riing Controller";
10+
public string Name => "Riing";
1111
public int VendorId => 0x264a;
1212
public IEnumerable<int> ProductIds => Enumerable.Range(0, 16).Select(x => 0x1f41 + x);
1313
public int PortCount => 5;

Source/TTController.Service/Controller/Definition/RiingPlusControllerDefinition.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace TTController.Service.Controller.Definition
77
{
88
public class RiingPlusControllerDefinition : IControllerDefinition
99
{
10-
public string Name => "Riing Plus Controller";
10+
public string Name => "Riing Plus";
1111
public int VendorId => 0x264a;
1212
public IEnumerable<int> ProductIds => Enumerable.Range(0, 16).Select(x => 0x1fa5 + x);
1313
public int PortCount => 5;

Source/TTController.Service/Controller/Definition/RiingTrioControllerDefinition.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace TTController.Service.Controller.Definition
77
{
88
public class RiingTrioControllerDefinition : IControllerDefinition
99
{
10-
public string Name => "Riing Trio Controller";
10+
public string Name => "Riing Trio";
1111
public int VendorId => 0x264a;
1212
public IEnumerable<int> ProductIds => Enumerable.Range(0, 16).Select(x => 0x2135 + x);
1313
public int PortCount => 5;

Source/TTController.Service/Hardware/HidDeviceProxy.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,19 @@ public bool WriteBytes(params byte[] bytes)
3030

3131
Logger.Trace("W[{vid}, {pid}] {data}", _device.Attributes.VendorId, _device.Attributes.ProductId, data);
3232

33-
return _device.Write(data);
33+
return _device.Write(data, 1000);
3434
}
3535

3636
public bool WriteBytes(IEnumerable<byte> bytes) =>
3737
WriteBytes(bytes.ToArray());
3838

3939
public byte[] ReadBytes()
4040
{
41-
var data = _device.Read();
42-
if (data.Status != HidDeviceData.ReadStatus.Success)
41+
var data = _device.Read(1000);
42+
if (data.Status != HidDeviceData.ReadStatus.Success) {
43+
Logger.Warn("Read from [{0}, {1}] failed with status \"{2}\"!", _device.Attributes.VendorId, _device.Attributes.ProductId, data.Status);
4344
return null;
45+
}
4446

4547
Logger.Trace("R[{vid}, {pid}] {data}", _device.Attributes.VendorId, _device.Attributes.ProductId, data.Data);
4648

0 commit comments

Comments
 (0)