Diverter - preparation for calibration

This commit is contained in:
Milan Hanajik
2015-04-18 07:31:52 +02:00
parent 63b4004d85
commit 2b2cc0f6f8
5 changed files with 49 additions and 12 deletions
@@ -33,8 +33,8 @@ namespace TBF.BenchControl.Elde.Diverter
this.mask = (((ulong)1) << cfg.BitPosition); this.mask = (((ulong)1) << cfg.BitPosition);
/// Prepare data for SendCalibData() control board component method /// Prepare data for SendCalibData() control board component method
controlBoard.DiverterEdge[0] = (uint)diverterCfg.StartingEdge; controlBoard.DiverterEdge[0] = (uint)diverterCfg.StartingLevel;
controlBoard.DiverterEdge[1] = (uint)diverterCfg.StoppingEdge; controlBoard.DiverterEdge[1] = (uint)diverterCfg.StoppingLevel;
log.Debug(this.ToString()); log.Debug(this.ToString());
} }
@@ -17,8 +17,8 @@ namespace TBF.BenchControl.Elde.Diverter
/// Serialized parameters /// Serialized parameters
/// ///
public int BitPosition; /// 0..63 public int BitPosition; /// 0..63
public int StartingEdge; /// 0..100 in %, threshold for the ADC value to start the test public int StartingLevel; /// 0..100 in %, threshold for the ADC value to start the test
public int StoppingEdge; /// 0..100 in %, threshold for the ADC value to start the test public int StoppingLevel; /// 0..100 in %, threshold for the ADC value to start the test
/// Private parameterless constructor invoked by all other (public) constructors /// Private parameterless constructor invoked by all other (public) constructors
DiverterCfg() DiverterCfg()
@@ -26,8 +26,8 @@ namespace TBF.BenchControl.Elde.Diverter
Name = "Div"; Name = "Div";
ParentName = "CB"; ParentName = "CB";
BitPosition = 0; BitPosition = 0;
StartingEdge = 50; StartingLevel = 50;
StoppingEdge = 50; StoppingLevel = 50;
} }
public DiverterCfg(IComponentFactory factory) public DiverterCfg(IComponentFactory factory)
@@ -42,8 +42,8 @@ namespace TBF.BenchControl.Elde.Diverter
Name, Name,
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName), (string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
BitPosition, BitPosition,
StartingEdge, StartingLevel,
StoppingEdge); StoppingLevel);
} }
} }
} }
@@ -70,8 +70,8 @@ namespace TBF.BenchControl.Elde.Diverter
parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName; parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName;
nameTextBox.Text = config.Name; nameTextBox.Text = config.Name;
bitPositionTextBox.Text = config.BitPosition.ToString(); bitPositionTextBox.Text = config.BitPosition.ToString();
startingEdgeTextBox.Text = config.StartingEdge.ToString(); startingEdgeTextBox.Text = config.StartingLevel.ToString();
stoppingEdgeTextBox.Text = config.StoppingEdge.ToString(); stoppingEdgeTextBox.Text = config.StoppingLevel.ToString();
} }
public void Unlock() public void Unlock()
@@ -120,8 +120,8 @@ namespace TBF.BenchControl.Elde.Diverter
config.Name = nameTextBox.Text; config.Name = nameTextBox.Text;
config.ParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text; config.ParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
config.BitPosition = int.Parse(bitPositionTextBox.Text); config.BitPosition = int.Parse(bitPositionTextBox.Text);
config.StartingEdge = int.Parse(startingEdgeTextBox.Text); config.StartingLevel = int.Parse(startingEdgeTextBox.Text);
config.StoppingEdge = int.Parse(stoppingEdgeTextBox.Text); config.StoppingLevel = int.Parse(stoppingEdgeTextBox.Text);
return flags; return flags;
} }
@@ -0,0 +1,36 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using log4net;
namespace TBF.BenchControl.Elde.Diverter
{
static class Handlers
{
static readonly ILog log = LogManager.GetLogger(typeof(Handlers));
static Handlers()
{
}
/// <summary>
/// Called from the state machine when a procedure is selected and UI needs to be updated.
/// </summary>
public static void OnAdcChanged(object sender, CmdResponseArgs data)
{
if (AdcChangedHandler == null)
return;
try
{
AdcChangedHandler(sender, data);
}
catch (Exception e)
{
log.Error("AdcChangedHandler(...) failed", e);
}
}
public static event EventHandler<CmdResponseArgs> AdcChangedHandler;
}
}
+1
View File
@@ -156,6 +156,7 @@
<Compile Include="BenchControl\DataEntry\Standard\WMStatesForm.designer.cs"> <Compile Include="BenchControl\DataEntry\Standard\WMStatesForm.designer.cs">
<DependentUpon>WMStatesForm.cs</DependentUpon> <DependentUpon>WMStatesForm.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="BenchControl\Elde\Diverter\Handlers.cs" />
<Compile Include="PrintOrderDocument.cs"> <Compile Include="PrintOrderDocument.cs">
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>