Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 2 additions & 18 deletions Examples/GUIsimple/GUIsimpleForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -298,23 +298,6 @@ private void button1_Click(object sender, EventArgs e)
string display = "";
switch (comboBox1.SelectedItem)
{
/**
* Serial number
Device identification
Firmware version
Weight step
Scale range
Tare mode
Weight stable
Manual tare value
Maximum capacity
Calibration weight
Zero signal
Nominal signal
Connection
Connection type
Application mode
* **/

case "Serial number":
display = _wtxDevice.SerialNumber;
Expand All @@ -326,7 +309,8 @@ Application mode
display = _wtxDevice.FirmwareVersion;
break;
case "Weight step (DSE)":
display = ((DSEJet)_wtxDevice).WeightStep.ToString() + " " + _wtxDevice.Unit;
if (_wtxDevice.GetType() == typeof(DSEJet)) display = ((DSEJet)_wtxDevice).WeightStep.ToString() + " " + _wtxDevice.Unit;
else display = "Device is not instance of DSE!";
break;
case "Scale range":
display = _wtxDevice.ScaleRange.ToString();
Expand Down
19 changes: 11 additions & 8 deletions Hbm.Automation.API/Weighing/DSE/DSEJet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ public class DSEJet : BaseWTDevice, IDataScale, IDataDigitalFilter
private const int SCALE_COMMAND_CLEAR_PEAK_VALUES = 1801545072;
private const int SCALE_COMMAND_ZERO = 1869768058;
private const int SCALE_COMMAND_SET_GROSS = 1936683623;
private const int SCALE_COMMAND_STATUS_ONGOING = 1634168417;
private const int SCALE_COMMAND_STATUS_OK = 1801543519;
private const int SCALE_COMMAND_STATUS_ONGOING = 1869049455;
private const int SCALE_COMMAND_STATUS_OK = 1802461023;
private const int SCALE_COMMAND_STATUS_ERROR_E1 = 826629983;
private const int SCALE_COMMAND_STATUS_ERROR_E2 = 843407199;
private const int SCALE_COMMAND_STATUS_ERROR_E3 = 860184415;
Expand Down Expand Up @@ -828,25 +828,26 @@ public override void RecordWeight()
{
Connection.WriteInteger(JetBusCommands.STORecordWeight, SCALE_COMMAND_TARE);
}

///<inheritdoc/>
public override void CalculateAdjustment(double scaleZeroLoad_mVV, double scaleCapacity_mVV)
{
int scalZeroLoad_d;
int scaleCapacity_d;
int scaleCapacity_d;

scalZeroLoad_d = (int)(scaleZeroLoad_mVV * CONVERISION_FACTOR_MVV_TO_D);
scaleCapacity_d = (int)(scalZeroLoad_d + (scaleCapacity_mVV * CONVERISION_FACTOR_MVV_TO_D));

Connection.WriteInteger(JetBusCommands.LDWZeroValue, scalZeroLoad_d);
Connection.WriteInteger(JetBusCommands.LWTNominalValue, Convert.ToInt32(scaleCapacity_d));

this.ZeroSignal = Convert.ToInt32(scalZeroLoad_d);
this.NominalSignal = Convert.ToInt32(scaleCapacity_d);

}

///<inheritdoc/>
public override bool AdjustZeroSignal()
{
Connection.WriteInteger(JetBusCommands.CIA461ScaleCommand, SCALE_COMMAND_CALIBRATE_ZERO);

while (Convert.ToInt32(Connection.ReadFromBuffer(JetBusCommands.CIA461ScaleCommandStatus)) != SCALE_COMMAND_STATUS_ONGOING)
{
Thread.Sleep(200);
Expand Down Expand Up @@ -922,6 +923,8 @@ protected override void ProcessDataUpdateTick(object info)
}
}



public FilterTypes FilterType(int i)
{
//Convert ascending integer into filter type
Expand Down
28 changes: 17 additions & 11 deletions Hbm.Automation.API/Weighing/WTX/WTXJet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -858,12 +858,14 @@ public override void CalculateAdjustment(double scaleZeroLoad_mVV, double scaleC
///<inheritdoc/>
public override bool AdjustZeroSignal()
{
Connection.WriteInteger(JetBusCommands.CIA461ScaleCommand, SCALE_COMMAND_CALIBRATE_ZERO);
Connection.WriteInteger(JetBusCommands.CIA461ScaleCommand, SCALE_COMMAND_CALIBRATE_ZERO);

while (Convert.ToInt32(Connection.ReadFromBuffer(JetBusCommands.CIA461ScaleCommandStatus)) != SCALE_COMMAND_STATUS_ONGOING)
int com = Convert.ToInt32(Connection.ReadFromBuffer(JetBusCommands.CIA461ScaleCommandStatus));
while ((com != SCALE_COMMAND_STATUS_ONGOING) && (com != SCALE_COMMAND_STATUS_OK))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Roland,
How is that supposed to work?
The loop will only break, if status is not ONGOING and not OK ???
Think about a minimum delay before entering the ONGOING loop!
BR
Dirk

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Dirk,
I'm sorry but I think you got your logic backwards.
Actually the loop will continue if the status is neither ONGOING nor OK.
Meaning it will break if the status reaches either ONGOING or OK.

Again, sorry for replying to a three year old issue. I just couldn't help but notice.

{
Thread.Sleep(200);
}
Thread.Sleep(10);
com = Convert.ToInt32(Connection.ReadFromBuffer(JetBusCommands.CIA461ScaleCommandStatus));
}
while (Convert.ToInt32(Connection.ReadFromBuffer(JetBusCommands.CIA461ScaleCommandStatus)) == SCALE_COMMAND_STATUS_ONGOING)
{
Thread.Sleep(200);
Expand All @@ -882,9 +884,11 @@ public override bool AdjustNominalSignal()
{
Connection.WriteInteger(JetBusCommands.CIA461ScaleCommand, SCALE_COMMAND_CALIBRATE_NOMINAL);

while (Convert.ToInt32(Connection.ReadFromBuffer(JetBusCommands.CIA461ScaleCommandStatus)) != SCALE_COMMAND_STATUS_ONGOING)
int com = Convert.ToInt32(Connection.ReadFromBuffer(JetBusCommands.CIA461ScaleCommandStatus));
while ((com != SCALE_COMMAND_STATUS_ONGOING) && (com != SCALE_COMMAND_STATUS_OK))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same...

{
Thread.Sleep(100);
Thread.Sleep(10);
com = Convert.ToInt32(Connection.ReadFromBuffer(JetBusCommands.CIA461ScaleCommandStatus));
}

while (Convert.ToInt32(Connection.ReadFromBuffer(JetBusCommands.CIA461ScaleCommandStatus)) == SCALE_COMMAND_STATUS_ONGOING)
Expand All @@ -906,13 +910,15 @@ public override bool AdjustNominalSignalWithCalibrationWeight(double calibration
Connection.WriteInteger(JetBusCommands.CIA461CalibrationWeight, MeasurementUtils.DoubleToDigit(calibrationWeight, ProcessData.Decimals));

Connection.WriteInteger(JetBusCommands.CIA461ScaleCommand, SCALE_COMMAND_CALIBRATE_NOMINAL);


while (Convert.ToInt32(Connection.ReadFromBuffer(JetBusCommands.CIA461ScaleCommandStatus)) != SCALE_COMMAND_STATUS_ONGOING)


int com = Convert.ToInt32(Connection.ReadFromBuffer(JetBusCommands.CIA461ScaleCommandStatus));
while ((com != SCALE_COMMAND_STATUS_ONGOING) && (com != SCALE_COMMAND_STATUS_OK))
{
Thread.Sleep(100);
Thread.Sleep(10);
com = Convert.ToInt32(Connection.ReadFromBuffer(JetBusCommands.CIA461ScaleCommandStatus));
}

while (Convert.ToInt32(Connection.ReadFromBuffer(JetBusCommands.CIA461ScaleCommandStatus)) == SCALE_COMMAND_STATUS_ONGOING)
{
Thread.Sleep(100);
Expand Down