MettlerToledo.Standard : Timeout in ReadMassOp and ReadStableMassOp, ver. 2.18.892

This commit is contained in:
Milan Hanajik
2018-05-14 10:41:03 +02:00
parent d6881bfdf3
commit 67a762e51c
5 changed files with 67 additions and 31 deletions
@@ -51,6 +51,8 @@ namespace TBF.BenchControl.MettlerToledo.Standard
/// </returns>
public Event Run()
{
scale.MsrmntTime++;
if (!started)
{
scale.GetImmediateMassMeasurement();
@@ -58,19 +60,31 @@ namespace TBF.BenchControl.MettlerToledo.Standard
done = false;
return Event.Busy;
}
else if (started && scale.MsrmntState != MsrmntState.Busy)
{
if (scale.MsrmntState == MsrmntState.Valid) result.Val = scale.Mass;
log.InfoFormat("ReadMassOp.Run() ... state={0}, mass={1} ... returning Event.BalanceDone",
scale.MsrmntState, scale.Mass);
done = true;
started = false;
return Event.BalanceDone; /// Mass read OK
}
else
{
return Event.Busy;
}
else if (started && scale.MsrmntState == MsrmntState.Busy)
{
/// Measurement is in progress
if (scale.MsrmntTime >= 2)
{
/// Timeout - no response from the scale within 2 seconds - send command again
scale.GetImmediateMassMeasurement();
started = true;
done = false;
}
return Event.Busy;
}
else
{
/// Measurement completed or failed: (started == true) && (scale.MsrmntState != MsrmntState.Busy)
if (scale.MsrmntState == MsrmntState.Valid) result.Val = scale.Mass;
log.InfoFormat("ReadMassOp.Run() ... state={0}, mass={1} ... returning Event.BalanceDone",
scale.MsrmntState, scale.Mass);
done = true;
started = false;
return Event.BalanceDone; /// Mass read OK
}
}
/// <summary>Stop this operation</summary>