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

View File

@ -33,8 +33,8 @@ namespace TBF.BenchControl.Elde.Diverter
this.mask = (((ulong)1) << cfg.BitPosition);
/// Prepare data for SendCalibData() control board component method
controlBoard.DiverterEdge[0] = (uint)diverterCfg.StartingEdge;
controlBoard.DiverterEdge[1] = (uint)diverterCfg.StoppingEdge;
controlBoard.DiverterEdge[0] = (uint)diverterCfg.StartingLevel;
controlBoard.DiverterEdge[1] = (uint)diverterCfg.StoppingLevel;
log.Debug(this.ToString());
}

View File

@ -17,8 +17,8 @@ namespace TBF.BenchControl.Elde.Diverter
/// Serialized parameters
///
public int BitPosition; /// 0..63
public int StartingEdge; /// 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 StartingLevel; /// 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
DiverterCfg()
@ -26,8 +26,8 @@ namespace TBF.BenchControl.Elde.Diverter
Name = "Div";
ParentName = "CB";
BitPosition = 0;
StartingEdge = 50;
StoppingEdge = 50;
StartingLevel = 50;
StoppingLevel = 50;
}
public DiverterCfg(IComponentFactory factory)
@ -42,8 +42,8 @@ namespace TBF.BenchControl.Elde.Diverter
Name,
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
BitPosition,
StartingEdge,
StoppingEdge);
StartingLevel,
StoppingLevel);
}
}
}

View File

@ -70,8 +70,8 @@ namespace TBF.BenchControl.Elde.Diverter
parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName;
nameTextBox.Text = config.Name;
bitPositionTextBox.Text = config.BitPosition.ToString();
startingEdgeTextBox.Text = config.StartingEdge.ToString();
stoppingEdgeTextBox.Text = config.StoppingEdge.ToString();
startingEdgeTextBox.Text = config.StartingLevel.ToString();
stoppingEdgeTextBox.Text = config.StoppingLevel.ToString();
}
public void Unlock()
@ -120,8 +120,8 @@ namespace TBF.BenchControl.Elde.Diverter
config.Name = nameTextBox.Text;
config.ParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
config.BitPosition = int.Parse(bitPositionTextBox.Text);
config.StartingEdge = int.Parse(startingEdgeTextBox.Text);
config.StoppingEdge = int.Parse(stoppingEdgeTextBox.Text);
config.StartingLevel = int.Parse(startingEdgeTextBox.Text);
config.StoppingLevel = int.Parse(stoppingEdgeTextBox.Text);
return flags;
}

View File

@ -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;
}
}

View File

@ -156,6 +156,7 @@
<Compile Include="BenchControl\DataEntry\Standard\WMStatesForm.designer.cs">
<DependentUpon>WMStatesForm.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\Elde\Diverter\Handlers.cs" />
<Compile Include="PrintOrderDocument.cs">
<SubType>Component</SubType>
</Compile>