Skip to content

Commit fdcc610

Browse files
moved to test checkbox instead of button
1 parent 973927a commit fdcc610

3 files changed

Lines changed: 40 additions & 31 deletions

File tree

ColorlightPlugin.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ private Packet BuildPixelPacket(MacAddress source, MacAddress destination, int r
336336
/// <summary>
337337
/// This function builds the Ethernet Row Data Packet with every third channel set to a color.
338338
/// </summary>
339-
private Packet BuildTestPacket(MacAddress source, MacAddress destination, int row, int pixelsWidth,int dataOffset, byte color)
339+
private Packet BuildTestPacket(MacAddress source, MacAddress destination, int row, int pixelsWidth, int dataOffset, byte color, int testOffset)
340340
{
341341
int offset = 0;
342342
int width = pixelsWidth * 3;
@@ -375,7 +375,7 @@ private Packet BuildTestPacket(MacAddress source, MacAddress destination, int ro
375375
{
376376
int indexwHead = 7 + i;
377377
byte oldValue = 0;
378-
if(i%3==0)
378+
if( i % 3 == testOffset)
379379
oldValue = color;
380380
//int oldint = Convert.ToInt32(data[i + (fullDataOffset * 3)]);
381381
int newint = ((oldValue * _brightness) / 100);
@@ -398,7 +398,7 @@ private Packet BuildTestPacket(MacAddress source, MacAddress destination, int ro
398398
/// <summary>
399399
/// This function sets the panel to a color.
400400
/// </summary>
401-
public void TestPanel(byte color)
401+
public void TestPanel(byte color, int testOffset)
402402
{
403403
try
404404
{
@@ -433,7 +433,7 @@ public void TestPanel(byte color)
433433
for (int i = 0; i < pixelHeight; i++)
434434
{
435435
int offset = pixelWidth * i;
436-
communicator.SendPacket(BuildTestPacket(source, destination, i, pixelWidth, offset, color));
436+
communicator.SendPacket(BuildTestPacket(source, destination, i, pixelWidth, offset, color, testOffset));
437437
}
438438
}
439439
}

StatusForm.Designer.cs

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

StatusForm.cs

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ public partial class StatusForm : Form
1818

1919
public event EventHandler ReloadSettings;
2020

21+
int testCount = 0;
22+
2123
public StatusForm(ColorlightPlugin plugin)
2224
{
2325
_plugin = plugin;
@@ -122,21 +124,28 @@ private void SetStatusBox()
122124
(_plugin._panelHeight * _plugin._panelWidth * 3));
123125
}
124126

125-
private void buttonTest_Click(object sender, EventArgs e)
126-
{
127-
listBox1.Items.Add("Sending Test Color");
128-
_plugin.TestPanel(0xFF);
129-
}
130-
131127
private void timer1_Tick(object sender, EventArgs e)
132128
{
133-
string result;
134-
_plugin.xSchedule_Action("GetPlayingStatus", "", "", out result);
135-
//listBox1.Items.Add(result.ToString());
136-
if (result.Contains("\"status\":\"idle\""))
129+
if (checkBoxTest.Checked)
137130
{
138-
_plugin.TestPanel(0x00);
131+
if (testCount > 2) testCount = 0;
132+
_plugin.TestPanel(0xFF, testCount);
133+
++testCount;
139134
}
135+
else
136+
{
137+
string result;
138+
_plugin.xSchedule_Action("GetPlayingStatus", "", "", out result);
139+
//listBox1.Items.Add(result.ToString());
140+
if (result.Contains("\"status\":\"idle\""))
141+
{
142+
_plugin.TestPanel(0x00, 0);
143+
}
144+
}
145+
}
146+
147+
private void checkBoxTest_CheckedChanged(object sender, EventArgs e)
148+
{
140149

141150
}
142151
}

0 commit comments

Comments
 (0)