1.0.4
This commit is contained in:
@@ -23,7 +23,7 @@ namespace VisionBuilder.UI.IOCommander.Windows
|
||||
InitializeCheckboxes();
|
||||
}
|
||||
|
||||
public BitArray PinState { get; set; } = new BitArray(20);
|
||||
public BitArray PinState { get; set; } = new BitArray(10);
|
||||
public event Action<int, bool>? OnPinChanged = delegate { };
|
||||
|
||||
public void SetPins(int pin, bool state)
|
||||
@@ -35,7 +35,7 @@ namespace VisionBuilder.UI.IOCommander.Windows
|
||||
{
|
||||
// Set form properties
|
||||
this.Text = "IO Commander Virtual Input";
|
||||
this.ClientSize = new Size(200, 500);
|
||||
this.ClientSize = new Size(200, 280);
|
||||
this.FormBorderStyle = FormBorderStyle.FixedDialog;
|
||||
this.MaximizeBox = false;
|
||||
this.StartPosition = FormStartPosition.Manual;
|
||||
@@ -50,11 +50,11 @@ namespace VisionBuilder.UI.IOCommander.Windows
|
||||
this.Controls.Add(panel);
|
||||
|
||||
// Initialize checkboxes
|
||||
_checkBoxes = new CheckBox[20];
|
||||
_checkBoxes = new CheckBox[10];
|
||||
|
||||
for (int i = 0; i < 20; i++)
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
int pinNumber = i; // Pins are 1-indexed
|
||||
int pinNumber = i + 1; // Pins are 1-indexed (1-10)
|
||||
_checkBoxes[i] = new CheckBox
|
||||
{
|
||||
Text = pinNumber.ToString(),
|
||||
@@ -77,8 +77,8 @@ namespace VisionBuilder.UI.IOCommander.Windows
|
||||
int pin = (int)checkBox.Tag;
|
||||
bool state = checkBox.Checked;
|
||||
|
||||
// Update the BitArray
|
||||
PinState.Set(pin, state); // Adjust for 0-based indexing in BitArray
|
||||
// Update the BitArray (convert 1-based pin to 0-based index)
|
||||
PinState.Set(pin - 1, state);
|
||||
|
||||
// Trigger the event
|
||||
OnPinChanged?.Invoke(pin, state);
|
||||
|
||||
Reference in New Issue
Block a user