Mettler-Toledo Multi protocol change as in v.2.0.195 (Badger), Immediate meas. works, TODO: stable meas.
This commit is contained in:
@@ -13,6 +13,7 @@ namespace TBF.BenchControl.MettlerToledo.Multi
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(ReadMassOp));
|
||||
public override string ToString() { return string.Format("ReadMassOp(.,.)"); }
|
||||
|
||||
bool started;
|
||||
bool done;
|
||||
|
||||
/// Set by the constructor
|
||||
@@ -38,7 +39,9 @@ namespace TBF.BenchControl.MettlerToledo.Multi
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
started = false;
|
||||
done = false;
|
||||
started = BalanceDev.GetImmediateMassMeasurement(balanceDev.IdNr, balanceDev.Name);
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
@@ -49,16 +52,21 @@ namespace TBF.BenchControl.MettlerToledo.Multi
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
if (balanceDev.MsrmntState == MsrmntState.Valid)
|
||||
if (!started)
|
||||
{
|
||||
started = BalanceDev.GetImmediateMassMeasurement(balanceDev.IdNr, balanceDev.Name);
|
||||
return Event.Busy;
|
||||
}
|
||||
else if (done)
|
||||
{
|
||||
return Event.BalanceDone; /// Mass has already been read (at least once)
|
||||
}
|
||||
else if (balanceDev.MsrmntState == MsrmntState.Valid)
|
||||
{
|
||||
result.Val = balanceDev.Mass;
|
||||
done = true;
|
||||
log.InfoFormat("ReadMassOp.Run() ... mass={0} ... returning Event.BalanceDone", balanceDev.Mass);
|
||||
return Event.BalanceDone; /// Mass read OK
|
||||
}
|
||||
else if (done)
|
||||
{
|
||||
return Event.BalanceDone; /// Mass has already been read (at least once)
|
||||
done = true;
|
||||
return Event.BalanceDone; /// Mass read OK
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user