Slash Interval settings

This commit is contained in:
Serge
2024-02-11 12:03:11 +01:00
parent ae298873ca
commit 1adec8b6c9
4 changed files with 61 additions and 26 deletions

View File

@@ -64,6 +64,8 @@ namespace GHelper.AnimeMatrix
int brightness = AppConfig.Get("matrix_brightness", 0); int brightness = AppConfig.Get("matrix_brightness", 0);
int running = AppConfig.Get("matrix_running", 0); int running = AppConfig.Get("matrix_running", 0);
int inteval = AppConfig.Get("matrix_interval", 0);
bool auto = AppConfig.Is("matrix_auto"); bool auto = AppConfig.Is("matrix_auto");
Task.Run(() => Task.Run(() =>
@@ -89,7 +91,7 @@ namespace GHelper.AnimeMatrix
{ {
deviceSlash.Init(); deviceSlash.Init();
deviceSlash.SetMode((SlashMode)running); deviceSlash.SetMode((SlashMode)running);
deviceSlash.SetOptions(true, (byte)(brightness * 85.333), 0); deviceSlash.SetOptions(true, brightness, inteval);
deviceSlash.Save(); deviceSlash.Save();
} }
}); });

View File

@@ -44,9 +44,10 @@ namespace GHelper.AnimeMatrix
Set(Packet<SlashPacket>(0xD3, 0x04, 0x00, 0x0C, 0x01, (mode == SlashMode.Bitstream) ? (byte)0x1D : (byte)0x1A, 0x02, 0x19, 0x03, 0x13, 0x04, 0x11, 0x05, 0x12, 0x06, 0x13)); Set(Packet<SlashPacket>(0xD3, 0x04, 0x00, 0x0C, 0x01, (mode == SlashMode.Bitstream) ? (byte)0x1D : (byte)0x1A, 0x02, 0x19, 0x03, 0x13, 0x04, 0x11, 0x05, 0x12, 0x06, 0x13));
} }
public void SetOptions(bool status, byte brightness = 0xFF, byte interval = 0x00) public void SetOptions(bool status, int brightness = 0, int interval = 0)
{ {
Set(Packet<SlashPacket>(0xD3, 0x03, 0x01, 0x08, 0xAB, 0xFF, 0x01, status ? (byte)0x01 : (byte)0x00, 0x06, brightness, 0xFF, interval)); byte brightnessByte = (byte)(brightness * 85.333);
Set(Packet<SlashPacket>(0xD3, 0x03, 0x01, 0x08, 0xAB, 0xFF, 0x01, status ? (byte)0x01 : (byte)0x00, 0x06, brightnessByte, 0xFF, (byte)interval));
Save(); Save();
} }

View File

@@ -65,6 +65,7 @@ namespace GHelper
panelGPU = new Panel(); panelGPU = new Panel();
labelTipGPU = new Label(); labelTipGPU = new Label();
tableAMD = new TableLayoutPanel(); tableAMD = new TableLayoutPanel();
buttonOverlay = new RButton();
buttonFPS = new RButton(); buttonFPS = new RButton();
tableGPU = new TableLayoutPanel(); tableGPU = new TableLayoutPanel();
buttonStopGPU = new RButton(); buttonStopGPU = new RButton();
@@ -118,7 +119,7 @@ namespace GHelper
panelAllyTitle = new Panel(); panelAllyTitle = new Panel();
pictureAlly = new PictureBox(); pictureAlly = new PictureBox();
labelAlly = new Label(); labelAlly = new Label();
buttonOverlay = new RButton(); comboInterval = new RComboBox();
panelMatrix.SuspendLayout(); panelMatrix.SuspendLayout();
tableLayoutMatrix.SuspendLayout(); tableLayoutMatrix.SuspendLayout();
panelMatrixTitle.SuspendLayout(); panelMatrixTitle.SuspendLayout();
@@ -187,14 +188,16 @@ namespace GHelper
tableLayoutMatrix.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F)); tableLayoutMatrix.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
tableLayoutMatrix.Controls.Add(comboMatrix, 0, 0); tableLayoutMatrix.Controls.Add(comboMatrix, 0, 0);
tableLayoutMatrix.Controls.Add(comboMatrixRunning, 1, 0); tableLayoutMatrix.Controls.Add(comboMatrixRunning, 1, 0);
tableLayoutMatrix.Controls.Add(comboInterval, 2, 0);
tableLayoutMatrix.Controls.Add(buttonMatrix, 2, 0); tableLayoutMatrix.Controls.Add(buttonMatrix, 2, 0);
tableLayoutMatrix.Dock = DockStyle.Top; tableLayoutMatrix.Dock = DockStyle.Top;
tableLayoutMatrix.Location = new Point(20, 60); tableLayoutMatrix.Location = new Point(20, 60);
tableLayoutMatrix.Margin = new Padding(8); tableLayoutMatrix.Margin = new Padding(8);
tableLayoutMatrix.Name = "tableLayoutMatrix"; tableLayoutMatrix.Name = "tableLayoutMatrix";
tableLayoutMatrix.RowCount = 1; tableLayoutMatrix.RowCount = 2;
tableLayoutMatrix.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); tableLayoutMatrix.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
tableLayoutMatrix.Size = new Size(787, 64); tableLayoutMatrix.RowStyles.Add(new RowStyle(SizeType.Absolute, 20F));
tableLayoutMatrix.Size = new Size(787, 84);
tableLayoutMatrix.TabIndex = 43; tableLayoutMatrix.TabIndex = 43;
// //
// comboMatrix // comboMatrix
@@ -707,6 +710,28 @@ namespace GHelper
tableAMD.TabIndex = 24; tableAMD.TabIndex = 24;
tableAMD.Visible = false; tableAMD.Visible = false;
// //
// buttonOverlay
//
buttonOverlay.Activated = false;
buttonOverlay.BackColor = SystemColors.ControlLightLight;
buttonOverlay.BorderColor = Color.Transparent;
buttonOverlay.BorderRadius = 5;
buttonOverlay.Dock = DockStyle.Fill;
buttonOverlay.FlatAppearance.BorderSize = 0;
buttonOverlay.FlatStyle = FlatStyle.Flat;
buttonOverlay.ForeColor = SystemColors.ControlText;
buttonOverlay.Image = Properties.Resources.icons8_heartbeat_32;
buttonOverlay.ImageAlign = ContentAlignment.MiddleRight;
buttonOverlay.Location = new Point(266, 4);
buttonOverlay.Margin = new Padding(4);
buttonOverlay.Name = "buttonOverlay";
buttonOverlay.Secondary = false;
buttonOverlay.Size = new Size(254, 72);
buttonOverlay.TabIndex = 12;
buttonOverlay.Text = "AMD Overlay";
buttonOverlay.TextImageRelation = TextImageRelation.ImageBeforeText;
buttonOverlay.UseVisualStyleBackColor = false;
//
// buttonFPS // buttonFPS
// //
buttonFPS.Activated = false; buttonFPS.Activated = false;
@@ -1586,27 +1611,20 @@ namespace GHelper
labelAlly.TabIndex = 26; labelAlly.TabIndex = 26;
labelAlly.Text = "Ally Controller"; labelAlly.Text = "Ally Controller";
// //
// buttonOverlay // comboInterval
// //
buttonOverlay.Activated = false; comboInterval.BorderColor = Color.White;
buttonOverlay.BackColor = SystemColors.ControlLightLight; comboInterval.ButtonColor = Color.FromArgb(255, 255, 255);
buttonOverlay.BorderColor = Color.Transparent; comboInterval.Dock = DockStyle.Top;
buttonOverlay.BorderRadius = 5; comboInterval.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
buttonOverlay.Dock = DockStyle.Fill; comboInterval.FormattingEnabled = true;
buttonOverlay.FlatAppearance.BorderSize = 0; comboInterval.ItemHeight = 32;
buttonOverlay.FlatStyle = FlatStyle.Flat; comboInterval.Location = new Point(7, 75);
buttonOverlay.ForeColor = SystemColors.ControlText; comboInterval.Margin = new Padding(7, 11, 7, 8);
buttonOverlay.Image = Properties.Resources.icons8_heartbeat_32; comboInterval.Name = "comboInterval";
buttonOverlay.ImageAlign = ContentAlignment.MiddleRight; comboInterval.Size = new Size(248, 40);
buttonOverlay.Location = new Point(266, 4); comboInterval.TabIndex = 19;
buttonOverlay.Margin = new Padding(4); comboInterval.Visible = false;
buttonOverlay.Name = "buttonOverlay";
buttonOverlay.Secondary = false;
buttonOverlay.Size = new Size(254, 72);
buttonOverlay.TabIndex = 12;
buttonOverlay.Text = "AMD Overlay";
buttonOverlay.TextImageRelation = TextImageRelation.ImageBeforeText;
buttonOverlay.UseVisualStyleBackColor = false;
// //
// SettingsForm // SettingsForm
// //
@@ -1784,5 +1802,6 @@ namespace GHelper
private RButton buttonFPS; private RButton buttonFPS;
private RButton buttonController; private RButton buttonController;
private RButton buttonOverlay; private RButton buttonOverlay;
private RComboBox comboInterval;
} }
} }

View File

@@ -173,9 +173,11 @@ namespace GHelper
comboMatrix.DropDownStyle = ComboBoxStyle.DropDownList; comboMatrix.DropDownStyle = ComboBoxStyle.DropDownList;
comboMatrixRunning.DropDownStyle = ComboBoxStyle.DropDownList; comboMatrixRunning.DropDownStyle = ComboBoxStyle.DropDownList;
comboInterval.DropDownStyle = ComboBoxStyle.DropDownList;
comboMatrix.DropDownClosed += ComboMatrix_SelectedValueChanged; comboMatrix.DropDownClosed += ComboMatrix_SelectedValueChanged;
comboMatrixRunning.DropDownClosed += ComboMatrixRunning_SelectedValueChanged; comboMatrixRunning.DropDownClosed += ComboMatrixRunning_SelectedValueChanged;
comboInterval.DropDownClosed += ComboInterval_DropDownClosed;
buttonMatrix.Click += ButtonMatrix_Click; buttonMatrix.Click += ButtonMatrix_Click;
@@ -721,6 +723,12 @@ namespace GHelper
}); });
} }
private void ComboInterval_DropDownClosed(object? sender, EventArgs e)
{
AppConfig.Set("matrix_interval", comboInterval.SelectedIndex);
matrixControl.SetDevice();
}
private void ComboMatrixRunning_SelectedValueChanged(object? sender, EventArgs e) private void ComboMatrixRunning_SelectedValueChanged(object? sender, EventArgs e)
{ {
AppConfig.Set("matrix_running", comboMatrixRunning.SelectedIndex); AppConfig.Set("matrix_running", comboMatrixRunning.SelectedIndex);
@@ -902,11 +910,16 @@ namespace GHelper
comboMatrixRunning.Items.Clear(); comboMatrixRunning.Items.Clear();
comboMatrixRunning.Items.Add("Transmission"); comboMatrixRunning.Items.Add("Transmission");
comboMatrixRunning.Items.Add("Bitstream"); comboMatrixRunning.Items.Add("Bitstream");
comboInterval.Visible = true;
for (int i = 0; i <= 5; i++) comboInterval.Items.Add($"Interval {i}s");
buttonMatrix.Visible = false; buttonMatrix.Visible = false;
} }
comboMatrix.SelectedIndex = Math.Min(AppConfig.Get("matrix_brightness", 0), comboMatrix.Items.Count - 1); comboMatrix.SelectedIndex = Math.Min(AppConfig.Get("matrix_brightness", 0), comboMatrix.Items.Count - 1);
comboMatrixRunning.SelectedIndex = Math.Min(AppConfig.Get("matrix_running", 0), comboMatrixRunning.Items.Count - 1); comboMatrixRunning.SelectedIndex = Math.Min(AppConfig.Get("matrix_running", 0), comboMatrixRunning.Items.Count - 1);
comboInterval.SelectedIndex = Math.Min(AppConfig.Get("matrix_interval", 0), comboInterval.Items.Count - 1);
checkMatrix.Checked = AppConfig.Is("matrix_auto"); checkMatrix.Checked = AppConfig.Is("matrix_auto");
checkMatrix.CheckedChanged += CheckMatrix_CheckedChanged; checkMatrix.CheckedChanged += CheckMatrix_CheckedChanged;