Support for FC protocol for Danfoss-VLT2800 added - UI Part
This commit is contained in:
@@ -27,6 +27,9 @@ namespace TBF.BenchControl.Danfoss.VLT2800
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
protocolComboBox.Items.Add(PumpProtocol.Modbus.ToString());
|
||||
protocolComboBox.Items.Add(PumpProtocol.FC.ToString());
|
||||
|
||||
parityComboBox.Items.Add(Parity.None.ToString());
|
||||
parityComboBox.Items.Add(Parity.Even.ToString());
|
||||
parityComboBox.Items.Add(Parity.Odd.ToString());
|
||||
@@ -100,7 +103,8 @@ namespace TBF.BenchControl.Danfoss.VLT2800
|
||||
classNameLabel.Text = config.Factory.ClassName;
|
||||
nameTextBox.Text = config.Name;
|
||||
delayTextBox.Text = config.Delay.ToString();
|
||||
modbusAddressTextBox.Text = config.ModbusAddress.ToString();
|
||||
protocolComboBox.Text = config.Protocol.ToString();
|
||||
busAddressTextBox.Text = config.BusAddress.ToString();
|
||||
comPortNrTextBox.Text = config.ComPortNr.ToString();
|
||||
baudRateTextBox.Text = config.BaudRate.ToString();
|
||||
parityComboBox.Text = config.Parity.ToString();
|
||||
@@ -112,7 +116,8 @@ namespace TBF.BenchControl.Danfoss.VLT2800
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
delayTextBox.Enabled = true;
|
||||
modbusAddressTextBox.Enabled = true;
|
||||
protocolComboBox.Enabled = true;
|
||||
busAddressTextBox.Enabled = true;
|
||||
comPortNrTextBox.Enabled = true;
|
||||
baudRateTextBox.Enabled = true;
|
||||
parityComboBox.Enabled = true;
|
||||
@@ -128,7 +133,8 @@ namespace TBF.BenchControl.Danfoss.VLT2800
|
||||
|
||||
config.Name = nameTextBox.Text;
|
||||
config.Delay = int.Parse(delayTextBox.Text);
|
||||
config.ModbusAddress = int.Parse(modbusAddressTextBox.Text);
|
||||
config.Protocol = protocolComboBox.Text.Equals(PumpProtocol.Modbus.ToString()) ? PumpProtocol.Modbus : PumpProtocol.FC;
|
||||
config.BusAddress = int.Parse(busAddressTextBox.Text);
|
||||
config.ComPortNr = int.Parse(comPortNrTextBox.Text);
|
||||
config.BaudRate = int.Parse(baudRateTextBox.Text);
|
||||
config.Parity = GetParity(parityComboBox.SelectedItem.ToString());
|
||||
@@ -149,10 +155,16 @@ namespace TBF.BenchControl.Danfoss.VLT2800
|
||||
message += Environment.NewLine + "'Delay' is not valid";
|
||||
}
|
||||
|
||||
if (!int.TryParse(modbusAddressTextBox.Text, out dummy) || dummy < 1 || dummy > 247)
|
||||
if (!protocolComboBox.Items.Contains(protocolComboBox.Text))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Modbus Address' should be in range 1..247";
|
||||
message += Environment.NewLine + "'Protocol' should Modbus or FC";
|
||||
}
|
||||
|
||||
if (!int.TryParse(busAddressTextBox.Text, out dummy) || dummy < 1 || dummy > 247)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Bus Address' should be in range 1..247";
|
||||
}
|
||||
|
||||
if (!int.TryParse(comPortNrTextBox.Text, out dummy) || dummy < 1 || dummy > 999)
|
||||
|
||||
Reference in New Issue
Block a user