Danfoss-VLT2800-Pump functions OK, TODO: control the valve of the pump

This commit is contained in:
Milan Hanajik
2015-02-16 21:01:37 +01:00
parent 50cd1c5d4f
commit 2ca36374e6
5 changed files with 438 additions and 193 deletions
@@ -35,10 +35,6 @@ namespace TBF.BenchControl.Danfoss.VLT2800
stopBitsComboBox.Items.Add(StopBits.One.ToString());
stopBitsComboBox.Items.Add(StopBits.OnePointFive.ToString());
stopBitsComboBox.Items.Add(StopBits.Two.ToString());
handshakeComboBox.Items.Add(Handshake.None.ToString());
handshakeComboBox.Items.Add(Handshake.RequestToSend.ToString());
handshakeComboBox.Items.Add(Handshake.XOnXOff.ToString());
}
int GetParityIx(Parity par)
@@ -103,23 +99,25 @@ namespace TBF.BenchControl.Danfoss.VLT2800
classNameLabel.Text = config.Factory.ClassName;
nameTextBox.Text = config.Name;
delayTextBox.Text = config.Delay.ToString();
modbusAddressTextBox.Text = config.ModbusAddress.ToString();
comPortNrTextBox.Text = config.ComPortNr.ToString();
baudRateTextBox.Text = config.BaudRate.ToString();
parityComboBox.Text = config.Parity.ToString();
dataBitsTextBox.Text = config.DataBits.ToString();
stopBitsComboBox.Text = config.StopBits.ToString();
handshakeComboBox.Text = config.Handshake.ToString();
}
public void Unlock()
{
nameTextBox.Enabled = true;
delayTextBox.Enabled = true;
modbusAddressTextBox.Enabled = true;
comPortNrTextBox.Enabled = true;
baudRateTextBox.Enabled = true;
parityComboBox.Enabled = true;
dataBitsTextBox.Enabled = true;
stopBitsComboBox.Enabled = true;
handshakeComboBox.Enabled = true;
}
public CfgUpdateFlags UpdateCfg()
@@ -129,12 +127,13 @@ namespace TBF.BenchControl.Danfoss.VLT2800
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
config.Name = nameTextBox.Text;
config.Delay = int.Parse(delayTextBox.Text);
config.ModbusAddress = int.Parse(modbusAddressTextBox.Text);
config.ComPortNr = int.Parse(comPortNrTextBox.Text);
config.BaudRate = int.Parse(baudRateTextBox.Text);
config.Parity = GetParity(parityComboBox.SelectedItem.ToString());
config.DataBits = int.Parse(dataBitsTextBox.Text);
config.StopBits = GetStopBits(stopBitsComboBox.SelectedItem.ToString());
config.Handshake = GetHandshake(handshakeComboBox.SelectedItem.ToString());
return flags;
}
@@ -144,6 +143,18 @@ namespace TBF.BenchControl.Danfoss.VLT2800
CfgUpdateFlags flags = CfgUpdateFlags.None;
int dummy;
if (!int.TryParse(delayTextBox.Text, out dummy) || dummy < 0 || dummy > 300)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Delay' is not valid";
}
if (!int.TryParse(modbusAddressTextBox.Text, out dummy) || dummy < 1 || dummy > 247)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Modbus Address' should be in range 1..247";
}
if (!int.TryParse(comPortNrTextBox.Text, out dummy) || dummy < 1 || dummy > 999)
{
flags |= CfgUpdateFlags.Error;