MettlerToledo minor corrections, cleanup
This commit is contained in:
@@ -58,9 +58,17 @@ namespace TBF.BenchControl.MettlerToledo.Multi
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
if (IdNr == 1)
|
||||
{
|
||||
return string.Format("Name={0}, Id#={1}, {2}kg, empty={3}kg, fmt.={4}, emptyTm={5}s, Com{6}, {7}Bd, {8}-bits, parity={9}, stopBits={10}, {11}",
|
||||
Name, IdNr, Capacity, Empty, Format, EmptyTimeSec, ComPortNr, BaudRate, DataBits, Parity, StopBits, Handshake);
|
||||
}
|
||||
else
|
||||
{
|
||||
return string.Format("Name={0}, Id#={1}, {2}kg, empty={3}kg, fmt.={4}, emptyTm={5}s",
|
||||
Name, IdNr, Capacity, Empty, Format, EmptyTimeSec);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace TBF.BenchControl.MettlerToledo.Multi
|
||||
/// Warn: Start measurement when busy is true
|
||||
/// </summary>
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(BalanceDev));
|
||||
public override string ToString() { return string.Format("MettlerToledo.Balance({0})", Cfg.ToString(1)); }
|
||||
public override string ToString() { return string.Format("MettlerToledo.Multi.Balance({0})", Cfg.ToString(1)); }
|
||||
|
||||
protected readonly BalanceCfg balanceCfg;
|
||||
|
||||
@@ -186,44 +186,6 @@ namespace TBF.BenchControl.MettlerToledo.Multi
|
||||
serialPort.Write("SI\r\n");
|
||||
}
|
||||
|
||||
/// <summary>Units for SetUnits() argument</summary>
|
||||
public enum Units
|
||||
{
|
||||
g,
|
||||
kg,
|
||||
t,
|
||||
lb,
|
||||
oz
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the serial number
|
||||
/// </summary>
|
||||
/// <remarks>After a successful SetUnits(kg) mass is still sent in g. MH 15.10.2013</remarks>
|
||||
public void SetUnits(Units unit)
|
||||
{
|
||||
if (balanceCfg.DebugLevel == Entities.DebugMode.Simulate) return;
|
||||
|
||||
if (msrmntState == MsrmntState.Busy)
|
||||
{
|
||||
log.Warn("SetUnits() returns without setting the units because measurementState == MeasurementState.Busy");
|
||||
return;
|
||||
}
|
||||
|
||||
log.InfoFormat("SetUnits({0})", unit);
|
||||
|
||||
msrmntState = MsrmntState.Busy;
|
||||
stringBuilder.Clear();
|
||||
switch (unit)
|
||||
{
|
||||
case Units.g: serialPort.Write("U g\r\n"); break;
|
||||
case Units.kg: serialPort.Write("U kg\r\n"); break;
|
||||
case Units.t: serialPort.Write("U t\r\n"); break;
|
||||
case Units.lb: serialPort.Write("U lb\r\n"); break;
|
||||
case Units.oz: serialPort.Write("U oz\r\n"); break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parse characters received from the serial port
|
||||
/// </summary>
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
/// Warn: Start measurement when busy is true
|
||||
/// </summary>
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(BalanceDev));
|
||||
public override string ToString() { return string.Format("MettlerToledo.Balance({0})", Cfg.ToString(1)); }
|
||||
public override string ToString() { return string.Format("MettlerToledo.Standard.Balance({0})", Cfg.ToString(1)); }
|
||||
|
||||
protected readonly BalanceCfg balanceCfg;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
/// Warn: Start measurement when busy is true
|
||||
/// </summary>
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(BalanceNewDev));
|
||||
public override string ToString() { return string.Format("MettlerToledo.BalanceNew({0})", Cfg.ToString(1)); }
|
||||
public override string ToString() { return string.Format("MettlerToledo.Standard.BalanceNew({0})", Cfg.ToString(1)); }
|
||||
|
||||
/// <summary>Serial number after GetSerialNumber() when MsrmntState == MsrmntState.Valid</summary>
|
||||
public string SerialNumber { get { return serialNumber; } }
|
||||
|
||||
Reference in New Issue
Block a user