MettlerToledo.Standard : Timeout in ReadMassOp and ReadStableMassOp, ver. 2.18.892
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user