Skip to content

Commit

Permalink
Remove support for looping animations
Browse files Browse the repository at this point in the history
Looping animations have had breaking
firmware changes, so just remove
support for it, because I don't have a
good way to deal with firmware breaking
changes right now.
  • Loading branch information
ChadNedzlek committed Feb 5, 2024
1 parent ba5d530 commit 39a04f9
Show file tree
Hide file tree
Showing 11 changed files with 9 additions and 24 deletions.
4 changes: 2 additions & 2 deletions CmdLine/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public static async Task Main(string[] args)
$"Connected to die {die.PixelId} (color:{die.Colorway}, type:{die.Type}, firmware:{die.BuildTimestamp.ToLocalTime()}");

await die.SendInstantAnimations(animations);
die.PlayInstantAnimation(2, 1, 1);
die.PlayInstantAnimation(2, 1);
}

Console.WriteLine($"Found {found.Count} dice!");
Expand Down Expand Up @@ -131,7 +131,7 @@ private static AnimationCollection BuildAnimationCollection()

private static SimpleAnimation BuildSimpleAnimation(Color color)
{
return new SimpleAnimation(TimeSpan.FromMilliseconds(50), 1, color, 1, 0);
return new SimpleAnimation(TimeSpan.FromSeconds(2), 1, color, 1, 0);
}

private static NoiseAnimation BuildNoiseAnimation()
Expand Down
5 changes: 2 additions & 3 deletions VaettirNet.PixelsDice.Net/Animations/Animation.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System;
using VaettirNet.PixelsDice.Net.Animations.Protocol.AnimationData;

namespace VaettirNet.PixelsDice.Net.Animations;
Expand All @@ -21,9 +20,9 @@ internal CombinedAnimationData ToProtocol(GlobalAnimationData data)
return ToProtocol(
new SharedAnimationData
{
Duration = (ushort)DurationMs,
Type = Type,
Flags = Flags
Flags = Flags,
Duration = (ushort)DurationMs,
},
data);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Diagnostics.Metrics;
using System.Drawing;
using VaettirNet.PixelsDice.Net.Animations.Protocol.AnimationData;

Expand Down
7 changes: 5 additions & 2 deletions VaettirNet.PixelsDice.Net/PixelsDie.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,13 @@ await SendAndWaitForAck<BulkSetupMessage, GenericMessage>(
await finishAck;
}

public void PlayInstantAnimation(int index, int loopCount, byte faceIndex)
public void PlayInstantAnimation(int index, byte faceIndex)
{
// BUG: "loopCount" is recent, before that, it's a boolean, so we can't set it to anything
// without checking the firmware version and having lots of versions of the messages
// For now, no looping.
_ble.SendMessage(new PlayInstantAnimationMessage
{ Animation = (byte)index, LoopCount = (byte)2, FaceIndex = faceIndex });
{ Animation = (byte)index, LoopCount = (byte)0, FaceIndex = faceIndex });
}

public void StopAllAnimations()
Expand Down
1 change: 0 additions & 1 deletion VaettirNet.PixelsDice.Net/VaettirNet.PixelsDice.Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<PropertyGroup>
<RootNamespace>VaettirNet.PixelsDice.Net</RootNamespace>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

<Description>Cross-platform library for interacting with Pixels dice from .NET, using SimpleBle</Description>
<Copyright>Chad Nedzlek 2024</Copyright>
<Authors>Chad Nedzlek</Authors>
Expand Down
1 change: 0 additions & 1 deletion WpfUIDice/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.IO;
using System.Linq;
Expand Down
1 change: 0 additions & 1 deletion WpfUIDice/ConnectPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
Expand Down
1 change: 0 additions & 1 deletion WpfUIDice/DiceCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Windows;
using VaettirNet.PixelsDice.Net;
Expand Down
1 change: 0 additions & 1 deletion WpfUIDice/DieView.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows;
Expand Down
2 changes: 0 additions & 2 deletions WpfUIDice/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
Expand Down
9 changes: 0 additions & 9 deletions WpfUIDice/ProxyPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using VaettirNet.PixelsDice.Net;
using DataGrid = Wpf.Ui.Controls.DataGrid;

namespace WpfUIDice;

Expand Down

0 comments on commit 39a04f9

Please sign in to comment.